Gentoo Archives: gentoo-user

From: "A. Khattri" <ajai@××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] iptables on gentoo
Date: Thu, 27 Oct 2005 21:52:07
Message-Id: Pine.BSO.4.58.0510271723000.21717@ida.bway.net
In Reply to: [gentoo-user] iptables on gentoo by James
1 On Thu, 27 Oct 2005, James wrote:
2
3 > Question 1:
4 > I'm planning on using nmap and nessus to test from the outside(internet)
5 > inward). On the inside I plan on using snort, an monitoring the various
6 > log files. Any further suggestions on testing?
7
8 Plain ole telnet works for testing protocols too ;-)
9
10 > /etc/init.d/firewall is the default file where where you put your rules you
11 > have written or grabbed elsewhere and modified to meet your specific needs.
12
13 Not sure where this script came from - it doesn't come with iptables.
14
15 > /var/lib/iptables/rules-save is the file that will save out from kernel memory
16 > the actual rulesets being used. This file is also reloaded as necessary. Avoid
17 > direct modifications to this.
18 >
19 > Is this explanation correct? Did I miss something or get something confused.
20 > I could not really find any documentation on this, so much was inference
21 > from various linux sites, some very old, and a few gentoo specific sites.
22
23 Not much to it. Make your rules and use "/etc/init.d/iptables save" to
24 save 'em. When you restart iptables it will automatically load them from
25 /var/lib/iptables/rules-save if it finds that file.
26
27 > Assuming this is correct, I have seen many command line options and
28 > differing recommendations on how to modify the rules and when to save
29 > them out and to what file. Any details one can provide, that are gentoo
30 > specific, are most welcome.
31
32 None of these are Gentoo specific (there aren't any Gentoo specifics in
33 iptables AFAIK).
34
35 Some notes:
36
37 I wrote all the rules out "by hand" and tested them. Any tweaks I did
38 directly on the command line. Bear in mind that the order of the rules is
39 pretty important (I use the --line-numbers option so you know what line
40 numbers to insert/delete after when changing the ordering of rules, i.e.
41 iptables -L -n --line-numbers).
42
43 Obviously you'll be doing this from the console directly.
44
45 I broke rules down into various groups that I separated out into chains.
46
47 So the first chain (called SCRUB) gets rid of obvious bogus packets (like
48 packets from 192.168.x.x etc etc). Another chain is called BANNED (for
49 obvious reasons). And so on.
50
51 When working with chains its easier to make the chain and rules first and
52 then "activate" them by adding a rule to the INPUT chain to send
53 all packets through it, e.g.
54
55 iptables -A INPUT -j SCRUB
56
57 Dont forget to set default policies for your chains.
58
59 Often its better to start with a completely locked down machine and add
60 rules for those ports you want to open.
61
62 Make use of of the state module if you can (it understands FTP, IRC and a
63 few other protocols) which makes it trivial to write state tracking rules.
64
65 If you iptables extensions are built as modules (not recommended - if one
66 fails to load you might compromise security) then make sure they are
67 loaded - some rules do NOT load the corresponding modules automatically so
68 beware.
69
70 If you need any help, post on this list.
71
72
73 --
74
75 --
76 gentoo-user@g.o mailing list

Replies

Subject Author
[gentoo-user] Re: iptables on gentoo James <wireless@×××××××××××.com>