Skip to content

Instantly share code, notes, and snippets.

@kekru
Last active December 30, 2024 09:31
Show Gist options
  • Save kekru/deabd57f0605ed95d5c8246d18483687 to your computer and use it in GitHub Desktop.
Save kekru/deabd57f0605ed95d5c8246d18483687 to your computer and use it in GitHub Desktop.
Add CA cert to local trust store on CentOS, Debian or Ubuntu
  • Open a webpage that uses the CA with Firefox
  • Click the lock-icon in the addressbar -> show information -> show certificate
  • the certificate viewer will open
  • click details and choose the certificate of the certificate-chain, you want to import to CentOS
  • click "Export..." and save it as .crt file
  • Copy the .crt file to /etc/pki/ca-trust/source/anchors on your CentOS machine
  • run update-ca-trust extract
  • test it with wget https://thewebsite.org

On debian and ubuntu the directory is /usr/local/share/ca-certificates/ and the command to update is update-ca-certificates

At least on ubuntu:
Be sure that the filename ends with .crt and that its content starts with -----BEGIN CERTIFICATE----- and ends with -----END CERTIFICATE-----

@chapinese100
Copy link

Excellent post!! thanks.

@BFriedmanWorx
Copy link

For self-signed certs on dev laptops, don't forget to restart your web browser (chrome) so it can see the changes you just made to CentOS.

@BSarmady
Copy link

BSarmady commented Feb 9, 2023

How about CentOS?

@mphani
Copy link

mphani commented Feb 16, 2023

excellent post !! Thanks so much

@lonniev
Copy link

lonniev commented Apr 12, 2023

[CentOS] Firefox will offer to download the full-chain of certificates as a PEM file. Choose that option, copy the downloaded PEM file into /etc/pki/ca-trust/source/anchors, run sudo update-ca-trust extract, and this also updates the CA trust certificate stores (which use /etc/pki/ca-trust files).

@progamernoob
Copy link

"Be sure that the filename ends with .crt"
Just saved me hours. Thank mate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment