parent
b7d5c65902
commit
71c72fe923
|
@ -20,29 +20,37 @@ user_exists() {
|
||||||
$CONTAINER_EXEC samba-tool user show "${username}" > /dev/null 2>&1
|
$CONTAINER_EXEC samba-tool user show "${username}" > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ -f /etc/eole/samba4-vars.conf ];then
|
||||||
|
CONTAINER_EXEC=''
|
||||||
|
elif [ -f /usr/lib/eole/eolead.sh ];then
|
||||||
|
CONTAINER_EXEC='lxc-attach -n addc --'
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
PRIVATE_DIR=/etc/eole/private
|
PRIVATE_DIR=/etc/eole/private
|
||||||
WRITER_PASSWORD_FILE="${PRIVATE_DIR}/eole-workstation-writer.password"
|
WRITER_PASSWORD_FILE="${PRIVATE_DIR}/eole-workstation-writer.password"
|
||||||
if [ ! -s "${WRITER_PASSWORD_FILE}" ]
|
if [ ! -s "${WRITER_PASSWORD_FILE}" ]
|
||||||
then
|
then
|
||||||
pwgen -scn1 42 > "/etc/eole/private/eole-workstation-writer.password"
|
pwgen -scn1 42 > "${WRITER_PASSWORD_FILE}"
|
||||||
fi
|
fi
|
||||||
chmod 700 "/etc/eole/private/eole-workstation-writer.password"
|
chmod 700 "${WRITER_PASSWORD_FILE}"
|
||||||
|
|
||||||
|
WRITER_PASSWORD=$(cat "${WRITER_PASSWORD_FILE}")
|
||||||
if ! user_exists eole-workstation-manager
|
if ! user_exists eole-workstation-writer
|
||||||
then
|
then
|
||||||
echo "Ajout du compte de jonction au domaine 'eole-workstation-manager'... "
|
echo "Ajout du compte de jonction au domaine 'eole-workstation-writer'... "
|
||||||
$CONTAINER_EXEC samba-tool user create --random-password eole-workstation-manager
|
$CONTAINER_EXEC samba-tool user create --random-password eole-workstation-writer
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Mise en conformité de l’utilisateur 'eole-workstation-manager'... "
|
|
||||||
$CONTAINER_EXEC samba-tool user setexpiry eole-workstation-manager --noexpiry
|
|
||||||
if ! $CONTAINER_EXEC samba-tool group listmembers 'Domain Admins' | grep -q '^eole-workstation-manager$'
|
|
||||||
then
|
|
||||||
$CONTAINER_EXEC samba-tool group addmembers 'Domain Admins' eole-workstation-manager
|
|
||||||
fi
|
|
||||||
$CONTAINER_EXEC samba-tool user setpassword eole-workstation-manager --newpassword="${MANAGER_PASSWORD}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Mise en conformité de l’utilisateur 'eole-workstation-writer'... "
|
||||||
|
$CONTAINER_EXEC samba-tool user setexpiry eole-workstation-writer --noexpiry
|
||||||
|
if ! $CONTAINER_EXEC samba-tool group listmembers 'Domain Admins' | grep -q '^eole-workstation-manager$'
|
||||||
|
then
|
||||||
|
$CONTAINER_EXEC samba-tool group addmembers 'Domain Admins' eole-workstation-manager
|
||||||
|
fi
|
||||||
|
$CONTAINER_EXEC samba-tool user setpassword eole-workstation-writer --newpassword="${WRITER_PASSWORD}"
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue