Pentaho Kettle LDAP Output - ldap

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.

Related

Delete Sun ONE ldap account with dn encoded in base64

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
-

How to clone a UserPrincipal object in VB.NET

I'm trying to create a new User in Active Directory from a VB.NET application. Most fields will be identical to an already existing "template" user, except things like Name, SurName, Email, SamAccountName, etc.
So I want to copy or clone this template User, assign the few fields with a new/different value and then save this new user in Active Directory. I'd like to avoid having to manually assign who-knows how many properties from my template to the new User and maybe forget something along the way..
Is there not a way to do that? I found something about using DirectoryEntry.CopyTo(), but I simply get a "Not implemented" error, and anyway I doubt this is the right direction (Unsure how to use this class together with a UserPrincipal object)
Should I be using a different class than System.DirectoryServices.AccountManagement.UserPrincipal to save my new user in the AD? Do I have the wrong approach?
Any help will be appreciated :)
If you look at the source code for DirectoryEntry.CopyTo, it calls:
newParent.ContainerObject.CopyHere(Path, newName)
And ContainerObject is of the type IADsContainer. If you look at the documentation for IADsContainer.CopyHere, it says (under Remarks):
The providers supplied with ADSI return the E_NOTIMPL error message.
ADSI is "Active Directory Service Interfaces". So the short answer is that it just won't work with AD objects.
There is no way to do what you want. You will have to manually assign each attribute you want to copy.

ADFS Claims Rule Issue

I am attempting to create a custom claim rule in ADFS but I am at a loss as to how to do it. I have the following for users in my AD:
ObjectClass = PrivatePerson
Attribute = PrivatePersonAttribute1
I need to be able to return the value for the attribute in the claim as NameID. Anyone have any suggestions, I am at a complete loss here?
The claims rule wizard in ADFS is editable i.e. you can enter data in the "dropdown".
So create an LDAP rule that maps PrivatePersonAttribute1 to something like http://company.com/PrivatePersonAttribute1
These values won't be in the dropdown so you have to enter them.
Then create a Transform rule that maps http://company.com/PrivatePersonAttribute1 to NameID, You should probably choose a format as well e.g. email or UPN.

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]

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.