Managed lock settings (phase 2 of #3868)
Feature Description
I’d like admins to enforce lock settings through a root-owned policy file, so user settings and the UI can’t override them. This would be opt-in, with existing defaults unchanged.
Use Case
I use DMS as the locker on machines with declaratively managed configuration and want lock settings enforced. DMS reloads settings.json and config.d while running, but their directory is user-owned, so a read-only file doesn’t enforce its contents.
customPowerActionLock can replace locking with a command. The socket calls loginctl.setLockBeforeSuspend and loginctl.setSleepInhibitorEnabled can disable lock-before-suspend until the shell resyncs on reconnect or a change to lockBeforeSuspend or loginctlLockIntegration.
Compositor(s)
All compositors.
Proposed Solution
I’d add a lock-settings object to cli-policy.json, loaded by core’s clipolicy loader and passed to the shell. An allow-list would cover customPowerActionLock, lockBeforeSuspend, loginctlLockIntegration, lockAtStartup, lock timeouts, fadeToLockEnabled, fadeToLockGracePeriod, and fingerprint and U2F settings.
Malformed policy would fall back to DMS defaults for managed keys and log an error. Managed values would win over settings.json and config.d without being written back to user files. Legacy migration must not override them. Settings would show them as managed, and core would prevent the two socket calls from changing managed behaviour.
This follows #3868 and #3869. I’m happy to send a PR, as with phase 1.
Would you prefer cli-policy.json or a separate file? Does an allow-list make sense? Should lock-screen power actions and widgets be included too?
Alternatives/Existing Solutions
Read-only settings don’t hold when their directory is user-owned. Phase 1’s switches cover IPC set and PAM paths, not enforced values.