Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Drew Leske <dleske@uvic.ca>
To: phil@pricom.com.au
Cc: netfilter@lists.netfilter.org
Subject: Re: IP drop question
Date: Fri, 28 Apr 2006 09:32:49 -0700	[thread overview]
Message-ID: <445243B1.3080904@uvic.ca> (raw)
In-Reply-To: <1146185403.29318.7.camel@prix.pricom.com.au>

Hi Philip,

> My config does not appear to be dropping unauthorised IPs - in my
> logwatch file I am still getting lines like:
> 
>  Failed logins from:
>     211.238.253.248: 54 times
>  
>  Illegal users from:
>     202.110.131.27: 1 time
>     211.238.253.248: 164 times

I'm not familiar with logwatch.  Are these SSH, telnet, other?  I assume
SSH, because new telnet connections are allowed in with this rule:

> -A INPUT -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport 25 --syn
> -j ACCEPT

Going through the iptables you provided, let's say with 211.238.253.248,
coming in on a new connection for SSH on port 22, the first rule matched
would be this one (assuming eth0 and/or eth1 are external interfaces):

> -A INPUT -i eth0 -j ACCEPT
> -A INPUT -i eth1 -j ACCEPT

So they'd get through.

As an aside, I'd recommend you 'tail -f /var/log/messages' or wherever
you've got your kernel messages going in a separate window while you tune
your iptables configuration.  This will allow you to catch these attempts
and make rules for them faster than waiting to see them show up in a log the
next day.

Cheers,
Drew.


> *filter
> :INPUT DROP [0:0]
> :FORWARD DROP [0:0]
> :OUTPUT DROP [0:0]
> -A INPUT -i lo -j ACCEPT
> -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
> # -A INPUT -p tcp -i eth0 --dport 22 --sport 1024:65535 -j LOG
> --log-prefix "ssh connect:"
> -A INPUT -p tcp -m tcp -s 149.171.173.169 --dport 22 -j ACCEPT
> -A INPUT -p tcp -m tcp -s 203.166.81.114 --dport 22 -j ACCEPT
> # -A INPUT -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport 22 -j
> ACCEPT 
> -A INPUT -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport 25 --syn
> -j ACCEPT
> -A INPUT -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport 53 --syn
> -j ACCEPT
> -A INPUT -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport 80 -j
> ACCEPT
> -A INPUT -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport 3128
> --syn -j ACCEPT
> -A OUTPUT -o lo -j ACCEPT
> -A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
> -A INPUT -i lo -j ACCEPT
> -A INPUT -i eth0 -j ACCEPT
> -A INPUT -i eth1 -j ACCEPT
> -A INPUT -p udp -m udp -s 149.171.173.169 --sport 53 -d 0/0 -j ACCEPT
> -A INPUT -p udp -m udp -s 203.166.81.114 --sport 53 -d 0/0 -j ACCEPT
> -A INPUT -p tcp -m tcp --syn -j REJECT
> -A INPUT -p udp -m udp -j REJECT
> -A INPUT -j LOG --log-level alert
> -A INPUT -j LOG --log-prefix "Dropped: "
> COMMIT

-- 
Drew Leske :: Systems Group/Unix, Computing Services, University of Victoria
  dleske@uvic.ca / +1250 472 5055 (office) / +1250 588 4311 (cel)


  parent reply	other threads:[~2006-04-28 16:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-28  0:50 IP drop question Philip Rhoades
2006-04-28 10:56 ` angico
2006-04-28 16:32 ` Drew Leske [this message]
2006-04-28 17:06   ` Rob Sterenborg
2006-04-28 17:46     ` Drew Leske

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=445243B1.3080904@uvic.ca \
    --to=dleske@uvic.ca \
    --cc=netfilter@lists.netfilter.org \
    --cc=phil@pricom.com.au \
    /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