mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
ldap: Switch to SASL authentication.
Assume that root is able to modify user directory entries.
This commit is contained in:
parent
73a03c3b39
commit
3a3009c111
@ -21,7 +21,7 @@
|
||||
username="$1"
|
||||
password="$2"
|
||||
|
||||
cat <<EOF |ldapmodify -x -D 'cn=admin,dc=thisbox' -w $(cat /var/lib/plinth/ldap-admin)
|
||||
cat <<EOF |ldapmodify -Y EXTERNAL -H ldapi:///
|
||||
dn: uid=$username,ou=users,dc=thisbox
|
||||
changetype: modify
|
||||
replace: userPassword
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
username="$1"
|
||||
|
||||
results=$(ldapsearch -x -D 'cn=admin,dc=thisbox' -w $(cat /var/lib/plinth/ldap-admin) -b 'ou=users,dc=thisbox' -LLL "(uid=$username)" uid)
|
||||
results=$(ldapsearch -Y EXTERNAL -H ldapi:/// -b 'ou=users,dc=thisbox' -LLL "(uid=$username)" uid)
|
||||
|
||||
if [ -z "$results" ]; then
|
||||
echo "User does not exist"
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
username="$1"
|
||||
password="$2"
|
||||
|
||||
cat <<EOF |ldapadd -x -D 'cn=admin,dc=thisbox' -w $(cat /var/lib/plinth/ldap-admin)
|
||||
cat <<EOF |ldapadd -Y EXTERNAL -H ldapi:///
|
||||
dn: uid=$username,ou=users,dc=thisbox
|
||||
objectClass: inetOrgPerson
|
||||
uid: $username
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
username="$1"
|
||||
|
||||
ldapdelete -x -D 'cn=admin,dc=thisbox' -w $(cat /var/lib/plinth/ldap-admin) "uid=$username,ou=users,dc=thisbox"
|
||||
ldapdelete -Y EXTERNAL -H ldapi:/// "uid=$username,ou=users,dc=thisbox"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Success: user deleted"
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
old_username="$1"
|
||||
new_username="$2"
|
||||
|
||||
cat <<EOF |ldapmodify -x -D 'cn=admin,dc=thisbox' -w $(cat /var/lib/plinth/ldap-admin)
|
||||
cat <<EOF |ldapmodify -Y EXTERNAL -H ldapi:///
|
||||
dn: uid=$old_username,ou=users,dc=thisbox
|
||||
changetype: modrdn
|
||||
newrdn: uid=$new_username
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user