Advertising

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: