Oleg Fayans wrote:
Hi everybody,
What is the right way to connect to the Directory Server using Directory
Manager credentials from the autotest?
I need to execute something like
ldapsearch -D "cn=Directory Manager" -w '<directory_manager_password>'
-b "cn=IPA Topology Configuration,cn=plugins,cn=config"
form the python code.
A quick look through the code showed that the following method is
generally used to connect to ldap:
self.ldapuri = 'ldap://%s' % ipautil.format_netloc(api.env.host)
self.conn = ldap2(api, ldap_uri=self.ldapuri)
self.conn.connect()
(See ipatests/test_ipaserver/test_ldap.py)
But this is an anonymous access.
In that same file is an example on how to do a simple bind with DM
credentials:
self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri)
self.conn.connect(bind_dn=DN(('cn', 'directory manager')),
bind_pw=dm_password)
rob
--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code