Firewall

| | Comments (0) | TrackBacks (0)

Een goede server beveiliging begint onder andere met een firewall. Omdat de server FreeBSD draait kan je kiezen uit drie firewalls. Ik heb gekozen voor ipfw omdat deze de meeste mogelijkheden heeft. De installatie van ipfw bestaat uit drie onderdelen:
a. Compileren van de kernel
b. Maken van ipfw.rules
c. Het aanpassen van rc.conf en het opstarten van de firewall

Compileren van de kernel
Voeg aan de kernel configuratie de volgende opties toe:
options IPFIREWALL 
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=1000
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPDIVERT
options DUMMYNET
options HZ=1000
compileer de kernel op de gebruikelijke wijze en reboot de server

Het maken van ipfw.rules
Onderstaande rules beschermen de server
Maak deze file aan /usr/local/etc/ipfw.rules

IPF="ipfw -q add"
ipfw -q -f flush

#loopback
$IPF 1000 pass all from any to any via lo0
$IPF 1100 deny all from any to 127.0.0.0/8
$IPF 1200 deny all from 127.0.0.0/8 to any

# allow save stuff
$IPF 3000 pass tcp from any to any established
$IPF 3100 pass all from any to any frag

# icmp
$IPF 3500 pass icmp from any to any icmptypes 0,3,8,11
$IPF 3600 deny icmp from any to any

# udp
$IPF 4000 pass udp from any to any 53,123 in via em0
$IPF 4100 pass udp from any 53,123,1024-65535 to any 53,123,1024-65535 in via em0
$IPF 4200 pass udp from any to any out

# tcp
$IPF 5000 pass tcp from any to me 20,21,22,25,53,80,110,119,143,443,587,873,8000
$IPF 5100 pass tcp from any to any out

# deny and log everything
$IPF 50000 deny log all from any to any

Pas rc.conf aan
Voeg de volgende regels toe aan /etc/rc.conf
firewall_enable="YES"
firewall_script="/usr/local/etc/ipfw.rules"
firewall_logging="YES"

Restart de firewall met
/etc/rc.d/ipfw restart

Succes en garantie tot de deur :-)

0 TrackBacks

Listed below are links to blogs that reference this entry: Firewall.

TrackBack URL for this entry: http://blog.jarasoft.org/cgi-bin/mt/mt-tb.cgi/2

Leave a comment

About this Entry

This page contains a single entry by Jack Raats published on 23 juli 2008 20:04.

Nieuwe server was the previous entry in this blog.

Geblokkeerde poorten is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.