Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Windows 7] CNTLM and NPM behind NTLM proxy

CNTLM and NPM behind NTLM proxy on Windows 7

CNTLM

  • Install CNTLM in a folder where you have full rights to run it as administrator.

  • Open cntlm.ini and fill it :

Username    YOUR_USERNAME
Domain      YOUR_DOMAIN
Proxy       YOUR_PROXY_IP:PORT
Listen      53128

!!! DON'T FILL THE PASSWORD FIELD !!!

  • Open a console to generate password hashes :
> cd c:\the_install_directory_of_cntlm
> cntlm –c cntlm.ini –H
Password: ...type proxy password here...
PassLM          D6888AC8AE0EEE294D954420463215AE
PassNT          0E1FAED265D32EBBFB15F410D27994B2
PassNTLMv2      91E810C86B3FD1BD14342F945ED42CD6

Copy those tree lines behin Domainfield. !!! AGAIN, DON'T FILL THE PASSWORD FIELD !!!

  • Run the console as administrator and copy the following line to determine if the settings work :
    cntlm –c cntlm.ini –I –M http://www.google.co.uk You should have a success message. If not, check the previous steps.

  • (Optional, only if the "Start CNTML proxy" shortcut does not exist yet) Create start_cntlm.bat file where you want :

cd c:\the_install_directory_of_cntlm
cntlm -v -f -c "cntlm.ini"
  • Run start_cntlm.bat as administrator to start CNTLM service. Keep the console open. Closing it will stop the service.

NPM

  • Open a console and copy those 3 lines :
> npm config set proxy http://localhost:53128
> npm config set https-proxy http://localhost:53128
> npm config set registry http://registry.npmjs.org
  • Start CNTLM service.

  • Every nmp command should work. You can try with :
    > npm view qunit

  • Enjoy.

Sources

[http://stackoverflow.com/questions/18569054/npm-behind-ntlm-proxy/18570201#18570201] [http://stormpoopersmith.com/2012/03/20/using-applications-behind-a-corporate-proxy/]

@genotrance

This comment has been minimized.

genotrance commented Mar 31, 2017

Just use Px: http://github.com/genotrance/px

No need to provide any credentials - Px just authenticates as the logged in user. Super easy to setup and use and no worries of locking out your account cause you forgot to update the CNTLM.ini password hashes.

@alflanagan

This comment has been minimized.

alflanagan commented May 4, 2017

Thanks, worked like a charm!

@rozaydin

This comment has been minimized.

rozaydin commented Nov 17, 2017

Works great :) Thanks a lot

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