Linked by Thom Holwerda on Sun 19th Feb 2006 11:24 UTC, submitted by Falko Timme
Privacy, Security, Encryption "In this HowTo I will show how to install and configure DenyHosts. DenyHosts is a tool that observes login attempts to SSH, and if it finds failed login attempts again and again from the same IP address, DenyHosts blocks further login attempts from that IP address by putting it into /etc/hosts.deny. DenyHosts can be run by cron or as a daemon. In this tutorial I will run DenyHosts as a daemon."
Thread beginning with comment 97174
To read all comments associated with this story, please click here.
Overkill
by taschenorakel on Sun 19th Feb 2006 12:16 UTC
taschenorakel
Member since:
2005-07-06

This solution is overkill as there is some much more trivial solution to stop those kids trying to breaking automatically: Move your secure shell daemon to another port than 22. At least for me this tiny change blocked kids from one second to another.

RE: Overkill
by WereCatf on Sun 19th Feb 2006 12:45 in reply to "Overkill"
WereCatf Member since:
2006-02-15

Uhh...that doesn't stop someone from just checking all open ports and then test if there's ssh server running on one of them. Then you are again open to dictionary attacks, or brute force. I myself just use the default port 22, and have DenyHosts block access to every service on my machine for any IP which tries to break in. My /etc/hosts.deny is already quite big ^^

Oh, and just as a side note to anyone who's a newbie to these kinds of things: do NOT allow root to login remotely from anywhere..It's just too easy to try to guess the root password using brute force attacks..

Reply Parent Bookmark Score: 4

RE[2]: Overkill
by Mathman on Sun 19th Feb 2006 13:16 in reply to "RE: Overkill"
Mathman Member since:
2005-07-08

Absolutely wrong. Unless you're using a password which can be found in a dictionary, or one that's less than 8 characters, there's no way someone is going to brute force it. Try a password cracker out some time and you'll see what I mean.

Edited 2006-02-19 13:18

Reply Parent Bookmark Score: 1

RE[2]: Overkill
by postmodern on Sun 19th Feb 2006 23:24 in reply to "RE: Overkill"
postmodern Member since:
2006-01-27

Don't forget about using public key authentication.

Reply Parent Bookmark Score: 1

RE[2]: Overkill
by phoenix on Mon 20th Feb 2006 06:38 in reply to "RE: Overkill"
phoenix Member since:
2005-07-11

There's nothing wrong with allowing root logins via ssh ... if you use keys instead of passwords, and put long passphrases onto your private keys. Newer versions of OpenSSH include a nice without-password option to the PermitRootLogin which only allows root logins using keys ... no password allowed.

Reply Parent Bookmark Score: 1

RE[2]: Overkill
by taschenorakel on Mon 20th Feb 2006 08:26 in reply to "RE: Overkill"
taschenorakel Member since:
2005-07-06

> Uhh...that doesn't stop someone from just checking
> all open ports and then test if there's ssh server
> running on one of them.

Well, but the funny thing is: Those kids floating your log files don't do that, so for cleaning up your logfiles for being able to see real treats just moving the port helps.

Ok, but your other suggestion, disabling root login (or at least disabling password authentication) is pretty right. So just another indication, that DenyHosts is overkill for common secure shell setups. Remember: DenyHosts is yet another component which might break...

Reply Parent Bookmark Score: 1

RE: Overkill
by _LH_ on Sun 19th Feb 2006 13:11 in reply to "Overkill"
_LH_ Member since:
2005-07-20

>This solution is overkill as there is some much more trivial solution to stop those kids trying to breaking automatically: Move your secure shell daemon to another port than 22. At least for me this tiny change blocked kids from one second to another.

That doesn't really work if you have to provide shell access for hundreds of users some of which are somewhat non-technical.

Reply Parent Bookmark Score: 2

RE[2]: Overkill
by steviant on Mon 20th Feb 2006 06:14 in reply to "RE: Overkill"
steviant Member since:
2006-01-11

What are these people supposed to do with shell access if they're so utterly clueless that they can't even specify a port in their SSH client?

Reply Parent Bookmark Score: 1

RE: Overkill
by SEJeff on Sun 19th Feb 2006 13:47 in reply to "Overkill"
SEJeff Member since:
2005-11-05

On your *secure* host with ssh on port 1234, try running 'nmap -sV' against it and notice that is shows ssh + the version number with absolutely no problem. Like client side only, security through obscurity is NO security at all.

A better idea would be:
1.) Create a normal unprivileged user on the server with full sudo access.
2.) Use the 'AllowUsers' directive in the sshd_config to only allow that certain user.
3.) Make sure to uncomment 'PermitRootLogin no'
4.) 'ps -ef | grep sshd' and find the pid of the ssh daemon.
5.) 'kill -HUP xxxx' where xxxx is the pid of sshd to force it to reload it's configuration without restarting.

If you wanted to be really crazy, you could disable password authentication alltogether and use key based auth only. That is the most secure method.

Edited 2006-02-19 13:53

Reply Parent Bookmark Score: 5