Skip to content

Instantly share code, notes, and snippets.

@pydemo
Forked from goude/cntlm-setup-win-lin.md
Created April 29, 2020 21:19
Show Gist options
  • Save pydemo/b96a393598fe6f37332213d18ee97f3f to your computer and use it in GitHub Desktop.
Save pydemo/b96a393598fe6f37332213d18ee97f3f 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment