Polkit: Difference between revisions
Update syntax for example systemd unit |
Show how to do authorization request debugging |
||
| (One intermediate revision by one other user not shown) | |||
| Line 52: | Line 52: | ||
(This does ''not'' take into account the <code>security.polkit.adminIdentities</code> setting.) | (This does ''not'' take into account the <code>security.polkit.adminIdentities</code> setting.) | ||
=== Debugging requested rules === | |||
To have Polkit print debug information for every incoming authorization, it is possible to create a debugging rule and enable Polkit debug printing: | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
security.polkit = { | |||
debug = true; // Enables `polkit.log` function | |||
extraConfig = '' | |||
polkit.addRule(function(action, subject) { | |||
polkit.log(""); | |||
polkit.log("action=" + action); | |||
polkit.log("subject=" + subject); | |||
}); | |||
''; | |||
}; | |||
</nowiki>}} | |||
== Authentication agents == | == Authentication agents == | ||
| Line 61: | Line 78: | ||
Alternatively, you can start it on login by creating a systemd user service: | Alternatively, you can start it on login by creating a systemd user service: | ||
=== Using NixOS === | |||
<syntaxhighlight lang="nix"> | |||
systemd.user.services.polkit-gnome-authentication-agent-1 = { | |||
description = "polkit-gnome-authentication-agent-1"; | |||
wantedBy = [ "graphical-session.target" ]; | |||
wants = [ "graphical-session.target" ]; | |||
after = [ "graphical-session.target" ]; | |||
serviceConfig = { | |||
Type = "simple"; | |||
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; | |||
Restart = "on-failure"; | |||
RestartSec = 1; | |||
TimeoutStopSec = 10; | |||
}; | |||
}; | |||
</syntaxhighlight> | |||
=== Using Home Manager === | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
systemd.user.services.polkit-gnome-authentication-agent-1 = { | systemd.user.services.polkit-gnome-authentication-agent-1 = { | ||
| Line 79: | Line 114: | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight>Another option is <code>lxqt.lxqt-policykit</code>, which can be launched on login through the command <code>lxqt-policykit-agent</code> on e.g. Hyprland. | ||
Another option is <code>lxqt.lxqt-policykit</code>, which can be launched on login through the command <code>lxqt-policykit-agent</code> on e.g. Hyprland. | |||
== Start the authentication agent in dwm == | == Start the authentication agent in dwm == | ||