xref: /onnv-gate/usr/src/cmd/ipf/examples/firewall (revision 0:68f95e015346)
1*0Sstevel@tonic-gateConfiguring IP Filter for firewall usage.
2*0Sstevel@tonic-gate=========================================
3*0Sstevel@tonic-gate
4*0Sstevel@tonic-gateStep 1 - Block out "bad" IP packets.
5*0Sstevel@tonic-gate------------------------------------
6*0Sstevel@tonic-gate
7*0Sstevel@tonic-gateRun the perl script "mkfilters".  This will generate a list of blocking
8*0Sstevel@tonic-gaterules which:
9*0Sstevel@tonic-gate	a) blocks all packets which might belong to an IP Spoofing attack;
10*0Sstevel@tonic-gate	b) blocks all packets with IP options;
11*0Sstevel@tonic-gate	c) blocks all packets which have a length which is too short for
12*0Sstevel@tonic-gate	   any legal packet;
13*0Sstevel@tonic-gate
14*0Sstevel@tonic-gateStep 2 - Convert Network Security Policy to filter rules.
15*0Sstevel@tonic-gate---------------------------------------------------------
16*0Sstevel@tonic-gate
17*0Sstevel@tonic-gateDraw up a list of which services you want to allow users to use on the
18*0Sstevel@tonic-gateInternet (e.g. WWW, ftp, etc).  Draw up a separate list for what you
19*0Sstevel@tonic-gatewant each host that is part of your firewall to be allowed to do, including
20*0Sstevel@tonic-gatecommunication with internal hosts.
21*0Sstevel@tonic-gate
22*0Sstevel@tonic-gateStep 3 - Create TCP "keep state" rules.
23*0Sstevel@tonic-gate---------------------------------------
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gateFor each service that uses TCP, create a rule as follows:
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gatepass in on <int-a> proto tcp from <int-net> to any port <ext-service> flags S/SA keep state
28*0Sstevel@tonic-gate
29*0Sstevel@tonic-gatewhere
30*0Sstevel@tonic-gate* "int-a" is the internal interface of the firewall.  That is, it is the
31*0Sstevel@tonic-gate  closest to your internal network in terms of network hops.
32*0Sstevel@tonic-gate
33*0Sstevel@tonic-gate* "int-net" is the internal network IP# subnet address range.  This might
34*0Sstevel@tonic-gate   be something like 10.1.0.0/16, or 128.33.1.0/24
35*0Sstevel@tonic-gate
36*0Sstevel@tonic-gate* "ext-service" is the service to which you wish to connect or if it doesn't
37*0Sstevel@tonic-gate  have a proper name, a number can be used.  The translation of "ext-service"
38*0Sstevel@tonic-gate  as a name to a number is controlled with the /etc/services file.
39*0Sstevel@tonic-gate
40