A simple iptables firewall that blocks incoming connections.
Drop firewall
in /etc/init.d
and configure it to start automatically. Instructions will vary depending on your distribution, but the script includes headers for chkconfig
and LSB Init Scripts. A firewall.service
unit file is provided for use with systemd.
To allow ICMP traffic (ping, traceroute, etc), uncomment line 32:
#iptables -A INPUT -p icmp -j ACCEPT
To allow SSH traffic, uncomment line 35:
#iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT
This script is distributed under the MIT license.