Add CLI script for hashing LDAP passwords

Only takes a cleartext password and outputs a salted, hashed password
string for LDAP documents.
This commit is contained in:
Basti 2020-11-20 14:36:25 +01:00
parent 9ba364ad7a
commit b63c86b37f
Signed by untrusted user: basti
GPG Key ID: 9F88009D31D99C72
1 changed files with 5 additions and 0 deletions

5
scripts/ldap/hash_pw.sh Executable file
View File

@ -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;