NTLM v2 authentication through python 2.7

1.3k views Asked by At

I am implementaing NTLMv2 authentication. Using activestate python 2.7.5.6. NTLM from https://code.google.com/p/python-ntlm/ There seems to be a bug in urllib2 because of which access of https urls via the proxy with authentication is not going through successfully http://bugs.python.org/issue7291.

  File "/usr/lib/python2.7/urllib2.py", line 1121, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error Tunnel connection failed: 407 Proxy
Authentication Required>

This is because HTTPConnection::_tunnel() in httplib.py doesn't send
Proxy-Authorization header.

Python bug that we are facing is reported in python 2.6.X and the fix is also part of python 2.7.6 (http://www.python.org/getit/releases/2.7.6/) which is the released after 2.7.5.6. This is as per the release notes of 2.7.6.(http://hg.python.org/cpython/raw-file/99d03261c1ba/Misc/NEWS) - The bug# 7291 (http://bugs.python.org/issue7291) is wrongly mentioned as 7231 in the release notes of 2.7.6. Though the description is correct. - I checked the source code and do not see the code changes for this issue in python 2.7.6 though the release notes say that bug fix is part of the release. I cross checked against the commits mentioned (http://bugs.python.org/file20824/http_proxy_https.patch) in the opened issue in the bug tracking system. - ActiveState python does not support python 2.7.6 (http://www.activestate.com/activepython/downloads) as of now( 2.7.6 was released on Nov 10th 2013)

So need to go for which version of python, or is there any other way to implement NTLMv2 in python.

0

There are 0 answers