question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for NTLM proxies

See original GitHub issue

Pip doesn’t work—it times out—in my office because our computers are behind an evil proxy. It still doesn’t work even after specifying the http_proxy environment variable per http://docs.python.org/2/library/urllib.html

The problem is the proxy uses a proprietary technology called NTLM that urllib (or whatever http client Pip uses) can’t cope with https://en.wikipedia.org/wiki/NTLM

This problem isn’t peculiar to Pip–other Python and Ruby and Nodejs break too–but the problem is fatal to Pip users. Python’s strength is its great libraries (Numpy, Beautiful Soup, Pandas and so on). Behind a NTLM proxy, these are inaccessible and Python development essentially impossible.

On my computer, I’ve installed all these packages from source (T-E-D-I-O-U-S), but that doesn’t help my colleagues when I send them a ‘handy ten line Python script’. It fails with an import error. We spend a quarter of an hour installing the dependency chain from source. Oh, they say, I heard Python was easy to use.


Maybe these libraries could help https://code.google.com/p/python-ntlm/ https://github.com/requests/requests-ntlm

Issue Analytics

  • State:open
  • Created 10 years ago
  • Reactions:1
  • Comments:54 (16 by maintainers)

github_iconTop GitHub Comments

12reactions
ghostcommented, May 22, 2015

Ping on this issue.

Windows users, you may be able to make this work by installing Fiddler and setting it to automatically authenticate.

image

Your local proxy setting then becomes http://localhost:8888

I have pinged a couple of people at MS about availability of proxies for testing

1reaction
pfmoorecommented, Feb 6, 2018

For what it’s worth, my cntlm.ini is as follows (all security-sensitive data blanked out):

Username        XXXXXX
Domain          XXXXX
Auth            NTLMv2
PassLM          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PassNT          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PassNTLMv2      XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Proxy           xxx.xxx.xxx.xxx:nn
NoProxy         localhost, 127.0.0.*, 10.*, 192.168.*
Listen          3128
Gateway yes

As you can see, basically everything is default (the “Gateway yes” setting is something I added recently when experimenting with docker - pip works fine whether it’s there or not).

I have environment variables:

http_proxy                     http://localhost:3128
https_proxy                    http://localhost:3128

I also have

[global]
proxy = localhost:3128

in my pip.ini, but I believe the environment variables take precedence. If I remove the environment variables, though, pip still works (presumably because of the pip.ini setting).

I use this daily, and have for a number of years. Whatever the issues people are having on this thread, I can confirm they are not affecting me. I’m no longer using the ISA firewall client I was using back in 2014 when I last commented on this thread - I’ve been using cntlm for some time now.

I’m not trying to claim that the people commenting here are not experiencing this issue, but if there’s any hope of confirming that there’s a problem in pip and getting it fixed, we’re going to need someone to provide a reproducible test case that will allow us to see the problem first hand. And yes, that’s hard as it needs an NTLM proxy set up somewhere accessible on the internet - maybe someone can build an environment somewhere like Appveyor? I don’t know. Or if someone experiencing the issue can dive into the pip code and find a solution they can submit as a PR, we can test it doesn’t break other currently-working setups, and assuming it’s good, merge it.

Otherwise we’re going to have to continue to assume it’s an issue somewhere in the way cntlm or the NTLM proxy it’s interfacing to, are configured.

@iyanmv Just saw your last comment - that’s very interesting. I can’t help in terms of what differences there might be between your two environments except to say “pip has basically no differences in how it works on Windows and Linux”, but it does clearly indicate that there’s something environmental involved in this issue… (Could it be something as simple as differing CNTLM versions? I’m using version 0.92.2).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add support for proxies that use NTLM/Kerberos authentication
The plugin I've written supports endpoints with NTLM authentication. It does support an upstream proxy, but currently it does not support ...
Read more >
[MS-GRVHENC]: Proxy Authentication using NTLM Example
In this article. The following example illustrates the sequence of messages exchanged to communicate through a NTLM enabled proxy.
Read more >
NTLM Authorization Proxy Server
'NTLM Authorization Proxy Server' (APS) is a proxy software that allows you to authenticate via an MS Proxy Server using the proprietary NTLM...
Read more >
NTLM proxy authentication - Aruba UXI Help Center
NT LAN Manager known as NTLM is a Microsoft proprietary Authentication Protocol used in Windows for authenticating between clients and servers. With this...
Read more >
NTLM - Forcepoint
proxy.config.ntlm.cache. ttl_value. INT. 900. Specifies the number of seconds that Content Gateway stores entries in the NTLM cache. The supported range of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found