WSL is a life-saver for enterprise developper that needs a bash-like environment.

Setting up 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 /etc/cntlm.conf: domain, username, password and proxy:port

An example of the cntlm.conf content:

One trick to obtain the correct Auth and 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

Linux system

For the linux system to recognize the proxy, we need to set it up:

Put the following inside of ~/.bashrc:

apt-get

put the following into /etc/apt/apt.conf.d/proxy.conf

R

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~/.Renviron.

Put the following content:

One more trick to debug the connection try: options(internet.info = 0)

pip/conda

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.

c.f. https://superuser.com/questions/437330/how-do-you-add-a-certificate-authority-ca-to-ubuntu for system wide setup

For conda/pip set:

## Unset the proxy

While we are out of proxy, we can do: