Linode Forum Index Linode Forum
Linode Community Forums
 


Block root access after 3 fail

Click here to go to the original topic

 
       Linode Forum Index -> General Discussion
Author Message
Karnius



Joined: 18 Dec 2008
Posts: 27

Posted: Thu May 07, 2009 12:19 pm    Post subject: Block root access after 3 fail  

Hi guys,

I was looking at my auth.log attempt today, and oh boy, for only 3 not known web site I got alot of root attempts.

Is there an easy way to block ip addresses if they fail more than 3 times to authenticate ssh?

thank you !
Cedric
Back to top  
czotos



Joined: 23 Apr 2009
Posts: 14

Posted: Thu May 07, 2009 12:30 pm    Post subject:  

apt-get install denyhosts

(For Debian and Debian-based distros...)
Back to top  
Karnius



Joined: 18 Dec 2008
Posts: 27

Posted: Thu May 07, 2009 12:47 pm    Post subject:  

yah im on ubuntu 9.04

Thank you!
Back to top  
fos



Joined: 02 Jan 2009
Posts: 101
Location: Texas

Posted: Thu May 07, 2009 2:44 pm    Post subject:  

Check sshd_config:

PermitRootLogin no (then use su or su - to gain root privaleges)

MaxAuthTries 3 (drops the connection after 3 login failures)

This is just a basic start at ssh security.

As others mentioned, I have had good luck denyhost

Jeff
Back to top  
marcus0263



Joined: 21 Jul 2008
Posts: 171
Location: Seattle

Posted: Thu May 07, 2009 8:30 pm    Post subject:  

Allowing remote root access is a really, really bad idea. Do yourself a favor and disable all remote root access, create a user with a really obscure name. Then just make sure they belong in the "wheel" group so you can just su over once logged in.

Then I would go even further and lock down ssh access by IP if at all possible. ;)
Back to top  
tronic



Joined: 04 Dec 2004
Posts: 145

Posted: Thu May 07, 2009 11:17 pm    Post subject:  

marcus0263 wrote: Allowing remote root access is a really, really bad idea. Do yourself a favor and disable all remote root access, create a user with a really obscure name. Then just make sure they belong in the "wheel" group so you can just su over once logged in.

Then I would go even further and lock down ssh access by IP if at all possible. ;)

Ways to be safer:

1) sshd on an alternate port
2) disable password-based logins and allow only passphrase-based logins
3) use of sudo to gain root access instead of su might be better since it gives you more fine-grained control and also doesn't require you to be in wheel (wheel can be dangerous or a risk at times if ever compromised)
4) use of two-factor authentication. SecurID is common but really expensive. There's cheaper stuff for small scale setups, but can't remember what I looked at now.

I'm not fond of idea of having a separate login to use to become root because it's too easy to overlook any compromise attempts (successful or unsuccessful) with these than an account you use daily. Also, accounts unused for a long time may become security risks.
Back to top  
marcus0263



Joined: 21 Jul 2008
Posts: 171
Location: Seattle

Posted: Fri May 08, 2009 12:43 am    Post subject:  

tronic wrote: marcus0263 wrote: Allowing remote root access is a really, really bad idea. Do yourself a favor and disable all remote root access, create a user with a really obscure name. Then just make sure they belong in the "wheel" group so you can just su over once logged in.

Then I would go even further and lock down ssh access by IP if at all possible. ;)

Ways to be safer:

1) sshd on an alternate port
2) disable password-based logins and allow only passphrase-based logins
3) use of sudo to gain root access instead of su might be better since it gives you more fine-grained control and also doesn't require you to be in wheel (wheel can be dangerous or a risk at times if ever compromised)
4) use of two-factor authentication. SecurID is common but really expensive. There's cheaper stuff for small scale setups, but can't remember what I looked at now.

I'm not fond of idea of having a separate login to use to become root because it's too easy to overlook any compromise attempts (successful or unsuccessful) with these than an account you use daily. Also, accounts unused for a long time may become security risks.
I don't see a problem with having "one" user with a complex/obscure login name and locking access to specific IP/IP's.
Back to top  
 
       Linode Forum Index -> General Discussion
Page 1 of 1