Delete Sun ONE ldap account with dn encoded in base64 - ldap

I have a Sun ONE ldap account the dn of which accidentally became base64-encoded after an rdn change. I have tried various ways to delete this account to no avail. I hope there are people here who know a solution and able help me out.
On the Sun ONE ldap server all attributes are encoded in ascii. The attribute used as rdn is uid. The format of uid for user accounts is FIRSTNAME.LASTNAME.
The uid of the account in question was YAZAIRA.DAZ. A utility written in unix shell was used to change the rdn of the account from YAZAIRA.DAZ to YAZAIRA.DIAZ. The utility prompts for both the old uid and the new uid, and takes care of everything else under the hood to get the rdn changed. At the time, the new uid was copied from another system and pasted at the prompt to the utility, which contained a non-ascii character: YAZAIRA.DÍAZ (notice the ' on top of I).
Therefore, under the hood, the ldif was
dn: uid=YAZAIRA.DAZ,OU=People,dc=company,dc=com
change-type: modrdn
newrdn: uid=YAZAIRA.DÍAZ
deleteoldrdn: 1
After the ldif was run, ldapsearch was not able to find the account. Luckily, after many tries, the account entry was eventually returned as one of several when uid=YAZAIRA.* was entered as search criteria. However, its dn is:
dn:: dWlkPVlBWkFJUkEuRM1BWixvdT1QZW9wbGUsZGM9Y29tcGFueSxkYz1jb20=
and all the attributes that contains the new last name are base64 encoded too.
I want to delete this account using ldapdelete with the accompanying file containing the dn. So far I have tried the following dn, but none has worked:
dWlkPVlBWkFJUkEuRM1BWixvdT1QZW9wbGUsZGM9Y29tcGFueSxkYz1jb20=
uid=YAZAIRA.DIAZ,OU=People,dc=company,dc=com
uid=YAZAIRA.DÍAZ,OU=People,dc=company,dc=com
uid=cWUFaQUlSQS5EzUFa,OU=People,dc=company,dc=com
uid=YAZAIRA.RM1BWg==,OU=People,dc=company,dc=com
uid=YAZAIRA.*,OU=People,dc=company,dc=com
Would appreciate it very much if someone knows how to specify the dn to ldapdelete. Or if there are some alternative ways to delete an account by uniquely identifying the account using attributes other than the dn. Or whatever means to get this account deleted.

Have you tried ldapdelete with the following LDIF?
dn:: dWlkPVlBWkFJUkEuRM1BWixvdT1QZW9wbGUsZGM9Y29tcGFueSxkYz1jb20=
changetype: delete
-

Related

Change value of a single attribute for multiple UID's at once in LDAP

I have a list of uid's of several users present in LDAP and I need to replace the value of one attribute for all those uid's to a new value. Is there a way to accomplish this via Apache Directory Studio at once without editing each entry manually. I am very new to this and this is not my area of expertise. Also, I am aware of only Apache Directory Studio to play around with LDAP values. If someone can provide their inputs with the same, it would be great.
In Apache Directory Studio, you can right-click a connection and select "Import" then "LDIF Import". The file would look something like this
dn: cn=user1FQDN,ou=OrgUnit,o=MyOrg
changetype: modify
replace: TheAttribute
TheAttribute: NewValue
-
dn: cn=user2FQDN,ou=OrgUnit,o=MyOrg
changetype: modify
replace: TheAttribute
TheAttribute: NewValue
-
dn: cn=user3FQDN,ou=OrgUnit,o=MyOrg
changetype: modify
replace: TheAttribute
TheAttribute: NewValue
-
When I'm trying to set the same value on a lot of accounts, I'll put together a quick script to grab the list of user DNs and write the rest of the LDIF content.
Where the "dn" value is each user's fully qualified DN, TheAttribute is the name of the attribute you want to update, and NewValue is the value you want to write into TheAttribute.
Use care when using LDIF to import changes -- you can pull in a lot of changes quite quickly, but you can also screw up a lot of accounts quite quickly. You need to understand the difference between "changetype: modify" which updates an attribute (the update could be to remove the attribute, but the changetype is still modify) and "changetype: delete" which deletes the object. You'll also want to understand how modify/delete operations. Using "changetype: modify" with just "delete: TheAttribute" would delete everything in the attribute:
dn: cn=user1FQDN,ou=OrgUnit,o=MyOrg
changetype: modify
delete: TheAttribute
-
If you want to delete a single value of a multi-value attribute, you need to use:
dn: cn=user1FQDN,ou=OrgUnit,o=MyOrg
changetype: modify
delete: TheAttribute
TheAttribute: ValueToDelete
-
To specify which TheAttribute you want to delete.

Active directory login using Apache shiro

We have a Java based application, where we are using CN as login.
However we want to use samAccountName as userId.
Following is the shiro.ini
contextFactory=com.trmsys.cargo.shield.shiro.ldap.JndiExtLdapContextFactory
contextFactory.url=ldaps://ldaps.test.net:636
contextFactory.systemAuthenticationMechanism=simple
contextFactory.systemUsername=CN=SRV,OU=ServiceUsers,DC=test,DC=net
contextFactory.systemPassword=12WEty%^
contextFactory.environment[java.naming.security.protocol]=ssl
ldapRealm=com.trmsys.cargo.shield.shiro.ldap.JndiLdapRoleRealm
ldapRealm.contextFactory=$contextFactory
ldapRealm.userDnTemplate=CN={0},OU=AppUsers,DC=test,DC=net
ldapRealm.searchBase=OU=Groups,DC=test,DC=net
ldapRealm.searchUserBase=OU=AppUsers,DC=test,DC=net
ldapRealm.groupObjectClass=group
ldapRealm.uniqueMemberAttribute=member
ldapRealm.uniqueMemberAttributeValueTemplate=CN=0},OU=AppUsersDC=test,DC=net
Can anybody please provide the proper way of making the desired change.
Got the correct way of doing this.
We have to make changes in the following line
ldapRealm.userDnTemplate=CN={0},OU=AppUsers,DC=test,DC=net
Changes would be like following
ldapRealm.userDnTemplate={0}
Now, sAmAccountName can be used as userId. While logging in, username should be used as either "domain/account" or "account#domain".
If we do not want to use "domain/account", change as following
ldapRealm.userDnTemplate=domain/{0}
Now user id would be "account". [account == value of sAmAccountName]

Pentaho Kettle LDAP Output

How do I update the LDAP value using LDAP Output Step in Spoon?
I couldn't find any documentation on Pentaho's website. I am trying to update the group name of a particular user in Active Directory.
Until now, I was able to connect with the AD. But I can't make any changes to LDAP.
In General -> Settings, my operation is updated.
And in Fields -> Search Base, I defined the DC attributes. Eg: dc=xyz,dc=com.
And in Attributes, I defined the OU along with the value it should be changed too.
Is this how it should work?
I am getting an error saying "can not find DN(Distinguished Name) in the input stream!"
My guess is that you are using the values you want to inject instead of the fields containing those values. This step heavily relies upon fields coming in from previous steps.
In the image below you will see I am passing in the 'dn' field which is used in Settings > 'Dn fieldname' to lookup the field I want to alter.
Then under Fields I am mapping the incoming 'new_name' field to the property 'givenName' on the LDAP object identified by the DN.
So my DN to lookup and the value to set the field to are coming from my transformation stream. I only statically identify the Attribute on the LDAP object to be mapped.
the dn is not right. dn is cn + ou-structure like ou + domain-structure like dc.
If you dont know the cn, you cant define the dn. You must take a LDAP-Input with query like your uid for getting dn.
With this dn you can update attributes with LDAP-Output, if you have rights for writing.

Specifying multiple Domain Bases in Rocket.Chat LDAP

On Rocket.Chat's LDAP configuration page, the helper text for Domain Base states that you should enter (emphasis mine):
The fully qualified Distinguished Name (DN) of an LDAP subtree you want to search for users and groups. You can add as many as you like; however, each group must be defined in the same domain base as the users that belong to it. If you specify restricted user groups, only users that belong to those groups will be in scope. We recommend that you specify the top level of your LDAP directory tree as your domain base and use search filter to control access.
Problem is, I don't know how to enter more than one.
My DN looks like this:
OU=IT,OU=Staff,DC=companyname,DC=local
And I want the following users to also be synced:
OU=Example,OU=Staff,DC=companyname,DC=local
But I don't know how to add them both, as the docs aren't clear, and the source code is even less clear.
I've tried the following ways:
Space separated
Semicolon separated
Ampersand (and double ampersand) separated
Wrapping them up in an array (e.g. ["OU=Example ...", "OU=IT ..."]) and as a JSON object
Pipe (and double pipe) separated
'Plus' separated (e.g. DC=local + OU=Example)
But no matter what I do, it won't sync users. The logs tell me:
Exception while invoking method 'ldap_sync_users' NoSuchObjectError: 0000208D: NameErr: DSID-03100238, problem 2001 (NO_OBJECT), data 0, best match of: at Object.Future.wait (/snap/rocketchat-server/511/node_modules/fibers/future.js:449:15) ...
I know I can set up a group restriction so only users in a certain group will be synced, but the helper text says I can use multiple DNs, and I want to know how to use multiple DNs
After reading RFC-4514, I discovered I should construct my DN like so:
OU=Example+OU=IT,OU=Staff,DC=companyname,DC=local
With the plus occurring between the two OUs I wish to add. Now my users are syncing correctly.

LDAP Group Filter for authorization in Activiti

I am using activiti-ldap jar to achieve ldap in activiti. I am able to succeed with authentication but I am not able to perform authorization.
Code is using below filter to authenticate (It is giving result)
(&(objectClass=person)(objectClass=user)(sAMAccountName=my-name))
Code is using below filter to authorize (i.e search group based on authenticated user). The enunumeration is not giving any result
(&(objectClass=group)(member=my-distinguised-name))
However when use the same group filter Softerra LDAP Browser, it is giving result.
NamingEnumeration< ? > namingEnum = initialDirContext.search(baseDn, searchExpression, createSearchControls());
while (namingEnum.hasMore()) {
System.out.println("Inside While");
}
I am sure, I am missing something. Can anyone point out my mistake?
I'm not sure if this answers your question, but something you have to be careful of when using a Distinguished name with Active Directory (I am assuming it is Active Directory because there is a sAMAccountName attribute) is comma's, or other special characters in the DN (an example would be cn=Harley, Gregory). Comma's and other special characters need to be escaped with a single backslash ("\"), Softerra may automatically escape these in the query string for you.
Like I said, it may not answer your question, but may give you an avenue to search.
Cheers,
Greg