*filter :INPUT DROP [0:0] :FORWARD DROP [0:0] :OUTPUT ACCEPT [0:0] # otherwise self-referential connections to local host will fail -A INPUT -i lo -j ACCEPT # tolerate any inbound connections requested by our server, no matter the port -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT # this enables ping etc. -A INPUT -p icmp -j ACCEPT # SSH -A INPUT -p tcp --dport 22 -j ACCEPT # HTTPS in theory, in practice my second SSH port, see sshd_config -A INPUT -p tcp --dport 443 -j ACCEPT COMMIT # this last line is here because iptables-restore ignores the final command if no newline follows it