> And as several correspondents have reminded me already -- switching your sshd to keys only authentication will let you sleep better at night.
Even with fail2ban and limited retries, there's no excuse for using password-based authentication anymore. Use an SSH key, protect the key with a password, and turn off password login on all your servers.
Other than that, the main gist of this post is: on most platforms, the default settings for remote login already make brute-force login attempts annoying at best, and with fail2ban or something similar, it's a non-issue.
Normally they're used for OTPs or Chrome's FIDO U2F auth scheme, but you can also put them in smartcard mode. If you do this, you can use it as an OpenPGP key, which is also compatible with SSH:
https://www.esev.com/blog/post/2015-01-pgp-ssh-key-on-yubike... https://www.yubico.com/2012/12/yubikey-neo-openpgp/
Just about the only place that won't work is on a phone. Technically it has an independent NFC interface which could probably be made to work with some extra development, but I haven't looked into it.
That way a brute force attack would essentially need to gain access to the shared OTP secret in order to be successful (assuming ~few/normal user population. With a 6-digit otp, I suppose the value of otp drops if an attacker can try to log in as ~1 billion users in parallel -- but it's not really a scenario most of us have to worry about).
Another option is to use ssh certificates. As long as you are able to make yourself new user certificates, you can log in. One bonus with certificates is that they can be set to expire, unlike keys.
If I lose the phone, there's a pretty good password on that key that should give me ample time to remove access rights for it.
Then if you need to get in, download the key, type in the password, login as that user, and the su up to root by entering the password only you know.
As an additional layer of security you could encrypt the key using AES-256 (e.g. 7Zip archive, Microsoft Office's Word .docx (NOT .doc) format (just drag drop the file into Word, "Encrypt with password") now AES-256 encrypted, others).
Now you have four layers of protection:
- su password.
- Key password.
- AES-256 encryption password.
- "Cloud" storage credentials.
(A stepstone is a well-protected server where you can log in with user/pass and use your keys to login to other machines from there.)
Don't note what machine or where the key has access to either. I know purists will take issue with this but it's a solution to a problem as you have detailed.
Obviously only works from "borrowed machine from friend work etc" unless you can get the key from a machine to "wife's phone".
You still need a passphrase to decrypt the private key. If you bump up the number of trials, you can make decryption even slower. It's going to be harder for someone to crack that than a normal brute force against a password.
Now, if you put that key behind a decently secure storage service that you use TFA to access, that's actually way more secure than just using a password.
Given that, the question ought to be whether you upload the private key to the cloud, or try to manage the private key yourself. Password based authentication shouldn't be one of the options you are considering.
fail2ban/sshguard/etc are not infallible. Someone will find a way to break them.
1. Disable root
2. Use keys, disable passwords
3. Install fail2ban
4. Restrict incoming subnets
5. MathAuthTries = 1
6. Run on high random port
7. Use port knockingThis doesn't add any security, it only makes your admin life miserable.
Besides the dubious security value, another reason I haven't bothered is that if you don't have convenient+secure access to a proper key, you're not going to have convenient+secure access to the key generator either. Maybe it could still be an excuse to learn a new language and how SSH keys work. I don't know if I could rationalize even tossing it up on Github with warnings though.
It's effectively the same thing as generating the key from the pass phrase, except you are mixing in a nice giant product of two primes in to the mix.
If you can login from "some random machine" that means your password is terribly weak as well. Use a password manager, generate passwords with over 100 bits of entropy, and then you can't log into anything without it present. Now start carrying around your password manager on an encrypted thumbdrive, along with your gpg key and private ssh key with the decryption password + password manager password being the only ones you remember.
Any password a human creates and remembers is a problem. The best mitigation is to only remember passwords that are only useful in conjunction with physical access (the password manager / decryption ones).
I do have a USB thumb drive with a bootable standalone system which I could use on a random mmachine --- but even if that solves the problem of exposing my password or ssh keys to a system which has malware on it, I pretty much assume that random machines, especially those at airport lounges or internet cafes, probably have keyboard bugs installed, so I wouldn't really trust my bootable thumb drive on those machines anyway.
I might use the thumb drive on a friend's machine which I really trusted, but most of the time I'd much rather use a trusted machine that I own, such as either my tablet or my laptop, or in the extreme cases, my phone.
Maybe a rearchitected replacement will land in systemd someday...
I think the problem is that somehow everyone ended up with PAM and are now somewhat stuck with it. FreeBSD too.
Particularly if you presume that PAM is the devil, the last thing you want to do, from a security standpoint, is to let a client dictate how a server applies PAM. The policy _has_ to be entirely controlled by the server's config. Once you let the client decide, you're just asking for things to go wrong.
"I wouldn't call that an OpenSSH bug. I would call it a systemic design flaw in PAM."
is then clearly wrong, it is an OpenSSH bug.
http://netbsd.gw.com/cgi-bin/man-cgi?blacklistd++NetBSD-curr...
This is a serious vuln for FreeBSD. Period.
Mr Hansteen is saying it is not a serious OpenSSH vuln, like the tech media is claiming it is.
> This is a serious vuln for FreeBSD. Period.
That's why the original disclosure and subsequent news articles clearly stated it was a FreeBSD and/or PAM vulnerability, and didn't run with headlines such as "OpenSSH keyboard-interactive authentication brute force vulnerability"[0] or "Bug in widely used OpenSSH opens servers to password cracking"[1].
[0] https://kingcope.wordpress.com/2015/07/16/openssh-keyboard-i...
[1] http://arstechnica.com/security/2015/07/bug-in-widely-used-o...
https://nyllep.wordpress.com/2015/07/25/emergency-fix-for-cv...