Protecting sshd - Was: SSHguard & IPFW

Matt Smith fbsd at xtaz.co.uk
Thu Oct 1 18:35:35 UTC 2015


On Oct 01 12:49, Christopher Sean Hilton wrote:
>The crux of the issue is ssh with password auth. You are either
>allowing passwords or you aren't. If you aren't allowing passwords
>then the brute force industry chances of successfully compromising
>your servers are very very low and you are relatively safe. If you
>allow passwords, you're open to their attack and if you have any weak
>passwords, it's a matter of time.

There are two ports which provide a pam module which is very handy for 
adding two factor authentication to ssh. security/oath-toolkit is the 
one I use but there is also security/pam_google_authenticator. With one 
of these you can add a line to /etc/pam.d/sshd and use an app on your 
phone which supports HOTP/TOTP, I personally use the Google 
Authenticator app. You generate a secret and scan it into the phone with 
a QR code and it shows a 6 digit number which changes every 30 seconds.

Then if you log in to ssh with a certificate it works like normal. If 
you log in to ssh with a password then it *also* asks for the latest 
code from your phone in addition to the password. Hugely more secure as 
even if somebody on the internet knows your password, it's highly 
unlikely they will also know the code currently displayed on your phone.


-- 
Matt


More information about the freebsd-questions mailing list