Simple and secure iptables configuration for webserver
While I was enabling a management console for a queue I was implementing (rabbitmq) I found out that on my clean ubuntu 12.01 box there is no default firewall whatsoever. After fiddling a bit with the iptables command and following this guide the server was locked down tight.
Please note the incoming RELATED,ESTABLISHED line, which is necessary if you want to be able to create outgoing connections from the server. Without these lines, all your CURLs and pings sent from the server will fail (as did mine before I added those lines).
If you want to load these tables by default, run the command sudo sh -c "iptables-save > /etc/iptables.rules" to save the configuration to the default iptables configuration.