hardening SSH

Knute Johnson knute at frazmtn.com
Wed Aug 15 22:39:17 UTC 2007


>I use ssh (on my own machines, personal use). My primary box (for ssh, 
>it's the my daemon) is on dsl. The only machine that I log in from 
>(client?) is on the same ISP, and is on a dial-up line.
>
>I'd like to allow only those IPs that I might dynamically get. How would
>this be accomplished? I checked my secure log file (on the daemon box), 
>and have examples of IPs that I was assigned. Nota bene: It seems like 
>only the first and second parts are consistant. So, how can I specify a 
>range thus: 200.100.x.x ? Would I use a zero, or 'x', or ...?
>
>I checked out the openssh website - only man pages. I read the man page,
>but didn't see anything related to this. I used Google's linux search - 
>nothing this specific.
>
>I figure that I could use either sshd_config's ListenAddress or
>/etc/hosts.allow or hosts.deny.
>
>Btw, I figured out how to set up iptables to use a non-default port, and
>I use AllowUsers in the sshd_config (on the machine I log into).

200.100.0.0/16 or 200.100.0.0/255.255.0.0

To secure my ssh server I use public/private key, AllowUsers to only 
me and denyhosts.  Denyhosts is a program that automatically puts 
unwanted sites into my hosts.deny file.  There are a boatload of 
addresses in there.  I rarely get login attempts that actually get 
past hosts.deny any more and I used to get a lot.  I didn't change 
the port on mine.

With the public/private key and the user restricted to only me I 
think my server is pretty immune to being hacked.  Denyhosts just 
gives me a little satisfaction that I'm messing with the hackers.

I like my setup because it is easy to manage and very secure.  I did 
try a port knocking scheme with iptables and an iptables setup that 
blocked multiple logins from the same address.  They worked fine but 
were more problematic to use.

-- 
Knute Johnson
Molon Labe...





More information about the fedora-list mailing list