Many developers these days are using these fancy new cross-platform text editors that are lightweight and fast to reduce the workflow of writing and testing code. I’m mostly talking about web developers here. If you are new in this world I suggest you give the followings a shot as after days of researching and trying I think currently they are the bests:
Now back to the subject. Many of these text editors support proxy servers, but none of them that I have tried support NTLM for authentication and if your corporate proxy is using NTLM they simply cannot connect to it. Or lets say not directly! Actually the only solution I have found is to use a software called CNTLM that can act as a proxy server itself and behind the scene it can connect to another proxy server that is using NTLM. The good news is this software is open-source, very lightweight and independent of any external library (written in C) and can take care of all the complexity of NTLM. In fact You can easily setup CNTLM to allow any application that does not support NTLM authentication to connect to the internet. Atom is based on NodeJS (most of them are) so you’ll be able to apply what you will learn hear to other similar text editors as well.
Configure CNTLM to use your corporate proxy
- CNTLM is an opensource software and you need to download its latest version from SourceForge website here.
- Now you need to install it by running the installation package. There is not much to worry about. it just adds a few shortcuts to your start menu and copies the file under “Program Files (x86)“.
- All the settings of CNTLM are stored in Program Files (x86)\Cntlm\cntlm.ini, and you can open this file from Start Menu > Cntlm > cntlm.ini
- The cntlm.ini file is quite self descriptive. You just need to add the following lines in this file:
Username your-username Domain your-domain-name Password your-password-or-leave-empty Proxy proxy-ip-or-hostname:port Proxy another-proxy-ip-or-hostname:port Listen 3128
you can add as many Proxy lines as you want, Cntlm will try them one by one until it can find one that works.
Please note that the address of your proxy will be
"localhost:3128" by default but you can change it to any desired port that is not currently being used by another program. You just need to change the value in front of
Listen setting. I have highlighted the line so you never miss it.
- Star the proxy server by heading to Start Menu > Cntlm > “Start Cntlm Authentication Proxy”
- Test your shiny new proxy by using your favorite browser.
Configure Atom to use Cntlm as proxy server
- Start Atom by heading to Start Menu > All Programs > GitHub, Inc > Atom
- Go to File > Settings or press Ctrl+Comma. Click on “Open Config Folder” button in the left pane of the Settings tab. It will open and show all the content of the setting folder in Atom.
- Click and open .apmrc file located under the root setting folder (.atom folder) and add the following lines:
http-proxy=http://localhost:port-number-to-be-used-by-Cntlm https-proxy=http://localhost:port-number-to-be-used-by-Cntlm strict-ssl=false registry=http://registry.npmjs.org/
The last line (that I have highlighted) tells npm to use the http address instead of the default https address. This is because I noticed that Cntl might have some problems with https addresses. This issue might be solved later and you might not need it in the future.
- Restart Atom and enjoy using your favorite packages.
A little bonus
By running the following command you can tell many other programs to use your new little proxy server by default. Unfortunately not every program supports it.
netsh winhttp set proxy localhost:3128 "localhost,127.0.0.*"