WSL is a life-saver for enterprise developper that needs a
cntlm will help us to make the WSL communicate with outside world. The steps are simple and straight forward.
Step 1: install cntlm and configure the proxy
To install cntlm in WSL ubuntu do the following:
sudo apt install cntlm
However, if you are in the enterprise network, you will not be able to do so. So go to https://packages.ubuntu.com/bionic/net/cntlm download the relevant package.
To configure the cntlm for ubuntu, we need to set up conf in
An example of the
One trick to obtain the correct
PassXXXX setting is to run:
sudo cntlm -M http://google.com and type the password to get the right setup at the end.
Now we are ready to do restart
sudo service restart cntlm
Step 2: setup the proxy in system
For the linux system to recognize the proxy, we need to set it up:
Put the following inside of
put the following into
To set the required environment variables you should add them to the R environment file. On RStudio Server this file is found at
R_HOME/etc/Renviron.site. On RStudio Desktop this file is found in the user home directory at
Put the following content:
One more trick to debug the connection try:
options(internet.info = 0)
No further setup required.
Step 3: SSL certificate
We are not done yet. We need to get the SSL certificate to make all the stuff works.
To get the certificate, we can obtain the certificate as follows on Windows in Chrome. Assuming your proxy performing an MITM, go to a website which is using the proxy certificate. Click the lock icon next to the URL in chorme in the address bar. Click certificate. Go to Certification Path tab. Select the root certificate in the tree. Then click View Certificate.
In the new dialog box, go to Details tab and click Copy to File. Then export the certificate as a base 64 encoded file. Place this file in a sensible location.
For conda/pip set:
pip config set global.cert path/to/ca-bundle.crt
Unset the proxy
While we are out of proxy, we can do: