2024-07-04 20:32:09 -05:00

23 lines
879 B
Bash
Executable File

#!/bin/sh
name=$1
shift 1
ssh root@dev.cavemanon.xyz "dsidm -b dc=dev,dc=cavemanon,dc=xyz cavemanon user create --uid $name --cn $name --displayName $name --uidNumber -1 --gidNumber -1 --homeDirectory /home/$name"
for group in "$@"
do
ssh root@dev.cavemanon.xyz "dsidm cavemanon group add_member $group uid=$name,ou=people,dc=dev,dc=cavemanon,dc=xyz"
done
password=$(openssl rand -hex 16)
ssh root@dev.cavemanon.xyz "dsidm cavemanon account reset_password uid=$name,ou=people,dc=dev,dc=cavemanon,dc=xyz $password"
ssh root@dev.cavemanon.xyz "dsidm cavemanon account modify-by-dn uid=$name,ou=people,dc=dev,dc=cavemanon,dc=xyz add:mail:$name@cavemanon.xyz"
printf "
Landing Page: cloud.dev.cavemanon.xyz \n
Username: %s \n
Email: %s@cavemanon.xyz \n
Password: %s \n
You can reset your password at auth.dev.cavemanon.xyz \n
" "$name" "$name" "$password" > /tmp/"$name".txt