Ubuntu – How to get the ca-certificates.crt

certificatesdocker

My docker get error "x509 certificate signed by unknown authority" and then i find that my ubuntu contianer missing file ca-certificates.crt on /etc/ssl/certs/ or /usr/local/share/certificates/. The solution of this error is add ca-certificates.crt to the */usr/local/share/certificates/** folder and run update-ca-certificates command. But my problem is I dont know where to get that .crt file.

Best Answer

To get certificates, run similar to the next command:

openssl req -newkey rsa:2048 -nodes -keyout nginx/my-site.com.key -x509 -days 365 -out nginx/my-site.com.crt

Also, you could use these instructions:

DAYS=1460
PASS=$(openssl rand -hex 16)

# remove certificates from previous execution.
rm -f *.pem *.srl *.csr *.cnf


# generate CA private and public keys
echo 01 > ca.srl
openssl genrsa -des3 -out ca-key.pem -passout pass:$PASS 2048
openssl req -subj '/CN=*/' -new -x509 -days $DAYS -passin pass:$PASS -key ca-key.pem -out ca.pem
Related Question