1 |
Hi mate, |
2 |
|
3 |
I attached a little script I'm using to do that in conjunction with shorewall. |
4 |
To use it - configure shorewall to use the blacklist file on the related |
5 |
interface. I have added 2 exceptions - when failed logins are coming from |
6 |
10.0.2.* and 192.168.2.* subnets. Search for these and adapt to your network. |
7 |
|
8 |
Starting it through cron every 2 minutes (which IMHO is enough). |
9 |
*/2 * * * * root /etc/shorewall/hosts_reject.sh |
10 |
|
11 |
the file /etc/cron.d/hosts_reject. |
12 |
This script is not real-time - however - after some month of running - I have |
13 |
only 1 per month average trying to probe my ssh-logins - as it seems the |
14 |
drone-systems are blacklisted (Having 153 IP's in my blacklist right now). |
15 |
You'll require the logtail program to trim the lodfiles ;) |
16 |
|
17 |
BTW - the system will send you a mail-report when a new IP has been found |
18 |
probing your Network. |
19 |
|
20 |
Drawback: if you're loging in from outside and miswrite your login-name - the |
21 |
system will most probably lock you out. MAke sure you log in from a different |
22 |
IP-Address. |
23 |
|
24 |
Cheers |
25 |
|
26 |
Joerg |
27 |
|
28 |
On Tuesday 04 October 2005 01:26, Jeremy Brake wrote: |
29 |
> Thanks for all the great input guys. |
30 |
> Theres a lot of reading to do before I can decide ona the most suitable |
31 |
> option for me, but I'll get through it all. |
32 |
> |
33 |
> While i'm getting my head around everything to impliment a permanent |
34 |
> solution, what about this? (sorry, not great with iptables just yet..) |
35 |
> Leave sshd listening on port 22, but firewall off everything except my |
36 |
> trusted IP's (localhost, home, girlfriend, work subnet, internal subnet, |
37 |
> flatmates server) . |
38 |
> Add an IPTables rule to port forward $ambiguous_external_port through to |
39 |
> port 22 on localhost (or if its safer, the 10.x.x.x IP assigned to the |
40 |
> machine) , and log the instance. |
41 |
> My thinking is that this would make it harder for someone to find my |
42 |
> open ssh port, but leave me the convenience of not having to specify a |
43 |
> port when I connect from my regular connections, dozens of times a day. |
44 |
> Or is it just going to open up an IP spoofing exploit on port 22, and |
45 |
> achieve practically nothing? |
46 |
> |
47 |
> Presumably this would eliminate the need for my original idea of |
48 |
> search-and-destroy on the brute force scripts, but I'll probably look at |
49 |
> implimenting something along those lines when I get my ftpd going (i'm |
50 |
> using SCP for everything now, but theres a need to change that. ) and |
51 |
> will still look at using the idea for my permanent SSH solution. |
52 |
> |
53 |
> I like the sound of of SEC, the IPTables' "recent" option, and port |
54 |
> knocking. Because NZ IPs are assigned from the APNIC ranges, I'm not |
55 |
> sure how well the GEOIP patch would work, but i'll look into it. |
56 |
> (otherwise I would have blacklisted all of Asia already) |
57 |
> I'm going to read through all the rules and scripts posted, once i've |
58 |
> researched the available tools, and i'll go from there. |
59 |
> |
60 |
> |
61 |
> Cheers |
62 |
> Jeremy B |
63 |
> |
64 |
> Jeremy Brake wrote: |
65 |
> > Hey all, |
66 |
> > |
67 |
> > I'm looking for an app/script which can monitor for failed ssh logins, |
68 |
> > and block using IPTables for $time after $number of failed logins (an |
69 |
> > exclusion list would be handy as well) so that I can put a quick stop |
70 |
> > to these niggly brute-force ssh "attacks" I seem to be getting more |
71 |
> > and more often. |
72 |
> > |
73 |
> > Anyone have any ideas? |
74 |
> > |
75 |
> > Thanks, Jeremy B |
76 |
|
77 |
-- |
78 |
A witty saying proves nothing, but saying something pointless gets |
79 |
people's attention. |
80 |
------------------------------------------------------------------------ |
81 |
| Joerg Mertin : smurphy@××××××.org (Home)| |
82 |
| in Forchheim/Germany : smurphy@×××××.de (Alt1)| |
83 |
| Stardust's LiNUX System : | |
84 |
| Web: http://www.solsys.org | |
85 |
------------------------------------------------------------------------ |
86 |
PGP Fingerprint: AF0F FB75 997B 025F 4538 5AD6 9888 5D97 170B 8B7A |