2018-04-01 21:37:44 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-04-25 16:43:16 +02:00
|
|
|
if ! [ 1 -eq $# ]
|
2018-04-01 21:37:44 +02:00
|
|
|
then
|
|
|
|
echo "Usage: $0 \$userdn" >&2
|
|
|
|
echo "random password will be printed. Use ldappasswd for changing it" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
user="$1"
|
2018-04-25 16:43:16 +02:00
|
|
|
pw=`pwgen 12 1`
|
2018-04-01 21:37:44 +02:00
|
|
|
echo "# Password: $pw" >&2
|
|
|
|
|
|
|
|
cat <<EOF
|
|
|
|
dn: $1
|
|
|
|
changeType: modify
|
|
|
|
replace: userPassword
|
2018-04-25 16:43:16 +02:00
|
|
|
userPassword:: `echo "$pw" | base64 -w0`
|
2018-04-01 21:37:44 +02:00
|
|
|
EOF
|
|
|
|
|
2018-04-25 16:43:16 +02:00
|
|
|
#userPassword:: `/usr/sbin/slappasswd -h '{CRYPT}' -c '$5$rounds=8000$%.16s$' -s "$pw" | base64 -w0`
|