iptables -A INPUT -i lo -m comment --comment "allow traffic on loopback interface" -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -m comment --comment "allow connections that are already established or related" -j ACCEPT
iptables -A INPUT -p icmp -m comment --comment "allow ping" -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -m comment --comment "allow ssh" -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -m comment --comment "allow http" -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -m comment --comment "allow https" -j ACCEPT
iptables -P -m comment --comment "drop the rest of the incoming traffic" INPUT DROP
iptables -P -m comment --comment "drop the forwarding traffic" FORWARD DROP