Open ldap modify - /usr/bin/modify problem - ldap

Can anyone help me out on this? I'am trying to add another attribute on my LDAP, but i don't know much about this. It returns an error after trying the sample i searched on net. This command will be used on my perl program to add new attribute "status" w/ value "yes"..
Help pls?
/usr/bin/ldapmodify -x -D "cn=Test,ou=mygroup.com,o=group2.com" -a "status=yes"??
the -W doesn't work too.
Error: ldap_bind: Can't contact LDAP server (-1)

Try -v for detail log and -w should be in lower case. As for excluding the password one way is to use '-w -' which you will be prompt to enter the password. Hope this helps.

Ensure that you have the status attribute defined in the schema (the attribute cannot be added to an entry unless the entry has an objectClass attribute value that allows the status attribute). Further, the authentication identity cn=Test,ou=mygroup.com,o=group2.com must have permission to add the attribute.
Use ldapmodify to add the status attribute:
ldapmodify -x -D "cn=Test,ou=mygroup.com,o=group2.com" -h hostname -p port <<!
version: 1
dn: uid=user.0,ou=people,dc=example,dc=com
changetype: modify
add: status
status: first value
status: second value
!
The above example adds two values to the status attribute (assuming it is a multi-valued attribute). For more information about the ldapmodify tool see "Using ldapmodify".

Related

Facing an Forgerock object execption in OpenDJ Reset password with OPenAM

I have been facing this issue while resetting the password through open-DJ(apache directory).
Getting a exception message stated that
The LDAP password modify operation failed with result code 65
Error Message: Entry
uid=ssssa2020#gmail.com,ou=people,dc=uppclwallet,dc=com cannot be modified
because the resulting entry would have violated the server schema: Entry
uid=sssa2020#gmail.com,ou=people,dc=example,dc=com
**violates the
Directory Server schema **configuration** because it contains an unknown
objectclass wallet**
I have tried this command to reset the password in opendj
./ldappasswordmodify -h hostname -p 1389 -D "cn=Directory Manager" -w We#123 \
--authzID uid=ssssa2020#gmail.com,ou=People,dc=example,dc=com \
--newPassword Qwerty#1
I have tried using openAM/openDJ or ldapmodify command to reset the password. but getting same execption.
Attached the image for your reference.
The error is well explained in the error message. The entry you are trying to modify (even though just changing the password), is not compliant with the server's schema. It contains an unknown objectClass: "wallet".
OpenDJ will always verify that entries are compliant with the schema on updates. The compliance may be broken if schema definitions are removed but entries not cleaned, or if you've imported data with schema checking disabled. Also, schema may not be properly replicated between servers (mostly due to mistakes in schema change handling).
If you fix the server's schema, or first remove the objectClass from the entry, you will be able to change the user's password.

Problems getting OpenLDAP memberOf working

I'm not very familiar with OpenLDAP, but I'm trying to get a local instance working in order to test a client in development, which needs the memberOf attribute.
I've downloaded and installed OpenLDAP on a Centos 7 VM, per the instructions at http://www.openldap.org/doc/admin24/guide.html#A Quick-Start Guide. I did not use package management to install it. Since I'm using 2.4.45, it's using the cn=config OLC config and not the slapd.conf configuration scheme
At step 4 above, I used the --enable-memberof and --enable-refint flag to the configure script. When I ran the pre-install tests, it did run the memberof tests, and they passed, so I know the overlay can be applied somehow.
I've tried the directions found at https://adimian.com/blog/2014/10/how-to-enable-memberof-using-openldap/ and, with slight variants, many other places. I've run into the following issues with this...
Errors about an invalid objectClass oldModuleList during ldapadd
Insufficient access errors during ldapadd
I don't have a local directory that corresponds to the module path found in any of the examples. I don't seem to have the memberof.la file anywhere on the machine.
Is this even on the right track? Or will the process be different because I installed from source or used the --enable-memberof flag?
Let me know if there's any info I need to provide.
Update:
Currently, I am trying to add the entry with dn dn: olcOverlay={0}memberof,olcDatabase={1}hdb,cn=config as found in the linked instructions above. I get
# ldapadd -x -D "cn=Manager,dc=aaron,dc=com" -W -f member.ldif
Enter LDAP Password:
adding new entry "olcOverlay={0}memberof,olcDatabase={1}mdb,cn=config"
ldap_add: Insufficient access (50)
Another update:
Progress!
I added an olcRootPW to the cn=config database by editing
etc/slapd.d/cn=config/olcDatabase={0}config.ldif
then used that dn to run the ldapadd:
ldapadd -x -D "cn=config" -W -f member.ldif
I had to put the {0} and {1} back.
Trying to add the first refint ldif failed, but I think I don't need that since these aren't modules, but compiled directly into slapd based on how I configured it.
Now I'm trying to add the second refint entry and getting
[root#openldap openldap]# ldapadd -x -D "cn=config" -W -f refint2.ldif
Enter LDAP Password:
adding new entry "olcOverlay={1}refint,olcDatabase={1}mdb,cn=config"
ldap_add: Other (e.g., implementation specific) error (80)
additional info: olcRefintAttribute <manager>: attribute type undefined
So here's everything I had to do to get it working from my original issue:
Add an olcRootPW entry to the olcDatabase={0}config.ldif config entry. As EJP says, this is bad form, but since this is a local testing directory only, and I only want it to allow me to test a client...
Without the {0} and {1} items in the file, the load still failed. I but both back and it worked. I did not go back to check EJP's suggestion to only have the {1}.
Then the ldapadd command needs to be run with bind dn 'cn=config'. At that point the entry to enable the memberof config would add successfully.
I tried to add the first refint file, the one that does the module. This did not work, I got an error about the olcModuleList attribute. I think since I compiled the overlays directly into OpenLDAP via the --enable-memberof and --enable-refint I didn't need this part?
For the second refint file, the one to add the overlay, I just needed to remove the 'manager owner' part of the attributes, since my directory does not have those attributes. At this point the ldif added successfully.
Then I went into the directory and added users, groups, and assigned users to groups, and (once I told it to fetch the operational attributes) lo and behold my users had the appropriate memberOf attributes!

How to make ldappasswd use {SHA} instead of {SSHA} for users passwords in openldap?

Is it possible to use {SHA} with ldappasswd? I didn't find responsible option in manual page and docs
Look for password-hash in slapd.conf(5), or for olcPasswordHash in slapd-config(5).
I know that's an old post but I found another solution for this problem.
This wolution works for ApacheDirectory servers (for org.apache implementation classes, but I think you can find interceptors for each openldap).
If you want use SHA encrypting by default when using ldappasswd you can change the interceptor implementation of password.
You have to modify following dn entry:
ads-interceptorId=passwordHashingInterceptor,ou=interceptors,ads-directoryServiceId=default,ou=config
And change the value:
ads-interceptorclassname: arg.apache.directory.server.core.hash.ShaPasswordHashingInterceptor
By default, openldap is using:
ads-interceptorclassname: org.apache.directory.server.core.hash.SshaPasswordHashingInterceptor
Command to modify:
ldapmodify -h <LDAP_HOST> -p <LDAP_PORT> -D "<ADMIN_DN>" -w "<ADMIN_PASSWORD>" <<EOF
dn: ads-interceptorId=passwordHashingInterceptor,ou=interceptors,ads-directoryServiceId=default,ou=config
changetype: modify
replace: ads-interceptorclassname
ads-interceptorclassname: org.apache.directory.server.core.hash.ShaPasswordHashingInterceptor
EOF
Then you have to restart your LDAP server. All new passwords added by ldappasswd will be in SHA and not in SSHA.
Note:
You can use another interceptor provided by Apache:
http://directory.apache.org/apacheds/advanced-ug/1.4-interceptors.html#existing-interceptors
Javadoc:
https://directory.apache.org/apacheds/gen-docs/2.0.0-M20/apidocs/org/apache/directory/server/core/hash/package-tree.html

Cannot wildcard search "member" in openLDAP

.
I have an odd problem, where I cannot seem to use wildcard searches for the "member" or the "uniquemember" attibutes for a group.
Consider the following:
cn=myusers,ou=groups,dc=example,dc=com
objectClass=groupOfNames
objectClass=top
This returns fine:
ldapsearch -h ldap-server -p 389 -D "cn=admin,dc=example,dc=com" -w Password -s sub -b "ou=groups,dc=example,dc=com" "(objectclass=groupOfNames)" member
cn=myusers,ou=groups,dc=example,dc=com
member=cn=user1234,ou=groups,dc=example,dc=com
And if I use this, it also works fine:
ldapsearch -h ldap-server -p 389 -D "cn=admin,dc=example,dc=com" -w Password -s sub -b "ou=groups,dc=example,dc=com" "(&(member=cn=user1234,ou=groups,dc=example,dc=com)(objectclass=groupOfNames)" member
But, suppose I want to find all the groups, with member names that start with "user". I try this:
ldapsearch -h ldap-server -p 389 -D "cn=admin,dc=example,dc=com" -w Password -s sub -b "ou=groups,dc=example,dc=com" "(&(member=cn=user*)(objectclass=groupOfNames))" member
But nothing returns!
Now I have tried adding indexes to the "member" and "uniquemember" attibutes as:
member pres,eq,approx,sub
uniquemember pres,eq,approx,sub
... but get a returned error of 'additional info: approx index of attribute "member" disallowed', so I was left with:
member pres,eq
uniquemember pres,eq
Even after the change, I still cannot perform wildcard searches using "member" or "uniquemember" attibutes. Any ideas?
.
This works as expected with the UnboundID Directory Server. Try updating the directory server software - there are some similar questions on the OpenLDAP forums where this problem was resolved by a fix to DN normalization.
Also, there is no such thing as a 'wildcard' search. The assertion value to which you refer results in what is called a 'substring' search. For increased performance, the server should index the member and uniqueMember attribute values for substring (sub), assuming the legacy OpenLDAP server supports indexing those attributes for substrings.

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.