* state ESTABLISHED, RELATED @ 2009-07-15 20:25 Andrew Kolt 2009-07-16 6:42 ` Simion Onea 2009-07-16 8:32 ` Andrew Kolt 0 siblings, 2 replies; 5+ messages in thread From: Andrew Kolt @ 2009-07-15 20:25 UTC (permalink / raw) To: netfilter Hello everybody. I lately found my kernel logfile to be flooded with connections that seemed to have no meaning. They did until a couple of days ago when, while running nmap on a computer on my network, i 'tailed' the logfile and discovered they were replies from the target computer to my request. As a temp solution i added the following to the INPUT chain, in order to let those replies in: -A INPUT -i eth0 -p tcp -s 0/0 -d zzz.zzz.zzz.zzz -m state --state ESTABLISHED,RELATED -j ACCEPT Everything works well now, but i'd like to know if there's any other way to go about this and if the line above is "good" practice as far as security goes. with regards, Andrew ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: state ESTABLISHED, RELATED 2009-07-15 20:25 state ESTABLISHED, RELATED Andrew Kolt @ 2009-07-16 6:42 ` Simion Onea 2009-07-16 8:21 ` Richard Horton 2009-07-16 8:32 ` Andrew Kolt 1 sibling, 1 reply; 5+ messages in thread From: Simion Onea @ 2009-07-16 6:42 UTC (permalink / raw) To: Andrew Kolt; +Cc: netfilter On Wed, 2009-07-15 at 23:25 +0300, Andrew Kolt wrote: > As a temp solution i added the following to the INPUT chain, in order to > let those replies in: > > -A INPUT -i eth0 -p tcp -s 0/0 -d zzz.zzz.zzz.zzz -m state --state > ESTABLISHED,RELATED -j ACCEPT > > Everything works well now, but i'd like to know if there's any other way > to go about this and if the line above is "good" practice as far > as security goes. Hi Andrew! In my opinion it is good practice. We have been using such a rule for some time. In our set of iptables rules we have these in the beginning: #------------------------------------------------------------------ # Drop invalid packets, unrelated to any connection iptables -t filter -A INPUT -m state --state INVALID -j DROP # Block and log several types of network scans that use malformed packets # FIN / URG / PSH iptables -t filter -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -m limit --limit 5/minute \ -j LOG --log-level notice --log-prefix "NMAP-XMAS:" iptables -t filter -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP # SYN / RST iptables -t filter -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -m limit --limit 5/minute \ -j LOG --log-level notice --log-prefix "SYN/RST:" iptables -t filter -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP # SYN / FIN -- scan (probably) iptables -t filter -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -m limit --limit 5/minute \ -j LOG --log-level notice --log-prefix "SYN/FIN:" iptables -t filter -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP # Accept packets related to previously established connections iptables -t filter -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # Accept locally generated packets unconditionally iptables -t filter -A INPUT -i lo -j ACCEPT #------------------------------------------------------------------ The same rules can also be applied to FORWARD chain. Regards, Simion. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: state ESTABLISHED, RELATED 2009-07-16 6:42 ` Simion Onea @ 2009-07-16 8:21 ` Richard Horton 2009-07-16 8:54 ` Simion Onea 0 siblings, 1 reply; 5+ messages in thread From: Richard Horton @ 2009-07-16 8:21 UTC (permalink / raw) To: netfilter 2009/7/16 Simion Onea <simionea@gmail.com>:! > > In my opinion it is good practice. We have been using such a rule for > some time. In our set of iptables rules we have these in the beginning: > > #------ .... snip long set of rules... > The same rules can also be applied to FORWARD chain. > As a thought could you add those to a custom tables, say for the sake of example shared: iptables -N shared iptables -A shared <whatever> then in the input chain and forward chains make the first rule a jump to shared. This makes it easier to manage the 'common' rule set as you only need to change it at a single point rather than having to remember to change both occurances... -- Richard Horton Users are like a virus: Each causing a thousand tiny crises until the host finally dies. http://www.solstans.co.uk - Solstans Japanese Bobtails and Norwegian Forest Cats http://www.pbase.com/arimus - My online photogallery ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: state ESTABLISHED, RELATED 2009-07-16 8:21 ` Richard Horton @ 2009-07-16 8:54 ` Simion Onea 0 siblings, 0 replies; 5+ messages in thread From: Simion Onea @ 2009-07-16 8:54 UTC (permalink / raw) To: Richard Horton; +Cc: netfilter On Thu, 2009-07-16 at 09:21 +0100, Richard Horton wrote: > As a thought could you add those to a custom tables, say for the sake > of example shared: > > iptables -N shared > iptables -A shared <whatever> > > then in the input chain and forward chains make the first rule a jump to shared. > > This makes it easier to manage the 'common' rule set as you only need > to change it at a single point rather than having to remember to > change both occurances... Yes, I agree. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: state ESTABLISHED, RELATED 2009-07-15 20:25 state ESTABLISHED, RELATED Andrew Kolt 2009-07-16 6:42 ` Simion Onea @ 2009-07-16 8:32 ` Andrew Kolt 1 sibling, 0 replies; 5+ messages in thread From: Andrew Kolt @ 2009-07-16 8:32 UTC (permalink / raw) To: netfilter thanks for the replies. i will leave it on and further refine my rules. ps. custom tables is the way to go, spares me and my colleague a lot of headache regards, Andrew Kolt ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-16 8:54 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-07-15 20:25 state ESTABLISHED, RELATED Andrew Kolt 2009-07-16 6:42 ` Simion Onea 2009-07-16 8:21 ` Richard Horton 2009-07-16 8:54 ` Simion Onea 2009-07-16 8:32 ` Andrew Kolt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox