From cce6a9d96db197dda76a194cd7a6420e6fcb08d2 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Fri, 6 Jul 2012 14:51:46 -0400 Subject: [PATCH] firewall.py: catch SIGINT and SIGTERM too. There were still a few conditions under some OSes that would cause firewall.py to terminate without cleaning up the firewall settings. 'pkill sshuttle' was one of them. Ignore a couple more signals to further ensure a correct cleanup. (This only affects sshuttle --firewall, which is a subprocess of the main sshuttle process. The firewall is supposed to exit automatically whenever the client exits, and so far that part seems to work reliably.) --- firewall.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/firewall.py b/firewall.py index 452715e..53d866e 100644 --- a/firewall.py +++ b/firewall.py @@ -471,6 +471,8 @@ def main(port, dnsport, syslog): # disappears; we still have to clean up. signal.signal(signal.SIGHUP, signal.SIG_IGN) signal.signal(signal.SIGPIPE, signal.SIG_IGN) + signal.signal(signal.SIGTERM, signal.SIG_IGN) + signal.signal(signal.SIGINT, signal.SIG_IGN) # ctrl-c shouldn't be passed along to me. When the main sshuttle dies, # I'll die automatically.