From 649ec5dfa1d2c0e324d8054b4c7402ab2b462d93 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Sat, 29 Feb 2020 04:59:56 -0500 Subject: [PATCH] pkexec wrapper: fix gdebi / synaptic but at cost of checking for passwordless sudo /etc/suders /etc/sudoers.d exceptions. http://forums.whonix.org/t/cannot-use-pkexec/8129/53 --- usr/bin/pkexec.security-misc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/usr/bin/pkexec.security-misc b/usr/bin/pkexec.security-misc index 8a844fc..03d7f9a 100755 --- a/usr/bin/pkexec.security-misc +++ b/usr/bin/pkexec.security-misc @@ -104,14 +104,15 @@ exit_code=0 ## lxqt-sudo does not check /etc/sudoers / /etc/sudoers.d exceptions. ## Therefore use 'sudo -l' to see if there is any already existing sudoers exception. -if sudo -l --non-interactive $maybe_switch_to_user --set-home PKEXEC_UID="$PKEXEC_UID" "$@" ; then - log_to_journal "sudoers exception: yes" - sudo --non-interactive $maybe_switch_to_user --set-home PKEXEC_UID="$PKEXEC_UID" "$@" || { exit_code=$? ; true; }; - log_to_journal "sudo --user | exit_code: '$exit_code'" - exit "$exit_code" -fi - -log_to_journal "sudoers exception: no" +## Did not work. 'sudo -l' will always exit with exit code '0'. +# if sudo -l --non-interactive $maybe_switch_to_user --set-home PKEXEC_UID="$PKEXEC_UID" "$@" ; then +# log_to_journal "sudoers exception: yes" +# sudo --non-interactive $maybe_switch_to_user --set-home PKEXEC_UID="$PKEXEC_UID" "$@" || { exit_code=$? ; true; }; +# log_to_journal "sudo --user | exit_code: '$exit_code'" +# exit "$exit_code" +# fi +# +# log_to_journal "sudoers exception: no" if [ "$switch_user" = "true" ]; then ## 'sudo --user user' clears environment variables such as PATH.