How root access works
The app itself never runs as root. Everything that needs root goes through
a small helper, /usr/lib/simple-update/simple-update-helper, which only
does a fixed set of things. This chapter is for administrators who want to
know what runs with which rights.
The helper#
The helper accepts only a fixed set of verbs, never a command line. The complete list is under Stable interfaces. It works out what to act on itself wherever it can:
- the unused packages to remove, so a caller can't name packages;
- the caches, files and Snap revisions Clean Up removes;
- the configuration files under
/etcit merges; - the firmware devices fwupd offers an update for.
How the helper protects itself is described in SECURITY.md.
How it's started#
- In the window, the helper is started with
pkexec. The polkit actiondev.wolfcloud.simpleupdate.helperusesauth_admin_keep, so you enter your password once per update run. - In the terminal, the helper is started with
sudo.
What runs as you#
The read-only checks run as your user: the upgrade lists, unused packages,
the cache size, and the Flatpak and Snap updates. Flatpak updates also run
as your user, and Flatpak handles system-wide installations through its own
polkit rules. So do the firmware checks, fwupdmgr refresh and
fwupdmgr get-updates.
Checking services#
After an update, the summary lists the services still running replaced
code. The helper's services verb only reads /proc and prints the
affected units, but reading other users' processes needs root.
So that the summary doesn't ask for your password unexpectedly, it checks
services only while your password is still remembered: polkit's cached
authorization in the window, sudo's in the terminal. After an update that
took longer than that, the summary says services weren't checked and offers
to check them anyway: select Check Services… in the window, or answer
yes in the terminal. Either asks for your password again. --yes never
asks; it reports that services weren't checked.
restart-services UNIT... restarts the units you chose. The helper scans
/proc again and restarts (systemctl try-restart) only the named units
that still run replaced code. It refuses the session services that would
end your session or log users out (the display manager in use, D-Bus,
logind, polkit, gettys), so it can't be used to restart, start or stop
anything else. It runs only when you ask for it, so it may ask for your
password again.
Updating without a password#
Writing your own polkit rules against the action
dev.wolfcloud.simpleupdate.helper is supported. For example, to let
members of the admin group update without a password, create
/etc/polkit-1/rules.d/50-simple-update.rules:
polkit.addRule(function(action, subject) {
if (action.id == "dev.wolfcloud.simpleupdate.helper" &&
subject.local && subject.active &&
subject.isInGroup("sudo")) { // "wheel" on Arch
return polkit.Result.YES;
}
});The rule covers only the helper's fixed verbs, never an arbitrary command.
It applies to the window, which uses polkit; terminal mode uses sudo and
its own rules.
View this page's source · Documentation for Simple Update 1.3.2