diff options
author | makefu <github@syntax-fehler.de> | 2021-02-11 14:06:45 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2021-02-11 14:06:45 +0100 |
commit | 540e13721d85dcf100bf3529414d96cd8e28a446 (patch) | |
tree | 7db6b3955f8f06af83434027e4825f8b160ba9d4 /krebs/3modules/shadow.nix | |
parent | 38bddfd404b4418b4e820dfbd312145fc6abca68 (diff) | |
parent | d0e7bc46b4cdb15f7505aa069ac29588b02ddf92 (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs/3modules/shadow.nix')
-rw-r--r-- | krebs/3modules/shadow.nix | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/krebs/3modules/shadow.nix b/krebs/3modules/shadow.nix index cff66492d..9505efb0c 100644 --- a/krebs/3modules/shadow.nix +++ b/krebs/3modules/shadow.nix @@ -4,19 +4,21 @@ with import <stockholm/lib>; cfg = config.krebs.shadow; mergeShadowsJq = pkgs.writeJq "merge-shadows.jq" '' - def fields_3_to_9: ["1", "", "", "", "", "", ""]; + def is_int: . == (. | floor); + def fields_4_to_9: ["", "", "", "", "", ""]; + def check_fields_3_to_9: (.[2] | tonumber | is_int) and .[3:] == fields_4_to_9; def read_value: split(":") | if length == 9 then - if .[2:] == fields_3_to_9 then + if check_fields_3_to_9 then . else error("unrecognized field contents") end elif length == 2 then if .[1] | test("^\\$6\\$") then - . + fields_3_to_9 + . + ["1"] + fields_4_to_9 else error("unrecognized hashed password") end |