[python-win32] LDAPS issues
sallas at tpg.com.au
sallas at tpg.com.au
Thu Mar 15 05:34:21 CET 2007
I am trying to connect from a Windows machine to a Windows Active
Directory over LDAPS using Python and am getting what seems certificate
issues. I can connect fine over LDAP, but in submitting the following:
[CODE]
import sys
import ldap
def main():
who = "username"
cred = "password"
try:
ldap.set_option(ldap.OPT_X_TLS_CACERTDIR, "ldapsInt.pem")
ld = ldap.initialize("ldaps://ldap.server:636")
ld.simple_bind_s(who,cred)
print "Successfully bound to server.\n"
print "Searching..\n"
except ldap.LDAPError, error_message:
print "Couldn't Connect. %s " % error_message
if __name__ == '__main__':
main()
[/CODE]
('ldap.server' is a dummy server name for display purposes)
I get the following error message:
Couldn't Connect. {'info': 'error:14090086:SSL
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed', 'desc':
"Can't contact LDAP server"}
I have tried adding
'ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT,ldap.OPT_X_TLS_NEVER)', but
still get the same error. Port 636 has been verified as being opened. I
am using Python 2.4 as latest version isn't compatible with the ldap
library. No other libraries are installed.
The only thing I am dubious about is how to get the '.pem' file. As I
created the file from the ldap server certificate on a unix machine
using some openssl command (as the code will need to be finally
initiated from a Unix client), how do you do this on a Windows machine?
TIA.
More information about the Python-win32
mailing list