2 Commits c9c284622e ... aea06984ae

Autor SHA1 Mensaje Fecha
  theo aea06984ae Changed password generation to a random password and switched to SHA512 so people don't risk getting winched hace 1 año
  theo 6bfd035264 Added dependency list to readme hace 1 año
Se han modificado 2 ficheros con 13 adiciones y 1 borrados
  1. 7 0
      README.md
  2. 6 1
      createperson

+ 7 - 0
README.md

@@ -7,6 +7,13 @@ cp .env.example .env
 
 Then, edit `.env` and set the correct values
 
+# Dependencies
+
++ A working LDAP server
++ slappasswd
++ pwgen
++ ldap{search, modify, delete, add}
+
 # Usage
 
 - 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"