Compare commits

...

7 Commits

Author SHA1 Message Date
29d2e06bf5 Added --exclude-from feature.
(Slightly modified by apenwarr)
2012-07-06 15:13:30 -04:00
bff1610050 Document missing --dns option in sshuttle manpage 2012-07-06 15:06:07 -04:00
cce6a9d96d firewall.py: catch SIGINT and SIGTERM too.
There were still a few conditions under some OSes that would cause
firewall.py to terminate without cleaning up the firewall settings.  'pkill
sshuttle' was one of them.  Ignore a couple more signals to further ensure a
correct cleanup.

(This only affects sshuttle --firewall, which is a subprocess of the main
sshuttle process.  The firewall is supposed to exit automatically whenever
the client exits, and so far that part seems to work reliably.)
2012-07-06 15:00:28 -04:00
5743f29ed6 server.py: slightly rearrange previous commit.
Add some documentation about the int() vs long() and the reason behind
_shl().  Instead of "from __future__ import generators", just don't use
generators.
2012-07-06 15:00:28 -04:00
42bc6d62db Two small changes to server.py that allow it to run on python2.2 2012-04-19 23:00:29 -07:00
274ee854d4 clean.do: don't forget to do version/clean. 2012-02-07 12:17:56 -05:00
12f6a52ec6 Fix runpython.do for systems with unxpected configurations.
If the expected arch directory doesn't exist, give up and don't specify arch at
all. Currently it expands to '*' which fails.

[slightly modified by apenwarr]
2012-02-07 12:16:31 -05:00
6 changed files with 31 additions and 9 deletions

View File

@ -71,6 +71,10 @@ entire subnet to the VPN.
are taken automatically from the server's routing are taken automatically from the server's routing
table. table.
--dns
: capture local DNS requests and forward to the remote DNS
server.
--python --python
: specify the name/path of the remote python interpreter. : specify the name/path of the remote python interpreter.
The default is just `python`, which means to use the The default is just `python`, which means to use the
@ -90,6 +94,10 @@ entire subnet to the VPN.
`0/0 -x 1.2.3.0/24` to forward everything except the `0/0 -x 1.2.3.0/24` to forward everything except the
local subnet over the VPN, for example. local subnet over the VPN, for example.
--exclude-from=*file*
: exclude the subnets specified in a file, one subnet per
line. Useful when you have lots of subnets to exclude.
-v, --verbose -v, --verbose
: print more information about the session. This option : print more information about the session. This option
can be used more than once for increased verbosity. By can be used more than once for increased verbosity. By

View File

@ -1,2 +1,2 @@
redo ui-macos/clean Documentation/clean redo ui-macos/clean Documentation/clean version/clean
rm -f *~ */*~ .*~ */.*~ *.8 *.tmp */*.tmp *.pyc */*.pyc rm -f *~ */*~ .*~ */.*~ *.8 *.tmp */*.tmp *.pyc */*.pyc

View File

@ -471,6 +471,8 @@ def main(port, dnsport, syslog):
# disappears; we still have to clean up. # disappears; we still have to clean up.
signal.signal(signal.SIGHUP, signal.SIG_IGN) signal.signal(signal.SIGHUP, signal.SIG_IGN)
signal.signal(signal.SIGPIPE, signal.SIG_IGN) signal.signal(signal.SIGPIPE, signal.SIG_IGN)
signal.signal(signal.SIGTERM, signal.SIG_IGN)
signal.signal(signal.SIGINT, signal.SIG_IGN)
# ctrl-c shouldn't be passed along to me. When the main sshuttle dies, # ctrl-c shouldn't be passed along to me. When the main sshuttle dies,
# I'll die automatically. # I'll die automatically.

View File

@ -57,6 +57,7 @@ dns capture local DNS requests and forward to the remote DNS server
python= path to python interpreter on the remote server python= path to python interpreter on the remote server
r,remote= ssh hostname (and optional username) of remote sshuttle server r,remote= ssh hostname (and optional username) of remote sshuttle server
x,exclude= exclude this subnet (can be used more than once) x,exclude= exclude this subnet (can be used more than once)
exclude-from= exclude the subnets in a file (whitespace separated)
v,verbose increase debug message verbosity v,verbose increase debug message verbosity
e,ssh-cmd= the command to use to connect to the remote [ssh] e,ssh-cmd= the command to use to connect to the remote [ssh]
seed-hosts= with -H, use these hostnames for initial scan (comma-separated) seed-hosts= with -H, use these hostnames for initial scan (comma-separated)
@ -104,6 +105,8 @@ try:
for k,v in flags: for k,v in flags:
if k in ('-x','--exclude'): if k in ('-x','--exclude'):
excludes.append(v) excludes.append(v)
if k in ('-X', '--exclude-from'):
excludes += open(v).read().split()
remotename = opt.remote remotename = opt.remote
if remotename == '' or remotename == '-': if remotename == '' or remotename == '-':
remotename = None remotename = None

View File

@ -43,7 +43,12 @@ def _maskbits(netmask):
def _shl(n, bits): def _shl(n, bits):
return n * int(2**bits) # we use our own implementation of left-shift because
# results may be different between older and newer versions
# of python for numbers like 1<<32. We use long() because
# int(2**32) doesn't work in older python, which has limited
# int sizes.
return n * long(2**bits)
def _list_routes(): def _list_routes():
@ -68,9 +73,11 @@ def _list_routes():
def list_routes(): def list_routes():
l = []
for (ip,width) in _list_routes(): for (ip,width) in _list_routes():
if not ip.startswith('0.') and not ip.startswith('127.'): if not ip.startswith('0.') and not ip.startswith('127.'):
yield (ip,width) l.append((ip,width))
return l
def _exc_dump(): def _exc_dump():

View File

@ -2,12 +2,14 @@ exec >&2
redo-ifchange runpython.c redo-ifchange runpython.c
ARCHES="" ARCHES=""
printf "Platforms: " printf "Platforms: "
for d in /usr/libexec/gcc/darwin/*; do if [ -d /usr/libexec/gcc/darwin ]; then
PLAT=$(basename "$d") for d in /usr/libexec/gcc/darwin/*; do
[ "$PLAT" != "ppc64" ] || continue # fails for some reason on my Mac PLAT=$(basename "$d")
ARCHES="$ARCHES -arch $PLAT" [ "$PLAT" != "ppc64" ] || continue # fails for some reason on my Mac
printf "$PLAT " ARCHES="$ARCHES -arch $PLAT"
done printf "$PLAT "
done
fi
printf "\n" printf "\n"
gcc $ARCHES \ gcc $ARCHES \
-Wall -o $3 runpython.c \ -Wall -o $3 runpython.c \