mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-03-16 00:59:29 +01:00
Remove the --noserver option.
It didn't work anyway. Obviously it hasn't been tested (or apparently needed) in a long time.
This commit is contained in:
parent
bcf1892305
commit
8b7605cc5d
75
client.py
75
client.py
@ -98,35 +98,34 @@ class FirewallClient:
|
|||||||
raise Fatal('cleanup: %r returned %d' % (self.argv, rv))
|
raise Fatal('cleanup: %r returned %d' % (self.argv, rv))
|
||||||
|
|
||||||
|
|
||||||
def _main(listener, fw, use_server, remotename, python, seed_hosts, auto_nets):
|
def _main(listener, fw, remotename, python, seed_hosts, auto_nets):
|
||||||
handlers = []
|
handlers = []
|
||||||
if use_server:
|
if helpers.verbose >= 1:
|
||||||
if helpers.verbose >= 1:
|
helpers.logprefix = 'c : '
|
||||||
helpers.logprefix = 'c : '
|
else:
|
||||||
|
helpers.logprefix = 'client: '
|
||||||
|
debug1('connecting to server...\n')
|
||||||
|
try:
|
||||||
|
(serverproc, serversock) = ssh.connect(remotename, python)
|
||||||
|
except socket.error, e:
|
||||||
|
if e.errno == errno.EPIPE:
|
||||||
|
raise Fatal("failed to establish ssh session")
|
||||||
else:
|
else:
|
||||||
helpers.logprefix = 'client: '
|
raise
|
||||||
debug1('connecting to server...\n')
|
mux = Mux(serversock, serversock)
|
||||||
try:
|
handlers.append(mux)
|
||||||
(serverproc, serversock) = ssh.connect(remotename, python)
|
|
||||||
except socket.error, e:
|
|
||||||
if e.errno == errno.EPIPE:
|
|
||||||
raise Fatal("failed to establish ssh session")
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
mux = Mux(serversock, serversock)
|
|
||||||
handlers.append(mux)
|
|
||||||
|
|
||||||
expected = 'SSHUTTLE0001'
|
expected = 'SSHUTTLE0001'
|
||||||
initstring = serversock.recv(len(expected))
|
initstring = serversock.recv(len(expected))
|
||||||
|
|
||||||
|
rv = serverproc.poll()
|
||||||
|
if rv:
|
||||||
|
raise Fatal('server died with error code %d' % rv)
|
||||||
|
|
||||||
rv = serverproc.poll()
|
if initstring != expected:
|
||||||
if rv:
|
raise Fatal('expected server init string %r; got %r'
|
||||||
raise Fatal('server died with error code %d' % rv)
|
% (expected, initstring))
|
||||||
|
debug1('connected.\n')
|
||||||
if initstring != expected:
|
|
||||||
raise Fatal('expected server init string %r; got %r'
|
|
||||||
% (expected, initstring))
|
|
||||||
debug1('connected.\n')
|
|
||||||
|
|
||||||
def onroutes(routestr):
|
def onroutes(routestr):
|
||||||
if auto_nets:
|
if auto_nets:
|
||||||
@ -162,12 +161,9 @@ def _main(listener, fw, use_server, remotename, python, seed_hosts, auto_nets):
|
|||||||
debug1("-- ignored: that's my address!\n")
|
debug1("-- ignored: that's my address!\n")
|
||||||
sock.close()
|
sock.close()
|
||||||
return
|
return
|
||||||
if use_server:
|
chan = mux.next_channel()
|
||||||
chan = mux.next_channel()
|
mux.send(chan, ssnet.CMD_CONNECT, '%s,%s' % dstip)
|
||||||
mux.send(chan, ssnet.CMD_CONNECT, '%s,%s' % dstip)
|
outwrap = MuxWrapper(mux, chan)
|
||||||
outwrap = MuxWrapper(mux, chan)
|
|
||||||
else:
|
|
||||||
outwrap = ssnet.connect_dst(dstip[0], dstip[1])
|
|
||||||
handlers.append(Proxy(SockWrapper(sock, sock), outwrap))
|
handlers.append(Proxy(SockWrapper(sock, sock), outwrap))
|
||||||
handlers.append(Handler([listener], onaccept))
|
handlers.append(Handler([listener], onaccept))
|
||||||
|
|
||||||
@ -176,18 +172,16 @@ def _main(listener, fw, use_server, remotename, python, seed_hosts, auto_nets):
|
|||||||
mux.send(0, ssnet.CMD_HOST_REQ, '\n'.join(seed_hosts))
|
mux.send(0, ssnet.CMD_HOST_REQ, '\n'.join(seed_hosts))
|
||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
if use_server:
|
rv = serverproc.poll()
|
||||||
rv = serverproc.poll()
|
if rv:
|
||||||
if rv:
|
raise Fatal('server died with error code %d' % rv)
|
||||||
raise Fatal('server died with error code %d' % rv)
|
|
||||||
|
|
||||||
ssnet.runonce(handlers, mux)
|
ssnet.runonce(handlers, mux)
|
||||||
if use_server:
|
mux.callback()
|
||||||
mux.callback()
|
mux.check_fullness()
|
||||||
mux.check_fullness()
|
|
||||||
|
|
||||||
|
|
||||||
def main(listenip, use_server, remotename, python, seed_hosts, auto_nets,
|
def main(listenip, remotename, python, seed_hosts, auto_nets,
|
||||||
subnets_include, subnets_exclude):
|
subnets_include, subnets_exclude):
|
||||||
debug1('Starting sshuttle proxy.\n')
|
debug1('Starting sshuttle proxy.\n')
|
||||||
listener = socket.socket()
|
listener = socket.socket()
|
||||||
@ -218,7 +212,6 @@ def main(listenip, use_server, remotename, python, seed_hosts, auto_nets,
|
|||||||
fw = FirewallClient(listenip[1], subnets_include, subnets_exclude)
|
fw = FirewallClient(listenip[1], subnets_include, subnets_exclude)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return _main(listener, fw, use_server, remotename,
|
return _main(listener, fw, remotename, python, seed_hosts, auto_nets)
|
||||||
python, seed_hosts, auto_nets)
|
|
||||||
finally:
|
finally:
|
||||||
fw.done()
|
fw.done()
|
||||||
|
2
main.py
2
main.py
@ -57,7 +57,6 @@ 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)
|
||||||
v,verbose increase debug message verbosity
|
v,verbose increase debug message verbosity
|
||||||
seed-hosts= with -H, use these hostnames for initial scan (comma-separated)
|
seed-hosts= with -H, use these hostnames for initial scan (comma-separated)
|
||||||
noserver don't use a separate server process (mostly for debugging)
|
|
||||||
server (internal use only)
|
server (internal use only)
|
||||||
firewall (internal use only)
|
firewall (internal use only)
|
||||||
hostwatch (internal use only)
|
hostwatch (internal use only)
|
||||||
@ -98,7 +97,6 @@ try:
|
|||||||
else:
|
else:
|
||||||
sh = None
|
sh = None
|
||||||
sys.exit(client.main(parse_ipport(opt.listen or '0.0.0.0:0'),
|
sys.exit(client.main(parse_ipport(opt.listen or '0.0.0.0:0'),
|
||||||
not opt.noserver,
|
|
||||||
remotename,
|
remotename,
|
||||||
(opt.python or "python"),
|
(opt.python or "python"),
|
||||||
sh,
|
sh,
|
||||||
|
Loading…
Reference in New Issue
Block a user