polkit - aaronwmorris/indi-allsky GitHub Wiki
PolicyKit (Polkit) Configuration
indi-allsky operates as an unprivileged service user (indi-allsky) for security. To perform system-level management tasks from the web interface—such as rebooting, shutting down, restarting systemd services, synchronizing time, managing network interfaces, and mounting external storage—the system relies on PolicyKit rules.
Polkit Rule Specification
On standard systemd distributions (Debian, Ubuntu, Raspberry Pi OS), rules are installed to:
/etc/polkit-1/rules.d/90-indi-allsky.rules
The installed rule grants the indi-allsky service account explicit authorization for five functional categories:
- System Power Management (
org.freedesktop.login1):power-off/power-off-multiple-sessionsreboot/reboot-multiple-sessions
- Service Management (
org.freedesktop.systemd1):manage-unitsmanage-unit-filesreload-daemon
- Time Synchronization (
org.freedesktop.timedate1):set-timeset-timezoneset-ntp
- Network Configuration (
org.freedesktop.NetworkManager):network-controlsettings.modify.system/settings.modify.ownwifi.scan/enable-disable-wifi/wifi.share.protected
- Storage Mounting (
org.freedesktop.udisks2):filesystem-mount/filesystem-mount-systempower-off-drive/eject-media/filesystem-unmount-others
Verification & Diagnostic Commands
Enumerate Installed Polkit Actions
To verify which system actions are registered with the PolicyKit daemon:
pkaction
Inspect Details for a Specific Action
pkaction -v --action-id org.freedesktop.login1.reboot
Test User Authorization
Simulate an authorization request for the service user without executing the command:
# Check if the current shell process is authorized to trigger a reboot
pkcheck -p "$PPID" -a org.freedesktop.login1.reboot
# Exit code 0 indicates authorization is granted; non-zero indicates denial
echo $?
Restart the PolicyKit Daemon
If modifying rules manually:
sudo systemctl restart polkit