Skip to content

Commit

Permalink
Merge pull request #137132 from Ma27/pi-sudo
Browse files Browse the repository at this point in the history
nixos/privacyidea: use `sudo(8)` that's configured via the module
  • Loading branch information
Ma27 authored Sep 12, 2021
2 parents ed77db8 + 69e7575 commit 364b555
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nixos/modules/services/security/privacyidea.nix
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ in
path = with pkgs; [ openssl ];
environment.PRIVACYIDEA_CONFIGFILE = "${cfg.stateDir}/privacyidea.cfg";
preStart = let
pi-manage = "${pkgs.sudo}/bin/sudo -u privacyidea -HE ${penv}/bin/pi-manage";
pi-manage = "${config.security.sudo.package}/bin/sudo -u privacyidea -HE ${penv}/bin/pi-manage";
pgsu = config.services.postgresql.superUser;
psql = config.services.postgresql.package;
in ''
Expand All @@ -239,8 +239,8 @@ in
-i "${piCfgFile}"
chown ${cfg.user}:${cfg.group} ${cfg.stateDir}/privacyidea.cfg
if ! test -e "${cfg.stateDir}/db-created"; then
${pkgs.sudo}/bin/sudo -u ${pgsu} ${psql}/bin/createuser --no-superuser --no-createdb --no-createrole ${cfg.user}
${pkgs.sudo}/bin/sudo -u ${pgsu} ${psql}/bin/createdb --owner ${cfg.user} privacyidea
${config.security.sudo.package}/bin/sudo -u ${pgsu} ${psql}/bin/createuser --no-superuser --no-createdb --no-createrole ${cfg.user}
${config.security.sudo.package}/bin/sudo -u ${pgsu} ${psql}/bin/createdb --owner ${cfg.user} privacyidea
${pi-manage} create_enckey
${pi-manage} create_audit_keys
${pi-manage} createdb
Expand Down

0 comments on commit 364b555

Please sign in to comment.