This repository has been archived by the owner on Sep 22, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the original visudo example in
algorand@.service
:This is pretty bad. I've tested this, and the wildcard lets me interact with ANY systemd service (with start, stop, restart, and status) as the
algo
user without a password. I also did NOT add thealgo
user to the sudoers file (asalgo ALL=(ALL) ALL
, or addingalgo
to thewheel
group ). I was able to stop and startip6tables.service
withsudo /usr/bin/systemctl stop ip6tables
andsudo /usr/bin/systemctl start ip6tables
respectively. Note that you have to usesudo /usr/bin/systemctl
and not justsudo systemctl
. The former is marginally better than the latter.The following is more secure:
You'll still get the wildcard behavior that's needed for user specified directories to work properly with the systemd service. However, it's restricted to the systemd service you needed wildcard'ed in the first place. The
algo
user is going to need to be in the sudoers file and use a password for any other service.Comparing it to a firewall, it's the difference between opening all ports, vs. just the ones that need opened for a particular task.