Merge pull request #727 from skuhl/fix-sudoers-in-1.1.0

Make --sudoers option work properly, fix regression in v1.1.0
This commit is contained in:
Brian May 2022-02-04 09:22:29 +11:00 committed by GitHub
commit c783fdb472
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -205,8 +205,8 @@ class FirewallClient:
else:
# Linux typically uses sudo; OpenBSD uses doas. However, some
# Linux distributions are starting to use doas.
sudo_cmd = ['sudo', '-p', '[local sudo] Password: ']+argvbase
doas_cmd = ['doas']+argvbase
sudo_cmd = ['sudo', '-p', '[local sudo] Password: ']
doas_cmd = ['doas']
# For clarity, try to replace executable name with the
# full path.
@ -225,8 +225,13 @@ class FirewallClient:
pp_prefix = ['/usr/bin/env',
'PYTHONPATH=%s' %
os.path.dirname(os.path.dirname(__file__))]
sudo_cmd = pp_prefix + sudo_cmd
doas_cmd = pp_prefix + doas_cmd
sudo_cmd = sudo_cmd + pp_prefix
doas_cmd = doas_cmd + pp_prefix
# Final order should be: sudo/doas command, env
# pythonpath, and then argvbase (sshuttle command).
sudo_cmd = sudo_cmd + argvbase
doas_cmd = doas_cmd + argvbase
# If we can find doas and not sudo or if we are on
# OpenBSD, try using doas first.