From b63c86b37f5fcb274dad55221406ffe974743223 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Fri, 20 Nov 2020 14:36:25 +0100 Subject: [PATCH] Add CLI script for hashing LDAP passwords Only takes a cleartext password and outputs a salted, hashed password string for LDAP documents. --- scripts/ldap/hash_pw.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 scripts/ldap/hash_pw.sh diff --git a/scripts/ldap/hash_pw.sh b/scripts/ldap/hash_pw.sh new file mode 100755 index 0000000..327f16d --- /dev/null +++ b/scripts/ldap/hash_pw.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +password=$(ruby -r base64 -r digest -r securerandom -e "salt = SecureRandom.hex(32); password = '$1'; puts '{SSHA512}' + Base64.strict_encode64(Digest::SHA512.digest(password + salt) + salt)"); + +echo $password;