I would like to configure my VPS in the way that it ONLY accepts connections from outside on port 22 (where sshd listens) and ICMP requests. Everything else from outside should be rejected. Inside the server, everything should be allowed. Do the following rules create the desired behaviour?
# iptables -A INPUT -p all -s 127.0.0.1 -j ACCEPT # iptables -A INPUT -p tcp --dport 22 -j ACCEPT # iptabels -A INPUT -p icmp -j ACCEPT # iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # iptables -A INPUT -p all -j REJECT
I am not completely sure if ACCEPT rules will "win" over the last overall REJECT