public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Evgeniy Bushkov <zhen@dotcomltd.ru>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Curious pattern in log files from ssh...
Date: Thu, 04 Dec 2008 14:24:03 +0300	[thread overview]
Message-ID: <4937BDD3.3060809@dotcomltd.ru> (raw)
In-Reply-To: <4936E5E3.1040606@shic.co.uk>

[-- Attachment #1: Type: text/plain, Size: 2528 bytes --]

Steve пишет:
> I've recently discovered a curious pattern emerging in my system log
> with failed login attempts via ssh.
>
> Previously, I noticed dictionary attacks launched - which were easy to
> detect... and I've a process to block the IP address of any host that
> repeatedly fails to authenticate.
>
> What I see now is quite different... I'm seeing a dictionary attack
> originating from a wide range of IP addresses - testing user-names in
> sequence... it has been in progress since 22nd November 2008 and has
> tried 7195 user names in alphabetical order from 521 distinct hosts -
> with no successive two attempts from the same host.
>
> I'm not particularly concerned - since I'm confident that all my users
> have strong passwords... but it strikes me that this data identifies a
> bot-net that is clearly malicious attempting to break passwords.
>
> Sure, I could use IPtables to block all these bad ports... or... I could
> disable password authentication entirely... but I keep thinking that
> there has to be something better I can do... any suggestions?  Is there
> a simple way to integrate a block-list of known-compromised hosts into
> IPtables - rather like my postfix is configured to drop connections from
> known spam sources from the sbl-xbl.spamhaus.org DNS block list, for
> example.
>
> Break in attempts today (attempted username/IP address):
> --
>
>   
Hi.
Best of all you can add iptables rules. It's better then use any script. 
Also take a note that there are no "known-compromised hosts" because ANY 
IP can be forged.
I've sometimes seen such rules in the internet. These I use in my firewall:

iptables -A INPUT -i eth0 -p tcp -m state --state NEW --dport 22 -m 
recent --name sshattack --set
iptables -A INPUT -i eth0 -p tcp -m state --state NEW --dport 22 -m 
recent --name sshattack --rcheck --seconds 60 --hitcount 4 -j LOG -m 
limit --limit 3/minute --limit-burst 3 --log-level 4 --log-prefix 'SSH 
REJECT: '
iptables -A INPUT -i eth0 -p tcp -m state --state NEW --dport 22 -m 
recent --name sshattack --rcheck --seconds 60 --hitcount 4 -j REJECT 
--reject-with tcp-reset

These rules give you possibility to use your ssh service from any IP but 
reject repeated login attempts from malicious users. You can tune 
parameter --hitcount to limit amount of
sequential login attempts per minute. Also you can look at 
/proc/net/ipt_recent/sshattack for malicious IPs and how often they were 
used.

Best regards,
Evgeniy B.



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 5581 bytes --]

  parent reply	other threads:[~2008-12-04 11:24 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-03 20:02 [gentoo-user] Curious pattern in log files from ssh Steve
2008-12-03 20:16 ` [gentoo-user] " Nikos Chantziaras
2008-12-03 20:19   ` Paul Hartman
2008-12-03 20:52     ` Nikos Chantziaras
2008-12-03 20:17 ` [gentoo-user] " Albert Hopkins
2008-12-03 20:18 ` Paul Hartman
2008-12-03 20:49 ` Simon
2008-12-04 11:31   ` Steve
2008-12-05  7:16     ` Mick
2008-12-03 20:54 ` Alan McKinnon
2008-12-03 21:03 ` Dmitry S. Makovey
2008-12-03 21:47   ` Steve
2008-12-03 22:11     ` Dmitry S. Makovey
2008-12-03 22:55       ` Steve
2008-12-03 23:21         ` Paul Hartman
2008-12-03 23:46           ` Dmitry S. Makovey
2008-12-03 23:55           ` Steve
2008-12-04  0:07             ` Dmitry S. Makovey
2008-12-04  0:39               ` Steve
2008-12-04 15:50                 ` Dmitry S. Makovey
2008-12-04 22:44                   ` Adam Carter
2008-12-05  0:15                     ` Dmitry S. Makovey
2008-12-04 23:42                   ` Shawn Haggett
2008-12-03 22:54     ` Adam Carter
2008-12-04 11:24 ` Evgeniy Bushkov [this message]
2008-12-04 22:41   ` Adam Carter
2008-12-04 22:53     ` Adam Carter
2008-12-05 15:05     ` Evgeniy Bushkov
2008-12-07  5:52       ` Joshua Murphy
2008-12-04 19:03 ` Christian Franke
2008-12-04 20:22   ` Dmitry S. Makovey
2008-12-04 21:20   ` Alan McKinnon
2008-12-05 11:24     ` Steve

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=4937BDD3.3060809@dotcomltd.ru \
    --to=zhen@dotcomltd.ru \
    --cc=gentoo-user@lists.gentoo.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