Attempt to fix some random bugs
This commit is contained in:
parent
293dbdab94
commit
ac1c6adc75
1 changed files with 9 additions and 2 deletions
|
@ -15,14 +15,21 @@ let
|
||||||
pkgs.uutils-coreutils-noprefix
|
pkgs.uutils-coreutils-noprefix
|
||||||
];
|
];
|
||||||
text = ''
|
text = ''
|
||||||
|
owner_id="$(stat -c "%u" /run/unix-users/khs)"
|
||||||
|
group_id="$(stat -c "%g" /run/unix-users/khs)"
|
||||||
|
|
||||||
|
if [[ "$owner_id" != "0" || "$group_id" != "0" ]]; then
|
||||||
|
>&2 echo "Not setting password due to bad ownership"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
hashed_passwd="$(cat /run/unix-users/khs)"
|
hashed_passwd="$(cat /run/unix-users/khs)"
|
||||||
usermod --password "$hashed_passwd" khs
|
usermod --password "$hashed_passwd" khs
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf (cfg.enable && (userExists "khs")) {
|
||||||
khscodes.infrastructure.vault-server-approle.policy = lib.mkIf (userExists "khs") {
|
khscodes.infrastructure.vault-server-approle.policy = {
|
||||||
"unix-users/data/khs/password" = {
|
"unix-users/data/khs/password" = {
|
||||||
capabilities = [ "read" ];
|
capabilities = [ "read" ];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue