Skip to content

Instantly share code, notes, and snippets.

@goude
Created February 5, 2016 11:59
Show Gist options
  • Save goude/edecda33699fcad5d66e to your computer and use it in GitHub Desktop.
Save goude/edecda33699fcad5d66e to your computer and use it in GitHub Desktop.
Minimal setup instructions for cntlm (Windows/Linux)

Minimal setup instructions for cntlm (Windows/Linux)

Problem

λ git clone https://github.com/mbostock/d3.git
Cloning into 'd3'...
fatal: unable to access 'https://github.com/mbostock/d3.git/':
Failed to connect to github.com port 443: Connection refused

Solution

* Read about cntlm on http://cntlm.sourceforge.net/
* Grab the latest ZIP and source (tgz) files from http://sourceforge.net/projects/cntlm/files/cntlm/cntlm%200.92.3/
* Configure cntlm

Windows

* Unzip cntlm to C:\dev\cntlm and cd to that directory

* Create cntlm.bat with the contents
    cntlm -f -c cntlm.ini

* Edit cntlm.ini so that it contains:
    Username <USERNAME>
    Domain <DOMAIN>
    Proxy <PROXYSERVER>:<PROXYPORT>
    NoProxy localhost, 127.0.0.*, 10.*, 192.168.*
    Listen 3128

* Do this:
    cntlm.exe -c cntlm.ini -M http://test.com

* Copy the output rows:
    Auth ...
    PassNTLMv2 ...

* Paste into cntlm.ini

* Run cntlm.bat

* Configure problematic applications to use http://localhost:3128 as a proxy
    - GUI programs: See Settings/Preferences or similar
    - git, curl, wget and friends: set the HTTPS_PROXY environment variable to http://localhost:3128
    - npm: http://jjasonclark.com/how-to-setup-node-behind-web-proxy/

* If you change your password, you need to edit your cntlm configuration file as described above.

Linux

* Compile cntlm from source

* Place cntlm binary in path

* Copy cntlm.ini from Windows into .cntlm/cntlm.conf

* Create serve-cntlm script:
    #!/bin/bash
    $HOME/bin/cntlm -c $HOME/.cntlm/cntlm.conf -f

* Add the following to your .bashrc (some programs are case-sensitive when it comes to proxy environment variables)
    export HTTP_PROXY=localhost:3128
    export http_proxy=localhost:3128
    export HTTPS_PROXY=localhost:3128
    export https_proxy=localhost:3128

* Alternatively, see https://github.com/goude/yaprox
@cdechery
Copy link

Life saver!! Thanks

@ajaydarshanala
Copy link

ajaydarshanala commented Oct 7, 2020

Thank you for Windows instructions, It worked. First i started using these instruction and i also found better explained link
https://stormpoopersmith.com/2012/03/20/using-applications-behind-a-corporate-proxy/#disqus_thread. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment