Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change distinguished name format in OpenLDAP

i have the following problem: i have installed and OpenLDAP server in which in the people/users tree the distinguished name have the following format:

Distinguished Name: cn=Luigi Rossi,ou=people,dc=prisma,dc=local

The problem is i wish to replace it using the uid (a.k.a. the account username) instead of the CN in order to have something like this

Distinguished Name: uid=lrossi,ou=people,dc=prisma,dc=local

I need this because i'm configuring ldap authentication for Alfresco Community 4.0.d and it need the username

ldap.authentication.userNameFormat=uid=%s,ou=people,dc=prisma,dc=local

Any help?

like image 928
Indio Avatar asked Dec 12 '22 02:12

Indio


2 Answers

It's an old post but I ran into this myself. The answer was actually pretty simple. If you're using phpldapadmin to create accounts, you need to edit the posixAccount template. Look for the <rdn></rdn> tags. Replace the cn with uid and save. Your accounts will now be created with a DN in the "uid=%s,dc=example,dc=com" form instead of "cn=%s,dc=example,dc=com"

http://phpldapadmin.sourceforge.net/wiki/index.php/Templates#Template_Header_Configuration

like image 194
SirDice Avatar answered Feb 08 '23 00:02

SirDice


Use the modify DN LDAP request (in this case using the legacy OpenLDAP ldapmodify tool):

The uid attribute may need to be added:

ldapmodify -h host -p port -D bind-dn -w password <<!
dn: cn=Luigi Rossi,ou=people,dc=prisma,dc=local
changetype: modify
add: uid
uid: lrossi
!

ldapmodify -h host -p port -D bind-dn -w password <<!
dn: cn=Luigi Rossi,ou=people,dc=prisma,dc=local
changetype: moddn
newrdn: uid=lrossi,ou=people,dc=prisma,dc=local
deleteoldrdn: 1
!

see also

  • LDAP: modify DN
like image 43
Terry Gardner Avatar answered Feb 08 '23 00:02

Terry Gardner