Now let's get down to the firewall rules. Create the
/etc/firewall/directory and start editing the ipfw.rules file (or whatever you added to
rc./conf) - example.
That's all. Now reboot your machine. In order to check if the firewall was loaded type:
You should see the firewall rules you just made. Now your firewall is up and running protecting you from the outside world. If you want to disable your firewall do:
ipfw -f flush
The great thing about ipfw is that you can add commands on the way. All you have to do is type:
ipfw add Rule_Number Rule
The Rule_Number is important because ipfw interprets the commands in the order you specify them. For more advanced ipfw rules read the man.
Testing your security
OK, now you have a pretty secure workstation that you can safely connect to the internet. But how can you know that for sure ? Test it.
Testing the firewall
For this operation you'll probably need a friend's help (because your firewall was configured to allow localhost connections. Of course you could add something like:
ipfw del 120
ipfw del 130
ipfw del 140
Or whatever the numbers of the rules that allow localhost connections are. Either way you have to find a way to be "outside" the firewall.
Now, ask a friend, or by yourself do a nmap scan (you can install it in freeBSD from
/usr/ports/security/nmap). The command should be something like:
nmap -v -O -sS your.host.com
If everything is right you should only see the ports you enabled (21 and maybe 80). To check your ftp and httpd security the best way is to look up their version number in a security database like bugtraq, security-focus, packetstormsecurity, etc.