mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
nixos/polkit: Add debug option
This commit is contained in:
parent
352ed567a7
commit
a4995b6f0a
@ -14,6 +14,8 @@ in
|
||||
|
||||
security.polkit.enable = mkEnableOption (lib.mdDoc "polkit");
|
||||
|
||||
security.polkit.debug = mkEnableOption (lib.mdDoc "debug logs from polkit. This is required in order to see log messages from rule definitions.");
|
||||
|
||||
security.polkit.extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
@ -21,6 +23,7 @@ in
|
||||
''
|
||||
/* Log authorization checks. */
|
||||
polkit.addRule(function(action, subject) {
|
||||
// Make sure to set { security.polkit.debug = true; } in configuration.nix
|
||||
polkit.log("user " + subject.user + " is attempting action " + action.id + " from PID " + subject.pid);
|
||||
});
|
||||
|
||||
@ -58,6 +61,11 @@ in
|
||||
|
||||
systemd.packages = [ pkgs.polkit.out ];
|
||||
|
||||
systemd.services.polkit.serviceConfig.ExecStart = [
|
||||
""
|
||||
"${pkgs.polkit.out}/lib/polkit-1/polkitd ${optionalString (!cfg.debug) "--no-debug"}"
|
||||
];
|
||||
|
||||
systemd.services.polkit.restartTriggers = [ config.system.path ];
|
||||
systemd.services.polkit.stopIfChanged = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user