Currently the installation instructions simply say to add the ghost install account to the sudoers group by running usermod -aG sudo <user>. This obviously works fine, but assuming you’ve already got a go-to administration account on the server, this step grants the ghost install account far more potential privileges than are necessary. It also creates a server-wide security problem if the ghost install user’s password is ever compromised, since the attacker would have access to an account that effectively has full root privileges.
It would be considerably safer and more optimal to correctly define what commands the ghost user should be able to invoke via sudo, by using visudo (or whatever other preferred method for editing /etc/sudoers) and explicitly defining a privilege specification.
Do you guys happen to have a list of what the ghost install user should be able to run in an escalated context? I can gen up the correct sudoers line from it if you’d like.
I have the funny feeling that it is a long list; apparently, the ghost-cli has features to install the systemd service file, configure nginx and other items. This has been one of my major beefs with the new setup; I can understand why it was done for some additional functionality to assist with configuration and setup, but I do agree that it is security risk.
I have found it best to just lock the ghost install account. passwd -l <account name> should work, and ensure that there are not any authorized_keys mentioned in the ~/.ssh/ directory.
It’s definitely an improvement over the pre-1.0 situation, but on the other hand it’s another disappointing choice in a long list of disappointing choices over the past four years—some of which were eventually rectified, and some of which were not. I have high hopes this issue will eventually wind up in the former category.
(For now, I’m dealing with it not by locking, but by forcing 2FA authentication on it the same as I do with any other privileged account. At least that way I’ll know if it’s compromised and someone is trying to access it, though locking is probably the better idea.)
99% of the commands run with sudo use a sudo proxy method. I might have a chance to clean up this list later today, but here is the list of sudo commands that are run:
That’s not too nuts—though if we’re allowing rm, ln, useradd, chown, and systemctl to be run under root context then it’s almost not worth bothering with granularity at that point.