Thanks @sventorben for the tip. Indeed it was python which was not able to read my ca files. Since I am new to this, I would detail out all the steps followed. However, some of these steps might be redundant.
- After I received my root as well intermediary CA files, I first converted them to
PEM
format as they were in DER
format using openssl
.
openssl x509 -inform DER -in myintermediary.cer -out myintermediary.crt
openssl x509 -inform DER -in myroot.cer -out myroot.crt
- Then, I mounted these files to my superset container at path
/usr/local/share/ca-certificates/
- Then, I logged into my container and executed
update-ca-certificates
command and verified that 2 new pem
files got added at /etc/ss/certs/
path i.e. myroot.pem
and intermediary.pem
.
- Then, I added these CA files to python certifi inside my container. To find out the path of cacert.pem, I executed below commands into
python
terminal.
import certifi
certifi.where()
exit()
Here, second command gave me the path of cacert.pem which was like /usr/local/lib/python3.7/site-pacakges/certifi/cacert.pem
.
- After this, i appended my ca files at the end of cacert.pem
cat /etc/ssl/certs/myroot.pem /etc/ssl/certs/intermediary.pem >> /usr/local/lib/python3.7/site-pacakges/certifi/cacert.pem
- In the end i logged out of my container and restarted it.
docker-compose stop
docker-compose up -d
Note:
I feel step 3 is redundant as python does not read CA files from there. However, i still did it and I am in no mood of reverting and test it out again.
Also, this was my temporary fix as executing the commands inside the container is not useful as they are ephermal.
Update:
Below are the steps followed for production deployment.
- Convert root certificates in PEM format using openssl.
- Concat both PEM files into a new PEM file which will be installed as bundle. Lets say, the new PEM file is
mycacert.pem
and same is mounted at /app/docker/
.
- Create one sh file called
start.sh
and write 2 commands as below.
cat /app/docker/mycacert.pem >> /usr/local/lib/python3.7/site-pacakges/certifi/cacert.pem
gunicorn --bind 0.0.0.0:8088 --access-logfile - --error-logfile - --workers 5 --worker-class gthread --threads 4 --timeout 200 --limit-request-line 4094 --limit-request-field_size 8190 'superset.app:create_app()'
- Modify docker-compose.yml and change command as below.
command: ["/app/docker/start.sh"]
- Restart superset container.
docker-compose stop
docker-compose up -d