-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an example how to run ddupdate under an unprivileged systemd user #65
Comments
At a glance: is the temporary systemd user solving any problem here? I understand that this is extremely useful for typical "system" services which runs with all sort of privileges managing a central configuration typically in /etc. However, ddupdate is running as systemd user service. This means that that this A service that need to write to files outside of /run/, /var/lib/, /var/cache/, /var/log/, /var/tmp, /tmp, /dev/shm are generally incompatible with this scheme. This rules out daemons that upgrade the system as one example, as that involves writing to /usr ddupdate reads and writes files under invoking user's $HOME, so... OTOH, since we run as a regular user this solves many security problems. It also simplifies configuration, since nothing is done as root. Unless, of course, we start using /etc/netrc. However, this is deprecated for the same reasons: it requires using root access. Also note that /etc/netrc is not part of the official setup (see the manpage). OTOH, systemd credentials seems promising, it should be a fine replacement for current keyring storage for unattended use. Since I'm on Fedora I actually have 250 on my boxes. When there is time, I will look into this |
The problem this is solving is reducing privileges But perhaps my use-case is an uncommon one. |
Probably, yes. EDIT: But interesting! |
FWIW I also have a NetworkManager hook in #!/bin/sh
set -e
IFACE="$1"
ACTION="$2"
case "$ACTION" in
dhcp6-change|dhcp4-change)
systemctl --no-ask-password start ddupdate.service
;;
*) ;;
esac |
hm... that's a good one! Could you perhaps make it to a script in the dispatcher.d directory and make a PR? One or two lines of comments in the beginning should be documentation enough. Also, if you have time and motivation: could you update the ddupdate.8 manpage with a section on the new NETRC environment variable? Missed that when I merged... |
Gladly 😊 |
If you do, you need to convert the script to use EDIT: Or make it two scripts, one the one you have and one using |
Now I'm trying out a slightly different approach:
I'll let you know how it works. |
Recent versions support running services under
DynamicUser
, see https://0pointer.net/blog/dynamic-users-with-systemd.htmlBelow is my working example of such a set-up. I'm not sure if it makes sense to include it in the project as it is, or just keep it somewhere as an example.
Since version 250 systemd also has explicit support for passing credentials (https://systemd.io/CREDENTIALS/), but I don't use recent enough version to be able to use it (and so I suppose many other users are in a similar situation).
The text was updated successfully, but these errors were encountered: