1 |
On 12/16/11 22:17, Tanstaafl wrote: |
2 |
> Hi all, |
3 |
> |
4 |
> I was reading up on some iptables rules in the gentoo security handbook: |
5 |
> |
6 |
> http://www.gentoo.org/doc/en/security/security-handbook.xml?part=1&chap=12&style=printable |
7 |
> |
8 |
> |
9 |
> It mentions DROPing packets with an INVALID state. |
10 |
> |
11 |
> It sounded/sounds like a good idea, so I added the following rule: |
12 |
> |
13 |
> -A INPUT -i eth0 -m state --state INVALID -j LOG |
14 |
> |
15 |
> As suggested, I addd this rule just ABOVE this one: |
16 |
> |
17 |
> -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT |
18 |
> |
19 |
> I also changed the DROP action to LOG so I could see what it did if |
20 |
> anything. |
21 |
> |
22 |
> Right after adding this rule, I started seeing lines like this in the |
23 |
> log: |
24 |
> |
25 |
> Dec 16 10:15:31 myhost kernel: IN=eth0 OUT= |
26 |
> MAC=00:e0:81:54:9c:8a:00:90:7f:86:a8:c0:08:00 SRC=208.87.137.233 |
27 |
> DST=192.168.1.252 LEN=40 TOS=0x00 PREC=0x00 TTL=52 ID=0 DF PROTO=TCP |
28 |
> SPT=50113 DPT=25 WINDOW=0 RES=0x00 RST URGP=0 |
29 |
> |
30 |
> What I don't understand is why it isn't using my LOG prefix that is |
31 |
> used for everything else: |
32 |
> |
33 |
> -A INPUT -j LOG --log-prefix "(>fw-drop): " --log-level 7 |
34 |
> |
35 |
> Anyone? |
36 |
> |
37 |
Did you put the log-prefix rule before or after the LOG rule? |
38 |
Or why didn't you put it in a 1liner, say: |
39 |
|
40 |
-A INPUT -i eth0 -m state --state INVALID -j LOG --log-level 7 |
41 |
--log-prefix "(>fw-drop): " --log-ip-options --log-tcp-options |
42 |
|
43 |
|
44 |
-- |
45 |
Regards, |