Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDAP does not work with python <2.6.6 #9

Open
Legrandin opened this issue Jun 28, 2012 · 7 comments
Open

LDAP does not work with python <2.6.6 #9

Legrandin opened this issue Jun 28, 2012 · 7 comments

Comments

@Legrandin
Copy link
Owner

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.

@PiNotEqual3
Copy link

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!

@debarghaya
Copy link

debarghaya commented Jun 12, 2017

I had used the Active directory one and got the following error 👎

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

AuthType NTLM
AuthName ABCD
require valid-user
PythonAuthenHandler pyntlm
PythonOption Domain ABCD
PythonOption PDC 192.168.0.2

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.

@oetiker
Copy link

oetiker commented Jun 12, 2017

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

@debarghaya
Copy link

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

@oetiker
Copy link

oetiker commented Jun 12, 2017

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

@debarghaya
Copy link

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

@debarghaya
Copy link

Worked thanks Oetiker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants