All of lore.kernel.org
 help / color / mirror / Atom feed
* IP drop question
@ 2006-04-28  0:50 Philip Rhoades
  2006-04-28 10:56 ` angico
  2006-04-28 16:32 ` Drew Leske
  0 siblings, 2 replies; 5+ messages in thread
From: Philip Rhoades @ 2006-04-28  0:50 UTC (permalink / raw)
  To: netfilter

People,

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
 
 **Unmatched Entries**
 pam_succeed_if(sshd:auth): error retrieving information about user
administrator : 1 time(s)

My config is this:

*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


Can someone point out what I am doing wrong?

Thanks,

Phil.
-- 
Philip Rhoades

Pricom Pty Limited  (ACN 003 252 275  ABN 91 003 252 275)
GPO Box 3411
Sydney NSW      2001
Australia
Mobile:  +61:(0)411-185-652
Fax:     +61:(0)2-8221-9599
E-mail:  phil@pricom.com.au




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: IP drop question
  2006-04-28  0:50 IP drop question Philip Rhoades
@ 2006-04-28 10:56 ` angico
  2006-04-28 16:32 ` Drew Leske
  1 sibling, 0 replies; 5+ messages in thread
From: angico @ 2006-04-28 10:56 UTC (permalink / raw)
  To: netfilter

if i can understand it well, it doesn't make sense you have your INPUT
policy set to DROP if you have matches that say to -j ACCEPT if -i eth0
and eth1 (unless you have other interfaces that actualy connects you to
the outside world and eth0/1 are tied to your intranet).
regards,
angico.


--- Philip Rhoades <phil@pricom.com.au> wrote:

> People,
> 
> 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
>  
>  **Unmatched Entries**
>  pam_succeed_if(sshd:auth): error retrieving information about user
> administrator : 1 time(s)
> 
> My config is this:
> 
> *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
> 
> 
> Can someone point out what I am doing wrong?
> 
> Thanks,
> 
> Phil.
> -- 
> Philip Rhoades
> 
> Pricom Pty Limited  (ACN 003 252 275  ABN 91 003 252 275)
> GPO Box 3411
> Sydney NSW      2001
> Australia
> Mobile:  +61:(0)411-185-652
> Fax:     +61:(0)2-8221-9599
> E-mail:  phil@pricom.com.au
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: IP drop question
  2006-04-28  0:50 IP drop question Philip Rhoades
  2006-04-28 10:56 ` angico
@ 2006-04-28 16:32 ` Drew Leske
  2006-04-28 17:06   ` Rob Sterenborg
  1 sibling, 1 reply; 5+ messages in thread
From: Drew Leske @ 2006-04-28 16:32 UTC (permalink / raw)
  To: phil; +Cc: netfilter

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)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: IP drop question
  2006-04-28 16:32 ` Drew Leske
@ 2006-04-28 17:06   ` Rob Sterenborg
  2006-04-28 17:46     ` Drew Leske
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Sterenborg @ 2006-04-28 17:06 UTC (permalink / raw)
  To: netfilter

>> 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

Huh..? Not to nitpick or anything, but dport 25 is smtp and dport 23 is
telnet. IMHO this rule will not allow telnet.


Gr,
Rob



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: IP drop question
  2006-04-28 17:06   ` Rob Sterenborg
@ 2006-04-28 17:46     ` Drew Leske
  0 siblings, 0 replies; 5+ messages in thread
From: Drew Leske @ 2006-04-28 17:46 UTC (permalink / raw)
  To: Rob Sterenborg; +Cc: netfilter


> Huh..? Not to nitpick or anything, but dport 25 is smtp and dport 23 is
> telnet. IMHO this rule will not allow telnet.

Hah--you're right.  I thought something was off as I typed that.

Chrs,
Drew.

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-04-28 17:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-28  0:50 IP drop question Philip Rhoades
2006-04-28 10:56 ` angico
2006-04-28 16:32 ` Drew Leske
2006-04-28 17:06   ` Rob Sterenborg
2006-04-28 17:46     ` Drew Leske

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.