Adding a Proxy Certificate in Windows Subsystem for Linux

This week I was having an annoying issue trying to use the requests library from Python – my corporate proxy is doing SSL inspection and HTTPS traffic was failing due to SSL errors.

After some googling, troubleshooting, and head-smashing – I found a solution.

  1. Download the root certificate for your proxy. In my case the ZScaler root certificate is only available to administrators and I had to ask the IT team for a copy
  2. Move the file to your local CA certificate store – /usr/local/share/ca-certificates
  3. Confirm the file is a .crt file. I believe this only matters on Debian systems
  4. Run sudo update-ca-certificates
  5. Confirm that the new cert is in your /etc/ssl/certs folder

That should be it! From here on you can test with a simple command:
python -c 'import requests; r=requests.get('https://google.com');print(r.text)

If you get an error message, you did something wrong. If you get a block of HTML text, you’re good to go!

Leave a comment