Search This Blog

Sunday, November 24, 2019

Make docker work on ubuntu 18 running on virtual box with host as windows 10 behind company proxy/zscaler/mitm

If you have an ubuntu vm running on windows and are struggling with ssl handshake errors and not able to 
open any website, please follow the below instructions

Firefox,

 it has its on certificate manager so export the certificate from the lock icon 
of any website that is giving erro rand save it in the crt format.
Now go to to Firefox settings and import this certificate, it will start working.
restart firefox.

Chrome :
has its own database, use the above crt file and run the below command.

certutil -d sql:$HOME/.pki/nssdb -A -t "CP,CP," -n CertNickName -i cert_file.crt
Restart chrome

Docker:
if you try to run docker search or docker run hello-world 
you will end up with an error like below.

x509: certificate signed by unknown authority.

Well docker won't work oob if you are behind a proxy/zscaler/corporate

These instructions are for ubuntu 18 not sure about others

Go to the registry url on the host machine and open it on your browser,
Click on the lock icon and look at the certifcate chain, it will be a series of CA

Now we need to export all of them in base 64 CER , rename them to type pem in 
your VM(ubuntu) by cp or something and move all the certificates to the 
/usr/local/share/ca-certificates
Now use the below tool to convert pem to CRT type, this is important because ubuntu won't recognize any other format.

openssl x509 -in foo.pem -inform PEM -out foo.crt

Now run the 

$ sudo update-ca-certificates 

You should see a message that x number of certificates are imported, 

$sudo service docker restart

You should be able to search the images and pull the images
from the docker hub behind a corporate proxy

No comments:

Post a Comment