Skip to content

Improve error messages related to sshuttle server.#580

Merged
brianmay merged 3 commits intosshuttle:masterfrom
skuhl:better-error-message
Jan 3, 2021
Merged

Improve error messages related to sshuttle server.#580
brianmay merged 3 commits intosshuttle:masterfrom
skuhl:better-error-message

Conversation

@skuhl
Copy link
Contributor

@skuhl skuhl commented Dec 31, 2020

There are many GitHub issues related to the cryptic message:
fatal: expected server init string 'SSHUTTLE0001'; got b''

The code that prints that message is after another check that is
intended to verify that the server is still running. This code was
faulty since the server is still running when rv==None (but exited
when rv==0).

I corrected this problem and then investigated ways to clarify the
error message. I added additional exit codes for the server: 97 (exec
in the shell returned), 98 (the python exec() function called
returned). The end result is that the cryptic error message above will
now print a more appropriate error message that should aid in
debugging.

I also changed the server so that it catches Fatal() and exits with
exit code 99 (like the client does). Previously, it was just an
unhandled exception on the server.

I suspect some of the error messages were caused by restricted shells.
I also investigated and added comments about how sshuttle might behave
if it is being run on a server that has a restricted shell.

This commit also replaces a couple of exit() calls in cmdline.py with
'return' since exit() is intended for interactive use. This change
doesn't impact the server.

There are many GitHub issues related to the cryptic message:
fatal: expected server init string 'SSHUTTLE0001'; got b''

The code that prints that message is after another check that is
intended to verify that the server is still running. This code was
faulty since the server is still running when rv==None (but exited
when rv==0).

I corrected this problem and then investigated ways to clarify the
error message. I added additional exit codes for the server: 97 (exec
in the shell returned), 98 (the python exec() function called
returned). The end result is that the cryptic error message above will
now print a more appropriate error message that should aid in
debugging.

I also changed the server so that it catches Fatal() and exits with
exit code 99 (like the client does). Previously, it was just an
unhandled exception on the server.

I suspect some of the error messages were caused by restricted shells.
I also investigated and added comments about how sshuttle might behave
if it is being run on a server that has a restricted shell.

This commit also replaces a couple of exit() calls in cmdline.py with
'return' since exit() is intended for interactive use. This change
doesn't impact the server.
@brianmay
Copy link
Member

brianmay commented Jan 1, 2021

Thanks. Unfortunately the conflicts will need to be resolved first...

@skuhl
Copy link
Contributor Author

skuhl commented Jan 2, 2021

Conflicts are resolved.

@skuhl
Copy link
Contributor Author

skuhl commented Jan 2, 2021

I just realized that we should print a special message for when the server process returns 255. In many cases, this means that the user needs to exclude the machine that they are ssh'ing into (issue #191, and numerous other duplicate issues). I'll make another commit add that message soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants