global security disclosure

firewall_bsd.txt

firewall_bsd.txt
Posted Nov 14, 1999
Authored by Larry W. Cashdollar | Site vapid.dhs.org

How to build a BSD firewall using ipfilter. Covers everything from kernel config to allowing traffic.

tags | paper, kernel
systems | bsd
MD5 | 8db290dcfa35c0e52d7b2abaa54ab4e9

firewall_bsd.txt

Change Mirror Download
Larry W. Cashdollar
11/12/99 Rev 1.0
Setting up a FreeBSD firewall
using ipfw.



1) You will need to add some options to your kernel config in order to
proceed. If you have never rebuilt your kernel please refer to the
FreeBSD documentation at www.freebsd.org for more information.

2) Add the following options to your kernel config file
options IPFIREWALL #firewall
options IPFIREWALL_VERBOSE #print information about
options IPFILTER #kernel ipfilter support
options IPFILTER_LOG #ipfilter logging

#options IPFIREWALL_DEFAULT_TO_ACCEPT #allow everything by default

If you want your firewall to be open by default add this option as well.
The default behavor of the firewall is to not allow any connections at all
until you specify otherwise. This option will change that to allow all ip
traffic unless stated otherwise.

The LINT document contains more information on all of these options.
After you have made these modifications to your config file run the config
package to move all the kernel src into place.

3) Configure your kernel.

# cd /usr/src/sys/i386/conf; config YOUR_CONFIG_HERE
# cd ../../compile/YOUR_CONFIG_HERE
# make depend; make

4) Installing the kernel

If all goes well do a make install and then reboot.


5) Using ipfw to create ACLs (access control lists) for your host.

You need to be root.

See ipfw man pages for a detailed description.
Basically its like this:
ipfw action number [allow|deny] [all|tcp|udp|ip] from where to where via what

Allow the local machine talk to itself with these following rules.

/sbin/ipfw add 100 pass all from any to any via lo0
/sbin/ipfw add 200 deny all from any to 127.0.0.0/8

Allow the local machine to talk to any one via ethernet interface
/sbin/ipfw add 300 allow all from YOUR_IP_HERE to any


Allow normal established connections.
/sbin/ipfw add 350 allow tcp from any to any established

Lets say your running a webserver and mail host, you need port 80 and 25
to be accessed by all other hosts. Do the following:

/sbin/ipfw add 400 allow tcp from any to any 80
/sbin/ipfw add 500 allow tcp from any to any 25

Allow udp data be to sent from the nameserver for DNS to function.

/sbin/ipfw add 600 allow udp from YOUR_DNS_HERE 53 to YOUR_IP_HERE

This may not be enough for later versions of BIND as it will utilize TCP
as well as UDP for DNS queries. We will cross that bridge when we come to
it.

Want to allow all ICMP execpt for pings? (ECHO requests) this is the rule:
/sbin/ipfw add 700 deny icmp from any to YOUR_IP_HERE icmptypes 8
/sbin/ipfw add 800 allow icmp from any to any

I added this rule to my lists as well, this rule is the same as the
default rule 65535 to deny all; however, it will log it to the syslogd
daemon, so you can see just what packets have been bounced from your host.

/sbin/ipfw add 10000 deny log ip from any to any

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

May 2012

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    37 Files
  • 2
    May 2nd
    53 Files
  • 3
    May 3rd
    33 Files
  • 4
    May 4th
    4 Files
  • 5
    May 5th
    10 Files
  • 6
    May 6th
    17 Files
  • 7
    May 7th
    19 Files
  • 8
    May 8th
    36 Files
  • 9
    May 9th
    34 Files
  • 10
    May 10th
    35 Files
  • 11
    May 11th
    20 Files
  • 12
    May 12th
    18 Files
  • 13
    May 13th
    11 Files
  • 14
    May 14th
    27 Files
  • 15
    May 15th
    58 Files
  • 16
    May 16th
    54 Files
  • 17
    May 17th
    25 Files
  • 18
    May 18th
    53 Files
  • 19
    May 19th
    9 Files
  • 20
    May 20th
    15 Files
  • 21
    May 21st
    25 Files
  • 22
    May 22nd
    32 Files
  • 23
    May 23rd
    35 Files
  • 24
    May 24th
    26 Files
  • 25
    May 25th
    25 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2012 Packet Storm. All rights reserved.

close