-
Notifications
You must be signed in to change notification settings - Fork 716
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
Restore tty I/O attributes when daemonizing #922
Conversation
Fixes sshuttle#909, ie. when sudo has the option use_pty enabled, running sshuttle --daemon would previously leave the terminal in a weird state.
I don't fully understand why the To replicate the issue, run with Before running the program:
Without this commit:
With this commit:
|
I took your code here and did some hunting to pinpoint when the terminal settings were getting garbled. It seems to be related to the socketpair that the firewall and client process use to communicate. I think I found an alternative fix that changes very few lines of code, avoids the garbled terminal in the first place, and fixes something that bothered me in the original fix for the use_pty change: That we had to use \r\n instead of \n at the end of messages to prevent verbose messages from being garbled (even when not in daemon mode). I'll try to post it a bit later today. |
This fixes sshuttle#909 and is an alternative to the sshuttle#922 pull request. When sudo's use_pty is used with sshuttle, it causes issues with the terminal. Pull request sshuttle#712 contains some fixes for this problem. However, when sshuttle is run with the --daemon option, it left the user's terminal in a non-sane state. The problem appears to be related to a socketpair that the firewall uses for communication. By setting it up slightly differently (see changes to client.py and firewall.py), the terminal state is no longer disrupted. This commit also changes line endings of the printed messages from \r\n to \n. This undoes a change introduced by pull request sshuttle#712 and is no longer needed.
This is obsoleted by #923, which fixes the same issue by removing the root cause. |
This fixes #909 and is an alternative to the #922 pull request. When sudo's use_pty is used with sshuttle, it causes issues with the terminal. Pull request #712 contains some fixes for this problem. However, when sshuttle is run with the --daemon option, it left the user's terminal in a non-sane state. The problem appears to be related to a socketpair that the firewall uses for communication. By setting it up slightly differently (see changes to client.py and firewall.py), the terminal state is no longer disrupted. This commit also changes line endings of the printed messages from \r\n to \n. This undoes a change introduced by pull request #712 and is no longer needed.
Fixes #909, ie. when sudo has the option use_pty enabled, running sshuttle --daemon would previously leave the terminal in a weird state.