Re:Securing a Linux Server
by ruttiger on Saturday September 14, 2013 @02:28AM
(#6384875)
I made the mistake of accidentally setting the firewall too strict on a remote server, killing my ability to SSH. A neat little trick I found was to setup a scheduled task to kill the firewall in 5 minutes, and then restart it. If it's too restrictive and locks you out, wait 5 minutes. If you did it right, then kill the scheduled task.
[ Parent
| on HN ]
You can just use iptables-apply. It achieves the same thing and is built-in. If you don't confirm the changes after they are applied, because you locked yourself out, they will be rolled back.
This is in the article FWIW.
APF, which is basically just a simplified way of setting up IPTables rules, does this.
http://www.rfxn.com/projects/advanced-policy-firewall/
or
apt-get install apf-firewall