| Linode Forum https://forum.linode.com/ |
|
| [Solved] Iptables not blocking visitor? https://forum.linode.com/viewtopic.php?f=19&t=8842 |
Page 1 of 1 |
| Author: | Dweeber [ Tue May 15, 2012 4:25 pm ] |
| Post subject: | [Solved] Iptables not blocking visitor? |
I'm not used to IPTABLES much... So I am most likely missing something really basic here. I have added an IPTABLES entry for a src IP to dpt: 80, yet they are still hitting the site? BTW... I know I can block them via HTTP accept/deny rules, but I was using my tempban script which I used to block all network activity temporarily for all services, and was surprised when they still kept hitting. output from iptables: Code: DROP tcp -- 109.68.105.30 0.0.0.0/0 tcp dpt:80 in the apache logs, I see entries for that ip after the change like nothing happened. Code: [Tue May 15 10:02:47 2012] [error] [client 109.68.105.30] script '/www/vhosts/cumulus/bugyou.php' not found or unable to stat Not sure why this would still be. I originally just did a drop for that IP to everything like: output from iptables: Code: DROP all -- 109.68.105.30 0.0.0.0/0 However, it had the same non-affect which is where I started looking into the issue. The two rules i used were: for the drop all Code: iptables -A INPUT -s 109.68.105.30 -j DROP for the drop the specific port Code: iptables -A INPUT -i eth0 -p tcp -s 109.68.105.30 --destination-port 80 -j DROP On possibility is that perhaps it is coming in via ip6? but I would expect that to show in the apache logs. Ref: If it makes a difference... the output of iptables -L -n --line-numbers: Code: Chain INPUT (policy ACCEPT) |
|
| Author: | hoopycat [ Tue May 15, 2012 5:27 pm ] |
| Post subject: | |
Their packets are matching INPUT line 9 (accept tcp dpt:80), so the drop on INPUT line 24 is never being hit. (Indeed, nothing after line 20 should ever hit.) |
|
| Author: | Dweeber [ Tue May 15, 2012 6:44 pm ] |
| Post subject: | |
Okay, that makes sense. Wasn't looking at this right... That means I just need to change my script to insert temp rules so that they go to the top of the chain. The actual rule would look like (Using -I instead of -A). Code: iptables -I INPUT -s 109.68.105.30 -j DROP or Code: iptables -I INPUT -i eth0 -p tcp -s 109.68.105.30 --destination-port 80 -j DROP tempdrop script... (Wont persist past reboot or reload of rules)... Code: #!/bin/bash |
|
| Page 1 of 1 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|