Set up MITM proxy for downloading conda packagesΒΆ

Downloading packages from conda repos on machines in the office can be very slow, especially for the hadoop package. This is because we get throttled due to our frequent downloading of packages coming from our CI pipeline. The download speeds can be prohibitively slow, so we have a proxy setup that should cache packages from the anaconda repositories and allow us to avoid being throttled. The steps below will guide you on how to use this proxy on your machine.

Note

This guide is only useful for machines that are connected to our office network.

  1. Download the proxy SSL certificate and add it to your machine:

    cp mitmproxy-ca-cert.crt /usr/local/share/ca-certificates/
    
  2. Add the following lines to your /etc/hosts:

    10.0.1.1        registry.npmjs.org
    10.0.1.1        conda.anaconda.org
    10.0.1.1        repo.anaconda.com
    10.0.1.1        archive.ubuntu.com
    
  3. Run the following commands using sudo:

    update-ca-certificates
    mkdir /etc/conda && echo 'ssl_verify: /etc/ssl/certs/ca-certificates.crt' > /etc/conda/condarc && \
      echo 'export NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt' >> /etc/profile.globals && \
      echo 'export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt' >> /etc/profile.globals && \
      echo 'export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt' >> /etc/profile.globals && \
      echo 'export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt' >> /etc/profile.globals && \
      echo '\nexport ENV=/etc/profile.globals\nexport BASH_ENV=/etc/profile.globals\n. $ENV' | tee --append /etc/profile /etc/bash.bashrc
    
  4. Reboot your machine or restart your network service.