no global superior knowledge error upon adding new entry (change suffix?) - ldap

Openldap 2.4.31 is installed on Ubuntu 14.04.
When I try to add the first entry to the LDAP, it says:
adding new entry "dc=abc,dc=com"
ldap_add: Server is unwilling to perform (53)
additional info: no global superior knowledge
This is the command I use in CLI:
ldapadd -Y EXTERNAL -H ldapi:// -f import-org.ldif
From various blogs I understood that this happens because the the new entry with dn dc=abc,dc=com cannot be added to the LDAP with suffix dc=xyz,dc=com.
Installation process defines the LDAP suffix without prompting to set a custom one.
I read a bunch of manuals and blogs and failed to find any document that describes how to change or add a new suffix or any other way to solve the issue in this version of openldap.

You need to add the new Suffix.
This example assumes that dc=example,dc=com exisits and you desire to add dc=example,dc=net
You can do this via LDIF with Something like:
# add example.net to an existing LDAP server
version: 1
dn: dc=example,dc=net
dc: example
description: Example Network Operations
objectClass: dcObject
objectClass: organization
o: Example, Inc.
dn: ou=people, dc=example,dc=net
ou: people
description: All people in organisation
objectClass: organizationalUnit
Than add the entry as desired under the new suffix.

Related

How to add to openLDAP user objectClass

I have to clone data between two openLDAP servers. I obtain LDIF from source but I have a problem with import. I have error like
root#dc:/etc/ldap/schema# ldapadd -Y external -H ldapi:/// -f /tmp/export.ldif
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
adding new entry "cn=Tomasz Topolski,ou=Pracownicy,dc=tropico,dc=local"
ldap_add: Invalid syntax (21)
additional info: objectClass: value #3 invalid per syntax
After googling I saw that problem is with 4th objectClass (because it start counting from 0), so i check and 4th objectClass in my exported ldif is
objectClass: user
And main question is. How to add this objectClass to my LDAP ?
If you are looking for migrating all configs, can use slapcat with "-n 0" as parameter to export the all configs including schema. Then, can add the schema first and then data.
But, if only this particular objectclass "user" is needed, then can follow below steps
Create a file user.schema with contents same as the source OPENLDAP user objectclass definition.
Create conf file user.conf
include ~/user.schema
Create a directory and run below commands
mkdir userdir
slaptest -f user.conf -F userdir
The resulting file in userdir can be used to add to schema
service slapd stop
slapadd -l -n 0
service slapd start

Error 50 (Insufficient Access Rights) when applying LDIF - OpenLDAP

I'm trying to apply a config through a LDIF file. I'm binding as admin on my LDAPs server and I'm getting the following Error Message:
LDAP: Error 50 - Insufficient Access Rights
I'm binding as admin and I'm able to perform any query or any changes like creating a new entry, modifying an existing one, etc.
I don't know what else to do since I'm already binding as admin. Besides, I even built a brand new LDAP server only to test this and I'm unable to apply any LDIF files as well.
I'm using the Apache Directory Studio LDIF Editor tool to push the LDIF file, which is the following:
dn: olcDatabase={1}hdb,cn=config
changetype: modify
add: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange
by cn=replicator,ou=Users,dc=example,dc=com write
-
add: olcDbIndex
olcDbIndex: entryUUID eq
-
add: olcDbIndex
olcDbIndex: entryCSN eq
dn: cn=module{0},cn=config
changetype: modify
add: olcModuleLoad
olcModuleLoad: {1}syncprov
dn: olcOverlay=syncprov,olcDatabase={1}hdb,cn=config
changetype: add
objectClass: olcOverlayConfig
objectClass: olcSyncProvConfig
olcOverlay: {0}syncprov
olcSpCheckpoint: 100 10
olcSpSessionlog: 100
Could someone please help me with this issue? I've read a lot of articles with no success so far.
It's as expected in my comment above: If you connect as cn=admin,dc=yourdomain,dc=tld to your LDAP server, you connect as admin of your specific LDAP database (which is just one database within your LDAP server).
So you have to create another connection to your LDAP server with user cn=config and your LDAP admin password:
In case you don't know or forgot your LDAP password, take a look on how to view or modify it.
Alternatively, import LDIFs from the command line:
ldapadd -Q -Y EXTERNAL -H ldapi:/// -W -f file.ldif

How to copy OpenLDAP from SuSE to Debian Server?

I have to move an existing openldap installation from a SuSE Enterprise Server to an debian 7.8 server.
I have root access on both machines, and on the debian side I have a clean installation of slapd.
Just moving the /etc/openldap/* and /var/lib/ldap/* files from SuSE to /etc/ldap/ and /var/lib/slapd/ on the debian machine has had no success. Starting slapd on debian resulted in crc-checksum errors afterwards.
Is there any tutorial or good documentation online, where I can see, what steps I have to do?
I have to admit, that I have nearly no experience with openldap at all.
So, any help would be appreciated!
This is the failing entry:
dn: uid=TEST,ou=MyOU,dc=mydomain,dc=de
sn: test
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: top
objectClass: kvzXXX
objectClass: xxxExtended
xxxServiceType: MYWEBSERVICE_1_0
uid: TEST
xxxSOAPUrl: http://... entry
labeledURI: http://...
xxxSOAP: FALSE
cn: mydomain
displayName: Test
xxxSOAPCertificate;binary:: BASE64
xxxServiceName: TestService
structuralObjectClass: inetOrgPerson
entryUUID: ...
creatorsName: cn=admin,dc=mydomain,dc=de
createTimestamp: 20130311105718Z
xxxSOAPBackendUrl: http://...
Thanks for your help!
It seems, that I've got a solution for my problem.
I have found some schema files on the source server, that looked very individual.
Because I was not able to load them with ldapadd, I switched the destination server from online configuration to offline configuration using slapd.conf. Then I was able to load the schemas and afterwards to import the database.

Phpldapadmin does not work for an unknown reason

I'm trying to install LDAP. I've installed slapd and the PhpLDAPAdmin tool on Debian, but when I'm logged in, I cannot do anything. Despite I've logged in as 'cn=admin,dc=barbucha', I see on the right side instead of the tree:
Logged in as: dc=example,dc=com
This base cannot be created with PLA.
I tried Google, but this error seems to be a rare one. I've created a database there is the 'cn=admin,dc=barbucha' in. (Otherwise I could not use the name to log in.)
This happens quite rarely. From an unknown reason the configuring process didn't get data from the LDAP server and didn't set proper values in the /etc/phpldapadmin/config.php script. Somewhere near by line 300 were two important lines generated erroneously:
$servers->setValue('server','base',array('dc=example,dc=com'));
$servers->setValue('login','bind_id','cn=admin,dc=example,dc=com');
These settings uses PhpLDAPAdmin to access LDAP datatase regardless to the login name you've been logged in with. To update these lines helped:
$servers->setValue('server','base',array('dc=barbucha'));
$servers->setValue('login','bind_id','cn=admin,dc=barbucha');
probably you should add a LDAP root first:
create a file in /etc/openldap/
vim /etc/openldap/base.ldif
then input:
dn: dc=em,dc=com
o: RDCenter
objectclass: dcobject
objectclass: organization
and run this command in the directory:
ldapadd -f base.ldif -x -D cn=Admin,dc=em,dc=com -W
Input your own password,and the root node would be added.
Reopen the phpldapadmin,you will find everything is well

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?
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
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
How to do this per object (not changing the format globally) in phpLDAPadmin:
click on the object in the hierarchy on the left to show up on the right
the title of the object is shown as: cn=Luigi Rossi
the subtitle just below contains "Distinguished Name: cn=Luigi Rossi,ou=people,dc=prisma,dc=local"
now click on "Rename" link just 4 lines below
change value "cn=Luigi Rossi" to "uid=lrossi"
that's it.
Worth mentioning is the ldapmodrdn tool, which e.g. in Debian is part of the ldap-utils package. It can read in a simple file where on first line is the old CN as a DN, and on the second line the new CN as an RDN. If there are many users to change, they can be all included in the same file, separated with empty lines.
With that tool its quite easy to process all the existing accounts and change their DNs.