Tech:Ldap
Miraheze uses ldap as an authentication system for some of our infrastructure, such as Grafana and Icingaweb2.
You can use ldapvi
to modify a user, add a user, or change the roles the user has. You can also use https://ldapwiki.miraheze.org to change your password.
You can find the ldap password in /etc/ldapvi.conf. All these steps have to be done using ldap171.wikitide.net.
Terminology:
cn = Common Name
sn = Surname
UID = username you’ll login with
givenName = First Name
Add New User
- Add the following to a file named user.ldif:
The ‘uid’ attribute is equal to the username you are using. It is recommended to set the ‘cn’ attribute equal to the contents of ‘uid’. ‘givenName’ is usually your first name, while ‘sn’ is your surname.
You cannot directly put your password in this ldif file, instead you need to generate a hash through sudo -i slappasswd
.
- Run
ldapadd -x -D cn=write-user,dc=miraheze,dc=org -W -f user.ldif
.
Add New Group
- Add the following to group.ldif
- Run
ldapadd -x -W -D "cn=write-user,dc=miraheze,dc=org" -f group.ldif
Add User to existing group
- Create the following in add_member.ldif
- Run
ldapmodify -x -W -D "cn=write-user,dc=miraheze,dc=org" -f add_member.ldif
Alternatively you can do:
Run
modify-ldap-group <group>
.Add
member
with valueuid=<user_uid>,ou=people,dc=miraheze,dc=org
. Must be one per line.
Modify user field
- Add the following to modify.ldif (note you can add and delete):
- Run
sudo ldapmodify -x -D cn=write-user,dc=miraheze,dc=org -W -f modify.ldif
Modify Existing User
Run
modify-ldap-user <user>
on the ldap server (so ldap171.wikitide.net).Change the bit you want and save.
Modify Existing Group
Run
modify-ldap-group <group>
on the ldap server (so ldap171.wikitide.net).Change the bit you want and save.
Change User Password
Run
slappasswd
.Run
ldapvi
on the ldap server (so ldap171.wikitide.net).Locate the user you want to change and then locate the password field.
(Use the {SSHA} you got from the previous step).
- Save.
Change admin password
To change the admin password do the following:
Run
slappasswd
Run the following:
- Run
ldappasswd -x -D cn=admin,dc=miraheze,dc=org -W -S
(Don’t forget to change the password in the private puppet repo too)
Adding base dn
- Add the following to a .ldif file
- Run
sudo ldapadd -x -D cn=admin,dc=miraheze,dc=org -W -f basedn.ldif
(The password can be found in the private puppet repo)
Deleting user or group
To delete a user do the following:
- Run
ldapdelete -W -D "cn=write-user,dc=miraheze,dc=org" "uid=<user uid>,ou=people,dc=miraheze,dc=org"
.
To delete a group do the follow:
- Run
ldapdelete -W -D "cn=write-user,dc=miraheze,dc=org" "cn=<group name>,ou=people,dc=miraheze,dc=org"
.
LDAP Index
- Add the following to index.ldif:
- Run
ldapmodify -Y EXTERNAL -H ldapi:/// -f ./index.ldif
Existing LDAP groups
Note: Non-exhaustive list
Monitoring
LDAP can be monitored via Grafana by accessing this link.