pegasy / python-ntlm

Automatically exported from code.google.com/p/python-ntlm
0 stars 0 forks source link

Proxy authentication support #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attempting to authenticate with a proxy server using NTLM

What is the expected output? What do you see instead?
Python-ntlm currently supports ntlm authentication via a proxy, but not 
authenticating with that proxy using ntlm.

What version of the product are you using? On what operating system?
Latest python-ntlm build, Python 2.7, any OS

Please provide any additional information below.
Included patch file adds support for ntlm proxy authentication.

Original issue reported on code.google.com by ChrisThe...@gmail.com on 21 Mar 2012 at 2:21

GoogleCodeExporter commented 9 years ago
Uh, apologies, this probably shouldn't be marked as a defect; no idea how to 
change it, I'm afraid.

Original comment by ChrisThe...@gmail.com on 21 Mar 2012 at 2:21

GoogleCodeExporter commented 9 years ago
Hi Chris. I too would like Pip and httpie and the rest to work behind ntlm 
proxies. How far did you get?

Follow https://github.com/shazow/urllib3/issues/242 for my [no]progress

Original comment by matt.hickford on 7 Sep 2013 at 10:01

GoogleCodeExporter commented 9 years ago
There's a class ProxyNtlmAuthHandler in 
https://code.google.com/p/python-ntlm/source/browse/trunk/python26/ntlm/HTTPNtlm
AuthHandler.py that purports to do ntlm-authenticated proxying

    class ProxyNtlmAuthHandler(AbstractNtlmAuthHandler, urllib2.BaseHandler):
        """ 
            CAUTION: this class has NOT been tested at all!!! 
            use at your own risk
        """
        auth_header = 'Proxy-authorization'

        def http_error_407(self, req, fp, code, msg, headers):
            return self.http_error_authentication_required('proxy-authenticate', req, fp, headers)

But it's broken 

      File "C:\Python27\lib\site-packages\requests_ntlm-0.0.2.3-py2.7.egg\requests_ntlm\requests_ntlm.py", line 58, in retry_using_http_NTLM_auth
        ServerChallenge, NegotiateFlags = ntlm.parse_NTLM_CHALLENGE_MESSAGE(auth_header_value[5:])
      File "C:\Python27\lib\site-packages\python_ntlm-1.0.1-py2.7.egg\ntlm\ntlm.py", line 228, in parse_NTLM_CHALLENGE_MESSAGE
        TargetInfoLen = struct.unpack("<H",msg2[40:42])[0]
    struct.error: unpack requires a string argument of length 2

Perhaps the NTLM protocol is different for proxies? It looks like the challenge 
message is in an unexpected format

Original comment by matt.hickford on 23 Sep 2013 at 3:46