Message from 2021
This post is pretty old! Opinions and technical information in it are almost certainly oudated. Commands and configurations will probably not work. Consider the age of the content before putting any of it into practice.
I just got a warning from Linode that the MongoDB instance on Fix This Code was world-usable.
To fix this in sixty seconds or less, use the “ufw” firewall package.
> sudo aptitude install ufw The following NEW packages will be installed: ufw 0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 143kB of archives. After unpacking 823kB will be used. Get:1 http://us.archive.ubuntu.com/ubuntu/ maverick/main ufw all 0.30.0-1ubuntu2 [143kB] Fetched 143kB in 0s (148kB/s) Preconfiguring packages ... Selecting previously deselected package ufw. (Reading database ... 38857 files and directories currently installed.) Unpacking ufw (from .../ufw_0.30.0-1ubuntu2_all.deb) ... Processing triggers for man-db ... Processing triggers for ureadahead ... Setting up ufw (0.30.0-1ubuntu2) ... Creating config file /etc/ufw/before.rules with new version Creating config file /etc/ufw/before6.rules with new version Creating config file /etc/ufw/after.rules with new version Creating config file /etc/ufw/after6.rules with new version Processing triggers for python-central ... > sudo ufw allow ssh Rules updated > sudo ufw allow http Rules updated > sudo ufw enable Command may disrupt existing ssh connections. Proceed with operation (y|n)? y Firewall is active and enabled on system startup