LDAP Link Question
I'm trying to use LDAP link for the first time and I'm having a hard time translating what works in my LDAP search into the SQL command. I need to be able to find people by CN that are members of a CN. Here is my ldapsearch
ldapsearch -xLLL -s sub -H ldap://host:port -D "LDVertica" -w bind_password -b "CN=VerticaAdmins NonProd,OU=Vertica,OU=DEV,OU=Groups - Application,DC=CITY,DC=COMPANY,DC=com" '(&(objectClass=group))' member
And here is the result
dn: CN=VerticaAdmins NonProd,OU=Vertica,OU=DEV,OU=Groups - Application,DC=CITY,
DC=COMPANY,DC=com
member: CN=user_name1,OU=UserAccounts,DC=CITY,DC=COMPANY,DC=com
member: CN=user_name2,OU=UserAccounts,DC=CITY,DC=COMPANY,DC=com
For the SQL statement, I can't see a way to tell LDAP link to look in members:
ALTER DATABASE vmartDB SET PARAMETER LDAPLinkURL='ldap://host:port',
LDAPLinkSearchBase='CN=VerticaAdmins NonProd,OU=Vertica,OU=DEV,OU=Groups - Application,DC=CITY,DC=COMPANY,DC=com',
LDAPLinkBindDN='CN=LDVertica,OU=LDAPAccounts,OU=ServiceAccounts,DC=CITY,DC=COMPANY,DC=com',
LDAPLinkBindPswd='bind_password',
LDAPLinkFilterGroup='(objectClass=group)';
I also don't see how to map my VerticaAdmins group to a role in Vertica. Any help would be appreciated.
Comments
Hi Ryan,
Imagine an ldapsearch command like the following, that returns only those LDAP user objects that you want to import into vertica as USERS:
ldapsearch -xLLL -s sub -H ldap://host:port -D "CN=LDVertica,OU=LDAPAccounts blahblah" -w bind_password -b "CN=VerticaAdmins blahblah" '(objectClass=user)'
Now imagine a separate ldapsearch command like the following, that returns only those LDAP group objects that you want to import into vertica as ROLES:
ldapsearch -xLLL -s sub -H ldap://host:port -D "CN=LDVertica,OU=LDAPAccounts blahblah" -w bind_password -b "CN=VerticaAdmins blahblah" '(objectClass=group)'
Additionally:
With this in mind, your LDAPLink configuration would look like the following:
ALTER DATABASE vmartDB SET PARAMETER
LDAPLinkURL='ldap://host:port',
LDAPLinkSearchBase='CN=VerticaAdmins blahblah',
LDAPLinkBindDN='CN=LDVertica,OU=LDAPAccounts blahblah',
LDAPLinkBindPswd='bind_password',
LDAPLinkFilterUser='(objectClass=user)',
LDAPLinkUserName='uid',
LDAPLinkFilterGroup='(objectClass=group)',
LDAPLinkGroupName='cn',
LDAPLinkGroupMembers='member',
LDAPLinkOn=1;
SELECT ldap_link_sync_start(); -- this step runs the sync on demand, but it can also be omitted since LDAPLink is a service and will run automatically as well
After this, check the 'users' and 'roles' tables:
You can also check the table 'LDAP_LINK_EVENTS' to see what events happened.
HTH