Linux Netfilter discussions
 help / color / mirror / Atom feed
From: SBlaze <dagent.geo@yahoo.com>
To: Jorge Garcia <anarkophobia@latinmail.com>, netfilter@lists.netfilter.org
Subject: Re: port scanning
Date: Thu, 18 Mar 2004 16:15:20 -0800 (PST)	[thread overview]
Message-ID: <20040319001520.73563.qmail@web61008.mail.yahoo.com> (raw)
In-Reply-To: <20040318224754.5502418D76@smtp.latinmail.com>


--- Jorge Garcia <anarkophobia@latinmail.com> wrote:
> hi, i need an example of script ( please, i need the example works, becuouse
> i found a lot on internet that doesnt work) for logging and dropping port
> scans with iptables.
> thanx
> 
> http://www.latinmail.com - La forma más cómoda de enviar y recibir tus
e-mails

This is what I use and it works very well. You will need to allow services(if
you have any that is.) Those rules must be placed before these lines. Also of
course you must have the device reflect your internet device.

# NMAP and Connection killer
 #
 # iptables -A INPUT -p tcp -i eth0 -m state --state NEW -j LOG
 iptables -A INPUT -p tcp -i eth0 -m state --state NEW,INVALID -j DROP
 iptables -A INPUT -p tcp -i eth0 -m state --state ESTABLISHED,RELATED -j
ACCEPT

 # UDP Filters
 #
 #iptables -A INPUT -p udp -i eth0 -m state --state NEW,INVALID -j LOG
 iptables -A INPUT -p udp -i eth0 -m state --state NEW,INVALID -j DROP
 iptables -A INPUT -p udp -i eth0 -m state --state ESTABLISHED,RELATED -j
ACCEPT

 # ICMP Filtration
 #
 iptables -A INPUT -p icmp -i eth0 -m state --state NEW,INVALID -j DROP
 iptables -A INPUT -p icmp -i eth0 -m state --state ESTABLISHED,RELATED -j
ACCEPT

Proof that it works?

hogwarts:~# iptables -vnL
Chain INPUT (policy ACCEPT 789K packets, 166M bytes)
 pkts bytes target     prot opt in     out     source               destination
15813 1383K LOG        tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0  
        tcp dpt:80 LOG flags 0 level 4
 2137  128K DROP       all  --  eth0   *       12.175.0.35          0.0.0.0/0
    0     0 ACCEPT     all  --  eth0   *       68.1.132.236         0.0.0.0/0
13676 1255K ACCEPT     tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0  
        tcp dpt:80
 3727  208K DROP       tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0  
        state INVALID,NEW
 2516 3759K ACCEPT     tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0  
        state RELATED,ESTABLISHED
  27M 3361M DROP       udp  --  eth0   *       0.0.0.0/0            0.0.0.0/0  
        state INVALID,NEW
 1543  227K ACCEPT     udp  --  eth0   *       0.0.0.0/0            0.0.0.0/0  
        state RELATED,ESTABLISHED
 1697 1426K DROP       icmp --  eth0   *       0.0.0.0/0            0.0.0.0/0  
        state INVALID,NEW
  133  7448 ACCEPT     icmp --  eth0   *       0.0.0.0/0            0.0.0.0/0  
        state RELATED,ESTABLISHED

Chain FORWARD (policy ACCEPT 11M packets, 3359M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 1452K packets, 1121M bytes)
 pkts bytes target     prot opt in     out     source               destination




=====
In the absence of order there will be chaos.

__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com


      parent reply	other threads:[~2004-03-19  0:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-18 22:47 port scanning Jorge Garcia
2004-03-18 23:02 ` Frederic de Villamil
2004-03-19  0:15 ` SBlaze [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040319001520.73563.qmail@web61008.mail.yahoo.com \
    --to=dagent.geo@yahoo.com \
    --cc=anarkophobia@latinmail.com \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox