How to make sshuttle work on a Docker container?

  docker, proxy, python, ssh, vpn

I run the command sudo sshuttle -r [email protected] 0.0.0.0/0 -vv but got the following error messages saying "c : fatal: ssh connection to server (pid 380) exitedwith returncode 255". Notice that I’m running sshuttle inside Docker (Ubuntu 20.04) and I have have configured SSH ProxyCommand in /root/.ssh/config to visit server since it cannot be visited directly. I’ve verified that the same settings work inside a VM, so it seems to me that the issue is coming from the Docker environment. Any insights what might have caused the issue?

bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
server: assembling 'sshuttle' (88 bytes)
server: assembling 'sshuttle.cmdline_options' (65 bytes)
server: assembling 'sshuttle.helpers' (892 bytes)
server: assembling 'sshuttle.ssnet' (5789 bytes)
server: assembling 'sshuttle.hostwatch' (2466 bytes)
server: assembling 'sshuttle.server' (3929 bytes)
Starting server with Python version 3.6.8
 s: latency control setting = True
 s:  > channel=0 cmd=PING len=7 (fullness=0)
 s: auto-nets:False
 s:  > channel=0 cmd=ROUTES len=0 (fullness=7)
 s: Waiting: 1 r=[0] w=[1] x=[] (fullness=7/0)
c : Connected.
c : Waiting: 2 r=[5, 8] w=[8] x=[] (fullness=7/0)
c :   Ready: 2 r=[] w=[8] x=[]
c : mux wrote: 15/15
c : Waiting: 2 r=[5, 8] w=[] x=[] (fullness=7/0)
 s:   Ready: 1 r=[] w=[1] x=[]
 s: mux wrote: 15/15
 s: Waiting: 1 r=[0] w=[1] x=[] (fullness=7/0)
 s:   Ready: 1 r=[] w=[1] x=[]
 s: mux wrote: 8/8
 s: Waiting: 1 r=[0] w=[] x=[] (fullness=7/0)
c :   Ready: 2 r=[8] w=[] x=[]
c : <  channel=0 cmd=PING len=7
c :  > channel=0 cmd=PONG len=7 (fullness=7)
c : <  channel=0 cmd=ROUTES len=0
firewall manager: Got subnets: [(2, 0, False, '0.0.0.0', 0, 0), (2, 32, True, '127.0.0.1', 0, 0)]
firewall manager: Got nslist: []
firewall manager: Got ports: 0,12300,0,0
firewall manager: Got udp: False, user: None
firewall manager: setting up.
firewall manager: setting up IPv4.
>> iptables -t nat -N sshuttle-12300
>> iptables -t nat -F sshuttle-12300
>> iptables -t nat -I OUTPUT 1 -j sshuttle-12300
>> iptables -t nat -I PREROUTING 1 -j sshuttle-12300
>> iptables -t nat -A sshuttle-12300 -j RETURN -m addrtype --dst-type LOCAL ! -p udp
>> iptables -t nat -A sshuttle-12300 -j RETURN -m addrtype --dst-type LOCAL -p udp ! --dport 53
>> iptables -t nat -A sshuttle-12300 -j RETURN --dest 127.0.0.1/32 -p tcp
>> iptables -t nat -A sshuttle-12300 -j REDIRECT --dest 0.0.0.0/0 -p tcp --to-ports 12300 -m ttl ! --ttl 63
c : mux wrote: 15/15
c : Waiting: 2 r=[5, 8] w=[] x=[] (fullness=14/0)
client_loop: send disconnect: Broken pipe
client_loop: send disconnect: Broken pipe
c :   Ready: 2 r=[8] w=[] x=[]
firewall manager: undoing changes.
firewall manager: undoing IPv4 changes.
>> iptables -t nat -D OUTPUT -j sshuttle-12300
>> iptables -t nat -D PREROUTING -j sshuttle-12300
>> iptables -t nat -F sshuttle-12300
>> iptables -t nat -X sshuttle-12300
c : fatal: ssh connection to server (pid 380) exitedwith returncode 255

Source: Docker Questions

LEAVE A COMMENT