Browse Source

Changed password generation to a random password and switched to SHA512 so people don't risk getting winched

theo 1 year ago
parent
commit
aea06984ae
1 changed files with 6 additions and 1 deletions
  1. 6 1
      createperson

+ 6 - 1
createperson

@@ -28,7 +28,9 @@ while getopts 'u:n:s:p?g:?' opt; do
   esac
 done
 
-pw=$(/usr/sbin/slappasswd -s "salut$uid")
+clearpw=$(pwgen 50 1)
+pw=$(/usr/sbin/slappasswd -o module-load=pw-sha2 -h '{SSHA512}' -s "$clearpw")
+
 
 if user_exists $uid; then
     echo "User $uid already exists." 
@@ -49,3 +51,6 @@ echo "$user" | ldapadd $LDAPOPTS
 [ -n "$posix" ] && echo posix &&  ./person2posix $uid
 
 [ -n "$grouplist" ] && echo groups && ./addtogroups $uid $grouplist
+
+echo "User $uid created, here is their password :"
+echo "$clearpw"