MCPcopy Index your code
hub / github.com/sshuttle/sshuttle / firewall_exit

Function firewall_exit

sshuttle/firewall.py:77–95  ·  view source on GitHub ↗
(signum, frame)

Source from the content-addressed store, hash-verified

75
76
77def firewall_exit(signum, frame):
78 # The typical sshuttle exit is that the main sshuttle process
79 # exits, closes file descriptors it uses, and the firewall process
80 # notices that it can't read from stdin anymore and exits
81 # (cleaning up firewall rules).
82 #
83 # However, in some cases, Ctrl+C might get sent to the firewall
84 # process. This might caused if someone manually tries to kill the
85 # firewall process, or if sshuttle was started using sudo's use_pty option
86 # and they try to exit by pressing Ctrl+C. Here, we forward the
87 # Ctrl+C/SIGINT to the main sshuttle process which should trigger
88 # the typical exit process as described above.
89 if sshuttle_pid:
90 debug1("Relaying interupt signal to sshuttle process %d" % sshuttle_pid)
91 if sys.platform == 'win32':
92 sig = signal.CTRL_C_EVENT
93 else:
94 sig = signal.SIGINT
95 os.kill(sshuttle_pid, sig)
96
97
98def _setup_daemon_for_unix_like():

Callers

nothing calls this directly

Calls 1

debug1Function · 0.90

Tested by

no test coverage detected