tvl-depot/tools/hash-password.nix
Vincent Ambo 1c6dc510a6 test(tools/hash-password): ensure that script can execute correctly
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>
2022-05-27 23:48:37 +00:00

15 lines
414 B
Nix

# Utility for invoking slappasswd with the correct options for
# creating an ARGON2 password hash.
{ pkgs, ... }:
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
'';
})