Re: iptables anti-nimda anyone?
From: Evan Borgstrom (syntec@unixpimps.org)Date: 09/21/01
- Previous message: Andrew Hatfield: "RE: Tcpdump and 3des packets"
- In reply to: Konrad Michels: "iptables anti-nimda anyone?"
- Next in thread: Bill Weiss: "Re: iptables anti-nimda anyone?"
- Next in thread: Chris Freeze: "RE: iptables anti-nimda anyone?"
- Reply: Bill Weiss: "Re: iptables anti-nimda anyone?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 21 Sep 2001 09:17:56 -0400 From: Evan Borgstrom <syntec@unixpimps.org> To: focus-linux@securityfocus.com Subject: Re: iptables anti-nimda anyone? Message-ID: <20010921091756.A20513@unixpimps.org>
Note: for this to work you need to have compiled IPtables with the string match
module.
$iptables=the path to iptables
$if1addr=the external interface address
$if1=the enternal interface
$iptables -A INPUT -p tcp -s 0/0 -d $if1addr -i $if1 --match string --string "root.exe" --dport 80 -j DROP
$iptables -A INPUT -p tcp -s 0/0 -d $if1addr -i $if1 --match string --string "cmd.exe" --dport 80 -j DROP
$iptables -A INPUT -p tcp -s 0/0 -d $if1addr -i $if1 --match string --string "default.ida" --dport 80 -j DROP
Then just pipe you apache logs to a little /bin/sh script that verifys that
there is actually content in the logs (otherwise you'll get a WHOLE bunch of
empty apache entries since the connection is already opened).
For instance an empty log would look like this:
IPAddress - - [21/Sep/2001:08:53:33 -0400] "-" 408 -
First add a directive like: TransferLog "|/usr/local/apache/bin/filterandlog"
And then make filterandlog do something like:
------------------------------------------
#!/bin/sh
# this will read line by line, discard empty entires and log the rest like cronolog
while read line; do
content="`echo $line | awk -F'"' '{print $2}'`"
if [ "$content" != "-" ]; then
echo $line > /var/log/httpd/`date +%Y-%m-%d`
fi
done
------------------------------------------
And the nice thing about this is that it will slow things down, since it drops
the packet and the client will be waiting for a response.
Evan
[Wed, Sep 19, 2001 at 04:26:30PM +0100]
Konrad Michels provided the following enlightenment:
> Hi everyone
> I don't suppose one of our iptables gurus out there has an iptables rule
> to filter out this damn nimda thing? I'm really annoyed about it
> filling up my apache logz and would love to drop the packets 'ere they
> get to the apache server . . .
>
> Later
> Konrad
>
> --
> ************************************************************
> * Linux isn't unfriendly - its just picky about who its
> * friends are!
> *
> ************************************************************
> * Konrad Michels (RHCE)
> * Systems Manager
> * OverNet Data (UK) LTD
> ************************************************************
-- Evan Borgstrom <syntec@unixpimps.org> UNIXPIMPS.ORG - SIG:ILL-<< PGP >>------------------------------------------- Fp; A381 103B D115 C7FF A4B2 4F39 DB5E 0F26 9980 8EF9 PK; http://www.unixpimps.org/~syntec/pubkey.asc -----------------------------------------------------
- Previous message: Andrew Hatfield: "RE: Tcpdump and 3des packets"
- In reply to: Konrad Michels: "iptables anti-nimda anyone?"
- Next in thread: Bill Weiss: "Re: iptables anti-nimda anyone?"
- Next in thread: Chris Freeze: "RE: iptables anti-nimda anyone?"
- Reply: Bill Weiss: "Re: iptables anti-nimda anyone?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|