about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-05-27T22·58+0200
committerclbot <clbot@tvl.fyi>2022-05-27T23·48+0000
commit1c6dc510a6136defcef997697a7a6eda498e9930 (patch)
tree2f3042236f6207fcc6f9a72a1f5f043c84dd545d /tools
parentdeb8796cc5237ef856463c0b6d02212c6ca5249e (diff)
test(tools/hash-password): ensure that script can execute correctly r/4163
This tests loading of the argon2 OpenLDAP module. Relates to b/184

Change-Id: I661af4ddc238ad02d082b3a0cede55af5ef13f1b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5750
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/hash-password.nix14
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/hash-password.nix b/tools/hash-password.nix
index 9893d521787e..6192436c17b9 100644
--- a/tools/hash-password.nix
+++ b/tools/hash-password.nix
@@ -2,6 +2,14 @@
 # creating an ARGON2 password hash.
 { pkgs, ... }:
 
-pkgs.writeShellScriptBin "hash-password" ''
-  ${pkgs.openldap}/bin/slappasswd -o module-load=pw-argon2 -h '{ARGON2}'
-''
+let
+  script = pkgs.writeShellScriptBin "hash-password" ''
+    ${pkgs.openldap}/bin/slappasswd -o module-load=argon2 -h '{ARGON2}' "$@"
+  '';
+in
+script.overrideAttrs (old: {
+  doCheck = true;
+  checkPhase = ''
+    ${pkgs.stdenv.shell} $out/bin/hash-password -s example-password > /dev/null
+  '';
+})