summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Santos <quentin.santos@worldonline.fr>2017-04-25 16:21:20 +0200
committerBrian May <brian@linuxpenguins.xyz>2018-02-16 08:07:02 +1100
commit93b969a049983dcac0c659c015ab7e09660ed825 (patch)
treeddddff71533b380e706f2419888d771e0d3c7df4
parentf27b27b0e84d39a7a3dfb83ac25ce74237ffebcb (diff)
Fix compatibility with the sudoers file
Starting sshuttle without having to type in one's password requires to put the sudo-ed command in the `/etc/sudoers` file. However, sshuttle sets an environment variable, which cannot be done as-is in the sudoers file. This fix prepend the /usr/bin/env command, which allows one to pass fixed environment variables to a sudo-ed command. In practice, the sub-command: ``` sudo PYTHONPATH=/usr/lib/python3/dist-packages -- \ /usr/bin/python3 /usr/bin/sshuttle --method auto --firewall ``` becomes ``` sudo /usr/bin/env PYTHONPATH=/usr/lib/python3/dist-packages \ /usr/bin/python3 /usr/bin/sshuttle --method auto --firewall ```
-rw-r--r--sshuttle/client.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sshuttle/client.py b/sshuttle/client.py
index a85f3bf..907c78c 100644
--- a/sshuttle/client.py
+++ b/sshuttle/client.py
@@ -193,8 +193,8 @@ class FirewallClient:
if ssyslog._p:
argvbase += ['--syslog']
argv_tries = [
- ['sudo', '-p', '[local sudo] Password: ',
- ('PYTHONPATH=%s' % python_path), '--'] + argvbase,
+ ['sudo', '-p', '[local sudo] Password: ', '/usr/bin/env',
+ ('PYTHONPATH=%s' % python_path)] + argvbase,
argvbase
]