110 points · by jessaustin · 8y ago · 65 comments
Clearly you'll only be accepting public key authentication too.
Edit: I see several other people posted this while I was typing :)
It's a little bit of a mix of security through obscurity and security in event of sshd having the vulnerability. It won't save you from a targeted attack but will save from blanket "scan 22 port and try root" attacks.
The same way moving ssh from 22 port to something else helps. If you see someone brute-forcing your root you can dismiss it since it's just someone found open 22 port, but if your actual username is being used in attack then you can detect the targeted attack.
Now having password-less sudo is almost the same as using root.
Also far better to encourage running sudo for every command, gives a nice simple audit log of what happened, right there in your syslog, so you can identify and undo mistakes, and also eliminate lines of enquiry.
Clearly you can cover your tracks with the old sudo vi / !bash and similar tricks, but the goal isn't to protect against hostile privileges users, its to know what happened so that when John is on holiday you can see what he did to fix the problem you had last week.
Unless you have an system with its own auth and audit capability connecting as root, shared accountability is bad. People do dumb shit, including illegal shit.
So, account with sudo capabilities is better than then one which is sudo by default.
However, it's somewhat less secure than sudo-enabled account with password requirement. If your SSH key is somehow compromised (unpassworded keyfile or attacker had gained access to ssh-agent's socket, or you've ran a network-listening daemon from your account that had an exploitable RCE) you're a little bit more safe if attackers won't get root access. This only works well for noexec $HOME, of course, as attacker can't mess with your .*shrc and trick you into entering the password.
It would take a lot more processes to hit the maximum for the entire system
- Use public key authentication
- Encrypt your private keys
- Check the Host keys
- Use SSH Agent
- Use a different key for every computer
- Disable password authentication
- Do not SSH cross-server
- Use safe algorithms
- Use agent forwarding at appropriate times
- Use SSH certificates
- Use a smartcard
- Remove all system passwords
- Use Two-factor Authentication
[0] https://blog.0xbadc0de.be/archives/300You never knew about sys admins who put "." in the PATH for root? That was one of the warnings that I remember learning back in the early 1990s.
Remember the good old days when someone's .finger could be used for an escape sequence injection? Even if you read the manual for your terminal, that doesn't mean you change all your habits.
Or sys admins using "xhost +" for easy access to other machines in the local network?
And sys admins forgetting to do backups? That's certainly nothing new.