I play around with the rules for my web server, but it doesn´t work as i want. The ports seems to be reachable, but a connection won´t happen, here´s the script:
#!/bin/bash
# Drop all Incoming
iptables -A INPUT -j DROP
# Allow all Outgoing
iptables -A OUTPUT -d 0.0.0.0/0 -j ACCEPT
# Allow Incoming for special IPs to all Ports
iptables -A INPUT -s 1.2.3.4/32 -j ACCEPT
iptables -A INPUT -s 2.3.4.5/32 -j ACCEPT
iptables -A INPUT -s 3.4.5.6/32 -j ACCEPT
# Allow Incoming from Internet to Ports
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
# Allow established connections
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow localhost
iptables -A INPUT -i lo -j ACCEPT