Hello,
At which location (in which chain) should I insert the -p all -j QUEUE in iptables?
[Edit 18/10/05 if you lack time:
Answer seems to be in only one place. You might be best looking
a the bash code in post #6]
I want snort to inspect and drop suspicious packet "from" the firewall.
Help will be appreciated and I hope this thread will be educational
to any paranoid newbie out there.
I am running snort -Qdev -c /etc/snort.conf -h 192.68.0.1/24
(that is as snort-inline as Intrusion Prevention System). Shorewall version is recent, I think 2.4.x.
ip_queue is loaded. I have compiled snort with the inline option. Using community rules.
Now then, I have read quite a bit about iptables, and I understand roughly what
is going one when the chain are traversed (walked through).
I heard there is a QUEUE policy available for shorewall, but that is beyond
what I understand; I would like just to insert the QUEUE with an iptables command for now.
Question 1: Shall I insert QUEUE in the INPUT or OUTPUT section?
Is this insertion back into the stream, after user space (snort) automatic?
I have read that
<<QUEUE rules cause the connection request to be passed to user-space
-- the user-space application can later insert them back
into the stream for further processing by following rules.
at the output stage>>
In that case to decrease the overhead, inserting queue in the OUTPUT make sense. Is this correct?
I then decided to insert queue as the first item in the OUTPUT chain by doing this
iptables -I OUTPUT 1 -p all -j QUEUE
(I want all protocols to go to snort) An extract from iptables-save is below
This is working to some extent (web access still working, and a
local snort rule I setup to alert me that the pc is doing
a dns query on
www.mandrake.com allowed me to check snort was working).
Question 2: Would it not make sense to insert the queue just before
-A OUTPUT -j Reject
Question 3: How do I test that the rest of the chains are still traversed?
Any other solution than inserting log requests in the iptables?
Question 4: How do I then test that snort (inline) is dropping packets when needed?
I heard of snot,
http://www.sec33.com/sniph/. but it looks a commercial thing.
Code:
Extract from iptables-save (queue inserted at position 1 in OUTPUT)
-A INPUT -i lo -j ACCEPT
-A INPUT -p ! icmp -m state --state INVALID -j DROP
-A INPUT -i eth0 -j eth0_in
-A INPUT -j Reject
-A INPUT -j LOG --log-prefix "Shorewall:INPUT:REJECT:" --log-level 6
-A INPUT -j reject
-A FORWARD -p ! icmp -m state --state INVALID -j DROP
-A FORWARD -i eth0 -j eth0_fwd
-A FORWARD -j Reject
-A FORWARD -j LOG --log-prefix "Shorewall:FORWARD:REJECT:" --log-level 6
-A FORWARD -j reject
-A OUTPUT -j QUEUE
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -p ! icmp -m state --state INVALID -j DROP
-A OUTPUT -o eth0 -p udp -m udp --dport 67:68 -j ACCEPT
-A OUTPUT -o eth0 -j fw2net
-A OUTPUT -j Reject
-A OUTPUT -j LOG --log-prefix "Shorewall:OUTPUT:REJECT:" --log-level 6
-A OUTPUT -j reject
-A Drop -j RejectAuth
-A Drop -j dropBcast
-A Drop -j dropInvalid
...... many more lines not included
Thanks if you read all that :-) regards