PyAuthenNTLM2 icon indicating copy to clipboard operation
PyAuthenNTLM2 copied to clipboard

LDAP does not work with python <2.6.6

Open Legrandin opened this issue 13 years ago • 7 comments
trafficstars

Urlparse modules in python <2.6.6 do not parse correctly ldap URLs (even though http URLs are fine). As a result, PyAuthenNTLM2 does not work when connecting to an ADS via LDAP.

An untested fix exists on the "urlparse_replacement" branch.

Legrandin avatar Jun 28 '12 15:06 Legrandin

I can confirm this. I have

# python -V
Python 2.6

and master branch got me

PYNTLM: Error when retrieving Type 2 message from server
     (ldap://my.server.net/DC=stuff,DC=org) = Connection refused

After I installed urlparse_replacement branch it work.

Thanks a lot!

PiNotEqual3 avatar Oct 29 '13 16:10 PiNotEqual3

I had used the Active directory one and got the following error :-1:

Error [Mon Jun 12 20:06:21 2017] [crit] [client 192.168.0.4] PYNTLM: Error when retrieving Type 2 message from server(192.168.0.2) = [Errno 13] Permission denied

Apache Config <Location /> AuthType NTLM AuthName ABCD require valid-user PythonAuthenHandler pyntlm PythonOption Domain ABCD PythonOption PDC 192.168.0.2 </Location>

Python Version [root@rhel67 www]# python -V Python 2.6.6

Active Directory - Windows2008R2 OS - RHEL 6.7 Apache 2.2 Mod python - http://archive.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz

Tried using urlparse_replacement still got the same error.

Http Client [root@rhel67 PyAuthenNTLM2-ActiveDirectory]# python http_client.py -u administrator -p password12 -d ABCD http://192.168.0.3/cgi-bin/whoami.cgi First round NTLM authentication for HTTP request failed 500 Internal Server Error Authentication failed

whoami.cgi #!/bin/sh printf "Content-type: text/html\n\n$REMOTE_USER\n"

NTLM Client [root@rhel67 PyAuthenNTLM2-ActiveDirectory]# python ntlm_client.py -u administrator -p password12 -d ABCD -a ldap://192.168.0.2 Using Active Directory (LDAP) to verify credentials. User administrator\ABCD was authenticated.

Kind of confused and stuck, appreciate your thoughts on this.

debarghaya avatar Jun 12 '17 14:06 debarghaya

to use active directory, you have you have to use an ldap url !

oetiker avatar Jun 12 '17 14:06 oetiker

ldap url where in the Apache config. Can you share an example.

debarghaya avatar Jun 12 '17 14:06 debarghaya

ldap://10.12.13.1/DC=nasa,DC=gov

oetiker avatar Jun 12 '17 14:06 oetiker

Got it i should have read the readme file. Will check and let you guys know.

debarghaya avatar Jun 12 '17 15:06 debarghaya

Worked thanks Oetiker

debarghaya avatar Jun 12 '17 17:06 debarghaya