iptables to harden server

Recently, I got iptables settings that seem to harden server.

 

This comes from a newly-provisioned vps. The iptables block all ports of the server except the ssh port(22). If you change the ssh port from the default 22 to another port, you will not be able to login your server. This is accomplished by the rule in the IN_public_allow chain. You can unblock other ports by adding more rules in the IN_public_allow chain such as:

iptables -A IN_public_allow -p tcp –dport 80 -j ACCEPT

iptables -A IN_public_allow -p tcp –dport 443 -j ACCEPT

iptables -A IN_public_allow -p tcp –dport 1723 -j ACCEPT

iptables -A IN_public_allow -p gre -j ACCEPT

 

 

 

Posted in tips of hosting