News for hackers. Stuff that matters.
Re:/bin/false is not security (2005) by fiddlerwoaroof on Thursday December 28, 2017 @05:37PM (#16025644)
I don’t really see the benefit of disabling root logon vs. allowing user login + sudo to root, if you only allow login via keypairs. This seems to me to be one of those cases where there might be some theoretical benefits, but those benefits don’t matter in practice.

Edit: I see several other people posted this while I was typing :)

Re:/bin/false is not security (2005) by emsy on Thursday December 28, 2017 @06:33PM (#16026076)
I configured it so I can only sudo with my password. So even if someone gets hold of my private key, they'd have to guess my password for sudo access. Also, as someone pointed out you can restrict sudo commands, which is the sensible thing to do.
Re:/bin/false is not security (2005) by icebraining on Friday December 29, 2017 @01:51AM (#16028086)
they'd have to guess my password for sudo access.

SSH to your account, add an alias to sudo in .bashrc (or equivalent for your shell) that records the password in a hidden file before passing it to the real sudo.

Re:/bin/false is not security (2005) by zrth on Friday December 29, 2017 @05:08AM (#16028678)
Is there a practical way to prevent this kind of attack? Also, what the name for this class of exploitation so I can read more?
Re:/bin/false is not security (2005) by icebraining on Friday December 29, 2017 @06:37AM (#16028969)
I'm not security pro, but I think the best way is to use a separate account that you'd login to directly (on the physical TTY or via SSH) just to run the root commands. Going through your regular account is always more dangerous if you assume it might be compromised.

By the way, this is why Microsoft invented the UAC prompt: rather than a password, which can be intercepted, it generates a window which (presumably) cannot, thanks to User Interface Privilege Isolation.

Re:/bin/false is not security (2005) by daimrod on Friday December 29, 2017 @06:06AM (#16028851)
Use the absolute path to any */sbin utilities :-)
Re:/bin/false is not security (2005) by jwilk on Friday December 29, 2017 @06:51AM (#16029016)
Doesn't help much. Once the attacker took over the account, nothing you do or see can be assumed to be real.

For example, the attacker could inject a LD_PRELOAD library that redirects execve() calls from /usr/bin/sudo to a fake version of sudo.

Re:/bin/false is not security (2005) by icebraining on Friday December 29, 2017 @07:07AM (#16029065)
You can't LD_PRELOAD on a SUID binary like sudo. That said, I agree with your main point - one should use a different account altogether.
Re:/bin/false is not security (2005) by jwilk on Friday December 29, 2017 @07:25AM (#16029130)
I meant preloading it in the shell. The real /usr/bin/sudo would be never executed, so it wouldn't matter if it's suid or not.
Re:/bin/false is not security (2005) by icebraining on Friday December 29, 2017 @08:18AM (#16029319)
How can you preload in the shell? Isn't it launched by sshd, which you can't configure?
Re:/bin/false is not security (2005) by jwilk on Friday December 29, 2017 @10:52AM (#16030025)
You can't configure which shell is run, but you can usually configure the shell (in ~/.profile or a similar file).

Or, if the server is running Debian, you can set environment variables the .pam_environment file:

https://bugs.debian.org/761600

Re:/bin/false is not security (2005) by icebraining on Friday December 29, 2017 @01:03PM (#16030795)
I don't think .profile runs before the shell is spawned, does it?

The .pam_environment one is interesting, thanks for the link.

Re:/bin/false is not security (2005) by lvh on Saturday December 30, 2017 @09:28AM (#16035343)
You can still exec into a new shell, for example.
Re:/bin/false is not security (2005) by andoriyu on Thursday December 28, 2017 @09:04PM (#16026949)
Well, let me explain to you it then.

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.