Rate my rules. Take a look ICMP only
Recently I created what I think are some pretty decent ICMP rules to allow me to trace and ping outside of my network but not allow the same kind of activities in...I think I did a pretty good job after reading the tutorial
You guys be the judge and let me know if there was better way for this to be done.
iptables -A INPUT -p ICMP -i eth0 -m state --state NEW -j DROP iptables -A INPUT -p ICMP -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p ICMP -o eth0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
=====
"No touchy NO TOUCHY! Emperor Kuzko -=Emperor's New Groove=-"
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
Quoted 5 lines · SBlaze
Recently I created what I think are some pretty decent ICMP rules to allow me to trace and ping outside of my network but not allow the same kind of activities in...I think I did a pretty good job after reading the tutorial
Quoted 8 lines
You guys be the judge and let me know if there was better way for this to be done.
iptables -A INPUT -p ICMP -i eth0 -m state --state NEW -j DROP iptables -A INPUT -p ICMP -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p ICMP -o eth0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
If you have DROP policy for INPUT you don't need the first rule, and the third should work just as well without any state matching at all. (The only additional state allowed through that ways is 'INVALID' which you should explicitly DROP if you are concerned about it)
Regardless, you seem to have grasped how the state matches work, and how to use them to allow only desired connections. These rules WILL impose the limitations you desire, so that rates as a success.
j
Quoted 20 lines · --- Joel Newkirk
Quoted 5 lines · SBlaze
Recently I created what I think are some pretty decent ICMP rules to allow me to trace and ping outside of my network but not allow the same kind of activities in...I think I did a pretty good job after reading the tutorial
Quoted 8 lines
You guys be the judge and let me know if there was better way for this to be done.
iptables -A INPUT -p ICMP -i eth0 -m state --state NEW -j DROP iptables -A INPUT -p ICMP -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p ICMP -o eth0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPTIf you have DROP policy for INPUT you don't need the first rule, and the third should work just as well without any state matching at all. (The only additional state allowed through that ways is 'INVALID' which you should explicitly DROP if you are concerned about it)
Quoted 6 lines
Regardless, you seem to have grasped how the state matches work, and how to use them to allow only desired connections. These rules WILL impose the limitations you desire, so that rates as a success.
j
I thought of creating a rule that will drop invalid requests.... but I somewhat worry about the "logability" of a single rule that would handle so much. If something is invalid I would like to somewhat isolate as much information about it as possible.
These rules do that for me...
# NMAP and Incoming connection Killer(SYN/RST)
# NMAP Xmas Tree scan Killer ( God bless Google )
# NMAP Null scan killer (got from a IPTABLES tutorial..confirmed via the web) # NMAP Stealth FIN scan killer (this one was a hard one to figure out)
iptables -A INPUT -p tcp --syn -m state --state NEW -i eth0 -j DROP iptables -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -i eth0 -j DROP iptables -A INPUT -p tcp --tcp-flags ALL NONE -i eth0 -j DROP iptables -A INPUT -p tcp ! --syn -m state --state NEW -i eth0 -j DROP
The SYN/RST also stops all incoming connecctions that are not already related or established.
I also have limited logs for these rules. If say I just set up an ALL protocol INVALID drop line.... could I just comment out the above rules and have the INVALID drop the scans... and the others still log? Is there anything that slips through the INVALID targets these might catch? I guess I worry about can one line stop ALL the baddies coming in so to speak.. especially since i have grown to trust the above rules.
Thanks to all out there reading and posting up
=====
"No touchy NO TOUCHY! Emperor Kuzko -=Emperor's New Groove=-"
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
Quoted 22 lines · SBlaze
I thought of creating a rule that will drop invalid requests.... but I somewhat worry about the "logability" of a single rule that would handle so much. If something is invalid I would like to somewhat isolate as much information about it as possible.
These rules do that for me...
# NMAP and Incoming connection Killer(SYN/RST)
# NMAP Xmas Tree scan Killer ( God bless Google )
# NMAP Null scan killer (got from a IPTABLES tutorial..confirmed via the web)
# NMAP Stealth FIN scan killer (this one was a hard one to figure out)iptables -A INPUT -p tcp --syn -m state --state NEW -i eth0 -j DROP iptables -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -i eth0 -j DROP iptables -A INPUT -p tcp --tcp-flags ALL NONE -i eth0 -j DROP iptables -A INPUT -p tcp ! --syn -m state --state NEW -i eth0 -j DROP
The SYN/RST also stops all incoming connecctions that are not already related or established.
Quoted 7 lines
I also have limited logs for these rules. If say I just set up an ALL protocol INVALID drop line.... could I just comment out the above rules and have the INVALID drop the scans... and the others still log? Is there anything that slips through the INVALID targets these might catch? I guess I worry about can one line stop ALL the baddies coming in so to speak.. especially since i have grown to trust the above rules.
INVALID state, clipping shamelessly from Oskar's tutorial:
<OSKAR>The INVALID state means that the packet can not be identified or that it does not have any state. This may be due to several reasons, such as the system running out of memory or ICMP error messages that do not respond to any known connections. Generally, it is a good idea to DROP everything in this state.</OSKAR>
Most of what you have rules for there would NOT qualify as INVALID for packet state.
j