SSD Nodes Learn Hosting plans →
Guides Matt ConnorBy Matt Connor

Add or distrust a CA on Rocky and AlmaLinux

Trust a private CA or distrust a bad root on Rocky Linux 9 and AlmaLinux 9 with update-ca-trust, then check your box for the October 2026 eMudhra fix.

Verified Every command ran end-to-end on a fresh Ubuntu 24.04 server, October 28, 2026.

How to add or distrust a CA on Rocky and AlmaLinux

To add or distrust a CA (certificate authority) on Rocky Linux 9 or AlmaLinux 9, put its certificate in one of two folders under /etc/pki/ca-trust/source/. Then run sudo update-ca-trust extract. A file in anchors/ becomes trusted. A file in the distrust folder becomes distrusted. After that, every program that reads the system store sees the change.

This guide builds a throwaway root CA. It makes the server trust that root, then distrust it, and it checks each step with openssl and curl. The last section shows how to check for the late-October 2026 ca-certificates update. If your servers run Ubuntu, the same jobs are covered in adding your own CA to the Ubuntu trust store and distrusting a bundled root CA on Ubuntu. The tools are different on the two families, so do not copy commands from one to the other.

The layout of /etc/pki/ca-trust

RHEL (Red Hat Enterprise Linux) and its rebuilds, Rocky and Alma, keep the trust store in two source trees and one output tree. Look at the source tree first:

ls /etc/pki/ca-trust/source/

Two folders matter here: anchors/ and the distrust folder. Current RHEL 9 documentation and the CentOS Stream 9 ca-certificates package call the distrust folder blocklist. The package changelog says the old blacklist folder was removed in version 2020.2.50-94. Believe your own ls output before any guide, this one included. If it prints blacklist, use that name everywhere this guide says blocklist.

The update-ca-trust(8) man page defines the folders like this:

  • /etc/pki/ca-trust/source/anchors/: each certificate here is trusted for all purposes.
  • /etc/pki/ca-trust/source/blocklist/: each certificate here is distrusted for all purposes.
  • /usr/share/pki/ca-trust-source/: the same structure, owned by the package. The man page gives this tree low priority and /etc/pki/ca-trust/source/ high priority. Put your changes in /etc and never in /usr/share, because a package update rewrites /usr/share.
  • /etc/pki/ca-trust/extracted/: generated output. Applications read these files. The man page says never to edit them by hand, because the next update-ca-trust run overwrites them.

The output tree has one folder for each file format. pem/tls-ca-bundle.pem holds the CAs trusted for TLS (transport layer security) server authentication, in plain PEM (privacy-enhanced mail, the BEGIN CERTIFICATE text format). It has no distrust information: a certificate is either in the file or not in it. openssl/ca-bundle.trust.crt uses the extended BEGIN TRUSTED CERTIFICATE format and holds every trusted or distrusted certificate. java/cacerts is a Java keystore, and edk2/cacerts.bin is for firmware. Distrusted certificates are left out of both of those. The classic path /etc/pki/tls/certs/ca-bundle.crt is a symbolic link into this generated output, so older software that hard-codes that path still gets the current store.

update-ca-trust with no command does the same work as update-ca-trust extract. It only prints fewer warnings, because the package runs it during installation.

Install openssl and curl if they are missing

A minimal image may not include the openssl command-line tool. Check first, and install only if the check fails:

rpm -q openssl || sudo dnf install -y openssl
command -v curl || sudo dnf install -y curl
openssl version

rpm -q openssl prints the package name and version when it is installed. It prints package openssl is not installed when it is not. The last line prints the OpenSSL version that your tests will use.

Build a throwaway root CA and a server certificate

Work in a scratch folder. Nothing in this section touches the system store.

mkdir -p ~/ca-lab && cd ~/ca-lab
openssl req -x509 -newkey rsa:2048 -nodes -days 30 \
  -keyout lab-root.key -out lab-root.crt -subj "/CN=Lab Root CA"
openssl x509 -in lab-root.crt -noout -text | grep -A1 "Basic Constraints"

The grep should print CA:TRUE. That line makes this certificate a CA. Without it, nothing the certificate signs will verify.

Now make a leaf certificate for a made-up host name, lab.internal, and sign it with the root. The SAN (subject alternative name) extension carries the host name. Clients check the SAN, not the common name.

openssl req -newkey rsa:2048 -nodes -keyout lab.key -out lab.csr -subj "/CN=lab.internal"
printf 'subjectAltName=DNS:lab.internal\nbasicConstraints=CA:FALSE\nextendedKeyUsage=serverAuth\n' > lab.ext
openssl x509 -req -in lab.csr -CA lab-root.crt -CAkey lab-root.key \
  -CAcreateserial -days 7 -out lab.crt -extfile lab.ext

Prove the leaf fails before you trust the root

Check the leaf against the system bundle:

openssl verify -CAfile /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem lab.crt

This fails with unable to get local issuer certificate. The bundle does not contain Lab Root CA, so OpenSSL cannot build a chain from the leaf to any certificate it trusts.

Next, test a real TLS connection. openssl s_server is a small test server. -accept 4433 sets its port, and -www makes it answer each client with an HTML status page. Run it in a second terminal, or in the background as shown here:

openssl s_server -accept 4433 -cert lab.crt -key lab.key -www >/dev/null 2>&1 &
curl -sS --resolve lab.internal:4433:127.0.0.1 https://lab.internal:4433/ >/dev/null && echo verified

--resolve maps lab.internal on port 4433 to 127.0.0.1 for this one command. It works like a temporary /etc/hosts line. curl still asks for the name lab.internal and checks the certificate against it. The command prints curl: (60) SSL certificate problem: unable to get local issuer certificate, and it does not print verified. You want to see that failure at this stage.

Add the root to anchors and rebuild the store

sudo cp lab-root.crt /etc/pki/ca-trust/source/anchors/lab-root.crt
sudo update-ca-trust extract

Run both checks again:

openssl verify -CAfile /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem lab.crt
curl -sS --resolve lab.internal:4433:127.0.0.1 https://lab.internal:4433/ >/dev/null && echo verified

openssl verify now prints lab.crt: OK, and curl prints verified. You did not pass --cacert to curl. The only thing that changed between the two runs is the system store. That proves this curl reads the store you just rebuilt.

The store is managed by the p11-kit library. Its trust tool shows what the store now contains:

trust list --filter=ca-anchors | grep -B3 -A2 "Lab Root CA"

You should see an entry whose label: line reads Lab Root CA. The tool has other filters too. blocklist shows distrusted certificates, certificates shows all of them, and the default, trust-policy, shows anchors plus the blocklist.

Red Hat's RHEL 9 documentation describes a second way to add an anchor, without copying files. sudo trust anchor lab-root.crt stores the certificate, and sudo trust anchor --remove lab-root.crt removes it. This guide uses the file copy instead, for two reasons. You can see the result with ls and undo it with rm. A configuration tool such as Ansible can also manage it as a plain file. Use one method on each machine. If you mix them, it becomes hard to tell where an anchor came from.

Distrust a CA on Rocky and Alma

To distrust a CA, you do the same thing with the other folder. Copy the same root into the distrust folder and rebuild. Leave the anchor copy in place for now:

sudo cp lab-root.crt /etc/pki/ca-trust/source/blocklist/lab-root.crt
sudo update-ca-trust extract
trust list --filter=blocklist | grep -B3 -A2 "Lab Root CA"
openssl verify -CAfile /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem lab.crt
curl -sS --resolve lab.internal:4433:127.0.0.1 https://lab.internal:4433/ >/dev/null && echo verified

The root is now in both folders. The update-ca-trust(8) man page does not say which folder wins in this case, and neither does the p11-kit trust module documentation. This guide does not predict the result either. Run the commands and read what each one reports.

How to read the results:

  • If trust list --filter=blocklist shows Lab Root CA, p11-kit has recorded the distrust.
  • If openssl verify still prints lab.crt: OK, the root is still inside tls-ca-bundle.pem. That file cannot mark a certificate as distrusted. A certificate is either in it or not, so this check only tells you whether the extract step left the root in the plain bundle.
  • If curl fails with error 60 again, the curl on your server no longer trusts the root.

One tool's result does not tell you what every program will do. A program that reads the plain PEM bundle can handle this case differently from one that reads ca-bundle.trust.crt or asks p11-kit directly.

On a real server, never leave a CA in both folders. If you added a CA yourself and want it gone, remove it from anchors/. A root that the package ships is different. You cannot remove it from /usr/share, so you put it in the distrust folder in /etc. That folder has high priority, which is why its entries apply on top of the package bundle. For our lab root, the clean state is "distrusted and not anchored":

sudo rm /etc/pki/ca-trust/source/anchors/lab-root.crt
sudo update-ca-trust extract
openssl verify -CAfile /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem lab.crt

This fails with unable to get local issuer certificate again, because nothing anchors Lab Root CA any more. The blocklist entry stays. If someone copies the root back into anchors/ by mistake, you are back in the conflict above, which you can see with trust list, instead of trust silently returning. The p11-kit manual also gives one limit. A distrust entry that names only an issuer and a serial number, with no full certificate, cannot be written to the extracted files. Always put the whole certificate in the distrust folder.

Clean up the lab

kill %1
sudo rm /etc/pki/ca-trust/source/blocklist/lab-root.crt
sudo update-ca-trust extract
rm -rf ~/ca-lab

kill %1 stops the background s_server if you started it from the same shell. If you started it in another terminal, stop it there with Ctrl+C. Never leave a test root in either folder on a production server. Protect lab-root.key like a password while it exists. Anyone who has it can make a certificate for any host name, and every machine that trusts the root will accept that certificate.

Has your server got the October 2026 eMudhra distrust?

Run this section on your own server. It needs live repository metadata.

Red Hat published RHSA-2026:88459, "Critical: ca-certificates security update", on 2026-10-22. Its fix text reads "Distrust eMudhra intermediate CA certificates due to security concerns (CVE-2026-114406)". AlmaLinux published the same fix as ALSA-2026:88459 on 2026-10-23. Rocky Linux published it as RLSA-2026:88459, also on 2026-10-23. For RHEL 9, the advisory lists ca-certificates-2026.2.92_v9.0.319-90.3.el9_8. Red Hat's own pages do not all describe the change the same way. To learn which certificates changed, read the advisory itself, not a summary of it.

Check which package version you have installed, then ask dnf about the advisory:

rpm -q ca-certificates
sudo dnf updateinfo --list --cve=CVE-2026-114406
sudo dnf updateinfo --list --all --cve=CVE-2026-114406

Without --all, dnf lists only advisories for updates you have not installed yet. A line naming RLSA-2026:88459 or ALSA-2026:88459 means the fix is still waiting. With --all, dnf lists installed advisories too. Compare the rpm -q output with the version the advisory lists. Then install the update:

sudo dnf upgrade ca-certificates
sudo dnf updateinfo --info --advisory=RLSA-2026:88459

On AlmaLinux, use the ALSA ID in the last command. The package runs the extract step itself, so you do not need to run update-ca-trust. Restart long-running services that open TLS connections. A process that read the bundle when it started may still hold the old copy in memory. To install only security fixes like this one, see installing only security updates with dnf on Rocky and Alma. To stop doing it by hand, set up automatic updates with dnf-automatic.

Programs that do not read the system store

Java uses /etc/pki/java/cacerts. The package ships that path as a symbolic link to the generated keystore in extracted/java/. Confirm it with ls -l /etc/pki/java/cacerts. A Java runtime that uses its own cacerts file ignores everything in this guide. Distrusted certificates are left out of the generated keystore, so in Java a distrusted root simply looks missing.

Python code that uses certifi brings its own copy of Mozilla's CA bundle in the Python package. python3 -c "import certifi; print(certifi.where())" prints the path of the bundle it uses. A root you add to anchors/ is not in that file. A root you distrust can still be in it.

Node.js can use a CA store built into Node instead of the system store. NODE_EXTRA_CA_CERTS=/path/to/root.pem adds the certificates in a PEM file, and Node reads that variable only when the process starts. --use-system-ca, or NODE_USE_SYSTEM_CA=1 on recent releases, loads the system store. Node's documentation says it does not support distrusting certificates based on system settings. The distrust folder does not stop Node, so handle distrust inside the application.

If you are setting up a new server rather than fixing an old one, start with the first steps to secure a new Rocky Linux server.

FAQ

Where do I put a custom CA certificate on Rocky Linux or AlmaLinux?

Copy the PEM file into /etc/pki/ca-trust/source/anchors/ and run sudo update-ca-trust extract. To check it, run openssl verify -CAfile /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem on a certificate the CA signed. It should print OK. Do not put the file in /etc/pki/ca-trust/extracted/. That folder is rebuilt on every run, so your file would be lost.

Is the distrust folder called blocklist or blacklist?

Current RHEL 9 docs and the CentOS Stream 9 package use /etc/pki/ca-trust/source/blocklist/. The package changelog says the blacklist folder was removed in version 2020.2.50-94. Run ls /etc/pki/ca-trust/source/ on your own server and use the name it prints.

I added a CA but curl still says "unable to get local issuer certificate". Why?

The most common cause is a missed sudo update-ca-trust extract. Without that step, the generated bundle still does not have your root. Run trust list --filter=ca-anchors and look for your CA's label. If the CA is listed and curl still fails, the certificate you copied may not be a CA. Look for CA:TRUE in the output of openssl x509 -noout -text. Another possibility is that the server sends a leaf signed by a different intermediate.

Does distrusting a CA also block it in Java, Python and Node?

Only in Java. Java's /etc/pki/java/cacerts links to the generated keystore, and distrusted certificates are left out of it. Python code that uses certifi reads its own Mozilla bundle, so the system distrust folder has no effect on it. Node's documentation says it does not support distrust based on system settings. Handle Python and Node in each application.

Was this article useful?