mirror of
https://github.com/sshuttle/sshuttle.git
synced 2024-11-24 17:04:36 +01:00
Add support for SSHUTTLE_ARGS environment variable
This commit is contained in:
parent
3c3f5de672
commit
0ddebdeee6
@ -321,6 +321,18 @@ annotations. For example::
|
||||
192.168.63.0/24
|
||||
|
||||
|
||||
Environment Variable
|
||||
--------------------
|
||||
|
||||
You can specify command line options with the `SSHUTTLE_ARGS` environment
|
||||
variable. If a given option is defined in both the environment variable and
|
||||
command line, the value on the command line will take precedence.
|
||||
|
||||
For example::
|
||||
|
||||
SSHUTTLE_ARGS="-e 'ssh -v' --dns" sshuttle -r example.com 0/0
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import socket
|
||||
import sys
|
||||
import sshuttle.helpers as helpers
|
||||
import sshuttle.client as client
|
||||
import sshuttle.firewall as firewall
|
||||
@ -11,7 +14,13 @@ from sshuttle.sudoers import sudoers
|
||||
|
||||
|
||||
def main():
|
||||
opt = parser.parse_args()
|
||||
if 'SSHUTTLE_ARGS' in os.environ:
|
||||
env_args = shlex.split(os.environ['SSHUTTLE_ARGS'])
|
||||
else:
|
||||
env_args = []
|
||||
args = [*env_args, *sys.argv[1:]]
|
||||
|
||||
opt = parser.parse_args(args)
|
||||
|
||||
if opt.sudoers_no_modify:
|
||||
# sudoers() calls exit() when it completes
|
||||
|
Loading…
Reference in New Issue
Block a user