Skip to main content

Remove CA certificate from system trust store

Root Certificate Authority (CA) certificates can and do expire. Typically, alternative CAs are available on the system, and often it is the case that a system package update will remove the older expired certificates (for example, the ca-certificates package). Though infrequent, sometimes an expired Root CA might cause issues (for example, OpenSSL 1.0.2x) and needs to be manually removed from your server trust store.

CentOS 7

note

For CentOS 7, there is now an updated package that removes this expired certificate: yum install ca-certificates. You can then check and confirm this is fixed with: rpm -q --changelog ca-certificates | grep "DST ROOT CA X3" -B4 * Tue Sep 14 2021 Bob Relyea <[email protected]> - 2021.2.50-72 - Fix expired certificate. - Removing: - # Certificate "DST Root CA X3"

Backup the trust store:

cp -i /etc/pki/tls/certs/ca-bundle.crt ~/ca-bundle.crt-backup

Identify the CA certificate:

trust list

Add certificate to blacklist directory:

trust dump --filter "pkcs11:id=%c4%a7%b1%a4%7b%2c%71%fa%db%e1%4b%90%75%ff%c4%15%60%85%89%10" | openssl x509 | tee /etc/pki/ca-trust/source/blacklist/DST-Root-CA-X3.pem

Update the system trust store:

update-ca-trust extract

Verify removal:

diff ~/ca-bundle.crt-backup /etc/pki/tls/certs/ca-bundle.crt

Sample output:

$ diff ~/ca-bundle.crt-backup /etc/pki/tls/certs/ca-bundle.crt
860,881d859
< # DST Root CA X3
< -----BEGIN CERTIFICATE-----
< MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
< MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
< DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow
< PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD
< Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
< AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3Z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