Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sshuttle crashes with `server died with error code 255` #150

Closed
gromero opened this issue May 10, 2017 · 25 comments

Comments

@gromero
Copy link

commented May 10, 2017

@gromero

This comment has been minimized.

Copy link
Author

commented May 11, 2017

I'm wondering if it's just because ssh connection to the peer broke due to a banal timeout (probably not suitable for the purpose of sshuttle):

c : received PING response
c : Waiting: 2 r=[7, 14] w=[] x=[] (fullness=0/0)
 s: mux wrote: 15/15
 s: Waiting: 1 r=[4] w=[] x=[] (fullness=0/0)
packet_write_wait: Connection to 177.220.10.12 port 21214: Broken pipe
c :   Ready: 2 r=[14] w=[] x=[]
firewall manager: undoing changes.
firewall manager: undoing IPv4 changes.
>> iptables -t nat -D OUTPUT -j sshuttle-12298
>> iptables -t nat -D PREROUTING -j sshuttle-12298
>> iptables -t nat -F sshuttle-12298
>> iptables -t nat -X sshuttle-12298
firewall manager: undoing /etc/hosts changes.
c : fatal: server died with error code 255
The program exited via sys.exit(). Exit status:  99
> /usr/local/bin/sshuttle(4)<module>()
-> import re
(Pdb) 
@gromero

This comment has been minimized.

Copy link
Author

commented May 11, 2017

It's not an issue, but just a matter of setting the keepalive on the server side. So adding ServerAliveInterval 120 in .ssh/config solved it. So I'm closing this issue.

@gromero gromero closed this May 11, 2017

@rsolvang

This comment has been minimized.

Copy link

commented Jan 8, 2018

I have had this issue on and off for a while, but usually it works after a few tries. Not today.
sshuttle --dns -r user@server 0/0 client: Connected. packet_write_wait: Connection to xx.xx.xx.xx 0 port xxxxx: Broken pipe client: fatal: server died with error code 255

Tried to add the ServerAliveInterval 120 to the config file, without any luck. Server is running Fedora Server 27 and client is Arch (up to date).

@bonfus

This comment has been minimized.

Copy link

commented Jan 16, 2018

Same here. Posting verbose log:

$sshuttle -vvvv -r username@xxx.xxx.xxx.xxx 0/0
Starting sshuttle proxy.
firewall manager: Starting firewall with Python version 3.6.3
firewall manager: ready method name nat.
IPv6 enabled: False
UDP enabled: False
DNS enabled: False
Binding redirector: 12300
TCP redirector listening on ('127.0.0.1', 12300).
TCP redirector listening with <socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 12300)>.
Starting client with Python version 3.6.3
c : connecting to server...
c : executing: ['ssh', 'username@xxx.xxx.xxx.xxx', '--', 'exec /bin/sh -c \'P=python3.5; $P -V 2>/dev/null || P=python; exec "$P" -c \'"\'"\'import sys, os; verbosity=4; sys.stdin = os.fdopen(0, "rb"); exec(compile(sys.stdin.read(978), "assembler.py", "exec"))\'"\'"\'\'']
c :  > channel=0 cmd=PING len=7 (fullness=0)
username@xxx.xxx.xxx.xxx's password: 
server: assembling u'sshuttle' (7 bytes)
server: assembling u'sshuttle.cmdline_options' (44 bytes)
server: assembling u'sshuttle.helpers' (950 bytes)
server: assembling u'sshuttle.ssnet' (5624 bytes)
server: assembling u'sshuttle.hostwatch' (2367 bytes)
server: assembling u'sshuttle.server' (3558 bytes)
Starting server with Python version 2.6.6
 s: latency control setting = True
 s: available routes:
 s:   2/160.78.35.0/25
 s:   2/192.135.11.0/24
 s:   2/169.254.0.0/16
 s:   2/169.254.0.0/16
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:  > channel=0 cmd=PING len=7 (fullness=0)
 s:  > channel=0 cmd=ROUTES len=69 (fullness=7)
 s: Waiting: 1 r=[4] w=[5] x=[] (fullness=76/0)
 s:   Ready: 1 r=[] w=[5] x=[]
 s: mux wrote: 15/15
 s: Waiting: 1 r=[4] w=[5] x=[] (fullness=76/0)
 s:   Ready: 1 r=[] w=[5] x=[]
 s: mux wrote: 77/77
 s: Waiting: 1 r=[4] w=[] x=[] (fullness=76/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=69
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
firewall manager: setting up.
firewall manager: setting up IPv4.
>> iptables -t nat -N sshuttle-12300
 s:   Ready: 1 r=[4] w=[] x=[]
 s: <  channel=0 cmd=PING len=7
 s:  > channel=0 cmd=PONG len=7 (fullness=76)
>> iptables -t nat -F sshuttle-12300
 s: mux wrote: 15/15
 s: Waiting: 1 r=[4] w=[] x=[] (fullness=83/0)
>> 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 --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 42
c : mux wrote: 15/15
c : <  channel=0 cmd=PONG len=7
c : received PING response
packet_write_wait: Connection to xxx.xxx.xxx.xxx port 22: Broken pipe
c : Waiting: 2 r=[5, 8] w=[] x=[] (fullness=0/0)
c :   Ready: 2 r=[8] w=[] x=[]
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
firewall manager: undoing /etc/hosts changes.
c : fatal: server died with error code 255
@brianmay

This comment has been minimized.

Copy link
Member

commented Jan 16, 2018

@bonfus

This comment has been minimized.

Copy link

commented Jan 18, 2018

@brianmay It seems to be working, I tried a couple of times and the error is gone! Thank you!

@rsolvang

This comment has been minimized.

Copy link

commented Jan 18, 2018

@brianmay This worked for me too!

@dogukanarkan

This comment has been minimized.

Copy link

commented Jan 25, 2018

It worked. Thank you @brianmay !

@fl4shk

This comment has been minimized.

Copy link

commented Feb 11, 2018

I'm probably being a little redundant here, but this also worked for me.

@nsomaru

This comment has been minimized.

Copy link

commented Feb 22, 2018

Just a question: shouldn't this be fixed on the sshuttle side? I'm getting the same error and it basically means i need to run sshuttle twice.

@brianmay

This comment has been minimized.

Copy link
Member

commented Feb 23, 2018

It isn't a server side issue, it is a client side issue. Although not sure how you would solve this by running sshuttle twice, it is possible you have a different problem...

@nsomaru

This comment has been minimized.

Copy link

commented Feb 23, 2018

@brianmay, as @rsolvang mentioned above, it usually works after a few tries. In my case, a_few_tries = 2.

Also looking at your response, perhaps you mean it is a server side issue? If so, why can I connect fine using SSH every time, but not sshuttle? Strange indeed!

@gromero

This comment has been minimized.

Copy link
Author

commented Feb 23, 2018

@brianmay Why not setting by default that -x xxx.xxx.xxx is passed? Looks like a lot of people are facing the same issue...

@gromero gromero reopened this Feb 23, 2018

@brianmay

This comment has been minimized.

Copy link
Member

commented Feb 23, 2018

If passing -x xxx.xxxx.xxx.xxx helps solve your problem, then is because your kernel on the sshuttle client is intercepting ssh packets to the server and redirecting them to sshuttle. This cannot work. As explained in #191 and #193. As this is a kernel issue, and an issue I cannot reproduce myself, there is nothing I can do to fix the problem in sshuttle. In any case, closing this report again, at is seems to be identical to #191.

@brianmay brianmay closed this Feb 23, 2018

@dc0d

This comment has been minimized.

Copy link

commented May 23, 2018

Same problem - on fresh Ubuntu 18.04.

I can ssh to the server.

@Belval

This comment has been minimized.

Copy link

commented May 23, 2018

@dc0d do sshuttle -r user@host 0/0 -x host that solved it for me on 18.04.

@wmantly

This comment has been minimized.

Copy link

commented Jul 7, 2018

Same issue on a fresh Linux Mint 19 install, sshuttle -r user@host 0/0 -x host works.

@ghost

This comment has been minimized.

Copy link

commented Jul 9, 2018

@ghost

This comment has been minimized.

Copy link

commented Jul 11, 2018

For those who are lazy like me, you can use bash function (just add it to your .bashrc or .bash_profile):

proxysshuttle() {
  hostname=$(echo $1 | grep -oP '(?<=@).*')
  sshuttle --dns --verbose --remote $1 --exclude $hostname 0/0
}

Example usage:

proxysshuttle username@123.324.433.322
@ArtemChekunov

This comment has been minimized.

Copy link

commented Jul 23, 2018

--remote TARGET_HOST --exclude TARGET_HOST is working for me

@prettybot

This comment has been minimized.

Copy link

commented Nov 30, 2018

@brianmay
Works well. Thanks man.

@mungujakisa

This comment has been minimized.

Copy link

commented Feb 25, 2019

excluding my host worked for me. I'd given up on sshuttle until I came across this.
Thanks.

@itcmixu

This comment has been minimized.

Copy link

commented Jun 27, 2019

It worked. Thank you @brianmay !
but it is really strange why it goes wrong after such long time OK?

@brianmay

This comment has been minimized.

Copy link
Member

commented Jun 29, 2019

This is as a result of a change in the Linux kernel. See #191 .

@itcmixu

This comment has been minimized.

Copy link

commented Jun 30, 2019

This is as a result of a change in the Linux kernel. See #191 .

thanks, got it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.