about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-07-01T20·29+0100
committertazjin <mail@tazj.in>2020-07-01T20·39+0000
commit29984bb6f909551b1951196757d99792a2570450 (patch)
treeac47794999907ed980d7ca402ef41de4130848c5
parenta1556d71e6cc1f49a4f7e78c058f69daad02fcc0 (diff)
feat(tools/hash-password): Add a wrapper script for slappasswd r/1151
This wrapper script correctly invokes slappasswd for generating ARGON2
hashes.

People without Nix will need to figure this out on their own.

Change-Id: I264715ba4932855b868bef70cc9102515b3d129e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/833
Tested-by: BuildkiteCI
Reviewed-by: BuildkiteCI
Reviewed-by: Kane York <rikingcoding@gmail.com>
-rwxr-xr-xbin/__dispatch.sh3
l---------bin/hash-password1
-rw-r--r--tools/hash-password.nix7
3 files changed, 11 insertions, 0 deletions
diff --git a/bin/__dispatch.sh b/bin/__dispatch.sh
index ad559fe962..ce10f13370 100755
--- a/bin/__dispatch.sh
+++ b/bin/__dispatch.sh
@@ -49,6 +49,9 @@ case "${TARGET_TOOL}" in
   gerrit)
     attr="tools.gerrit-cli"
     ;;
+  hash-password)
+    attr="tools.hash-password"
+    ;;
   *)
     echo "The tool '${TARGET_TOOL}' is currently not installed in this repository."
     exit 1
diff --git a/bin/hash-password b/bin/hash-password
new file mode 120000
index 0000000000..8390ec9c96
--- /dev/null
+++ b/bin/hash-password
@@ -0,0 +1 @@
+__dispatch.sh
\ No newline at end of file
diff --git a/tools/hash-password.nix b/tools/hash-password.nix
new file mode 100644
index 0000000000..9893d52178
--- /dev/null
+++ b/tools/hash-password.nix
@@ -0,0 +1,7 @@
+# Utility for invoking slappasswd with the correct options for
+# creating an ARGON2 password hash.
+{ pkgs, ... }:
+
+pkgs.writeShellScriptBin "hash-password" ''
+  ${pkgs.openldap}/bin/slappasswd -o module-load=pw-argon2 -h '{ARGON2}'
+''