Merge from vendor branch GDB:
[dragonfly.git] / contrib / ipfilter / README
1 IP Filter - What's this about ?
2 ============================
3
4   The idea behind this package is allow those who use Unix workstations as
5 routers (a common occurance in Universities it appears) to apply packet
6 filtering to packets going in and out of them.  This package has been
7 tested on all versions of SunOS 4.1 and Solaris 2.4/2.5, running on Sparcs.
8 It is also quite possible for this small kernel extension to be installed
9 and used effectively on Sun workstations which don't route IP, just for
10 added security.  It can also be integrated with the multicast patches.
11 It has also been tested successfully on all of the modern free BSDs as
12 well as BSDI, and SGI's IRIX 6.2.
13
14    The filter keeps a rule list for both inbound and outbound sides of
15 the IP packet queue and a check is made as early as possible, aiming to
16 stop the packet before it even gets as far as being checked for source
17 route options.  In the file "BNF", a set of rules for constructing filter
18 rules understood by this package is given.  The files in the directory
19 "rules", "example.1" ... "example.sr" show example rules you might apply.
20
21    In practise, I've successfully isolated a workstation from all
22 machines except the NFS file servers on its local subnets (yeah, ok, so
23 this doesn't really increase security, because of NFS, but you get the
24 drift on how it can be applied and used).  I've also successfully
25 setup and maintained my own firewalls using it with TIS's Firewall Toolkit,
26 including using it on an mbone router.
27
28    When using it with multicast IP, the calls to fr_check() should be
29 before the packet is unwrapped and after it is encapsulated.  So the
30 filter routines will see the packet as a UDP packet, protocol XYZ.
31 Whether this is better or worse than having it filter on class D addresses
32 is debateable, but the idea behind this package is to be able to
33 discriminate between packets as they are on the 'wire', before they
34 get routed anywhere, etc.
35
36    It is worth noting, that it is possible, using a small MTU and
37 generating tiny fragmented IP packets to generate a TCP packet which
38 doesn't contain enough information to filter on the "flags".  Filtering
39 on these types of packets is possible, but under the more general case
40 of the packets being "short".  ICMP and UDP packets which are too small
41 (they don't contain a complete header) are dropped and logged, no questions
42 asked.  When filtering on fragmented packets, the last fragment will get
43 through for TCP/UDP/ICMP packets.
44
45 Bugs/Problems
46 -------------
47 If you have a problem with IP Filter on your operating system, please email
48 a copy of the file "BugReport" with the details of your setup as required
49 and email to darrenr@pobox.com.
50
51 Some general notes.
52 -------------------
53    To add/delete a rule from memory, access to the device in /dev is needed,
54 allowing non-root maintenaince.  The filter list in kernel memory is built
55 from the kernel's heap.  Each packet coming *in* or *out* is checked against
56 the appropriate list, rejects dropped, others passed through.  Thus this will
57 work on an individual host, not just gateways.  Presently there is only one
58 list for all interfaces, the changes required to make it a per-interface list
59 require more .o replacements for the kernel.  When checking a packet, the
60 packet is compared to the entire list from top to bottom, the last matching
61 line being effective.
62
63
64 What does what ?
65 ----------------
66 if_fil.o  (Loadable kernel module)
67         - additional kernel routines to check an access list as to whether
68           or not to drop or pass a packet.  It currently defaults to pass
69           on all packets.
70
71 ipfstat
72         - digs through your kernel (need to check #define VMUNIX in fils.c)
73           and /dev/kmem for the access filter list and mini stats table.
74           Obviously needs to be run priviledged if required.
75
76 ipf
77         - reads the files passed as parameters as input files containing new
78           filter rules to add/delete to the kernel list.  The lines are
79           inserted in order; the first line is inserted first, and ends up
80           first on the list.  Subsequent invocations append to the list
81           unless specified otherwise.
82
83 ipftest
84         - test the ruleset given by filename.  Reads in the ruleset and then
85           waits for stdin.
86
87           See the man pages (ipf.1, ipftest.1, ipfstat.8) for more detailed
88           information on what the above do.
89
90 mkfilters
91         - suggests a set of filter rules to employ and suggests how to add
92           routes to back these up.
93
94 BNF
95         - BNF rule set for the filter rules
96
97 Darren Reed
98 darrenr@pobox.com