How to improve ssh security?

I used to have my system's access tightly controlled by source IP or domain using hosts.allow and hosts.deny. Now I have users who are coming from a variety of locations so this is not so practical.

I have opened up logins to any source and I now have people trying to break in at regular intervals.

Is there some way I can block an IP address after it has had a number of failed login attempts?

Any other suggestions on securing ssh logins further appreciated.

thanks

0

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Try fail2ban

I'm not really able to advise you on ssh security in general, although it's a good idea to make sure root can't log in remotely (check the sshd_config manpage -- it has plenty of good ideas!)

There are a few tools you could use to restrict attempts at brute force attacks -- I use fail2ban, which is available in Debian. I don't know if it's considered good or not, but it does the job for me.

--
A tidy house is the sign of a stolen computer.

How to improve ssh security?

You can use iptables firewall to restrict access to 22 port.
Also you can use parameter in sshd_config

MaxStartups
Specifies the maximum number of concurrent unauthenticated con-
nections to the sshd daemon. Additional connections will be
dropped until authentication succeeds or the LoginGraceTime
expires for a connection. The default is 10.

Alternatively, random early drop can be enabled by specifying the
three colon separated values ``start:rate:full'' (e.g.,
"10:30:60"). sshd will refuse connection attempts with a proba-
bility of ``rate/100'' (30%) if there are currently ``start''
(10) unauthenticated connections. The probability increases lin-
early and all connection attempts are refused if the number of
unauthenticated connections reaches ``full'' (60).

It's your solution :)
Good luck

Janet Kellman, software reviews

How to improve ssh security?

I know this is a late response but...

Just use a perl bot to monitor your secure logs.
It can watch every min and add a user to hosts.deny if the user fails after a certain amount in a row.

Like 3 . You can give it a range of ips you want to ignore if errors like your IP so you can always get in and remove ips listed from hosts.deny if needed.

Syndicate content