update-crypto-policies on Rocky and AlmaLinux
Your Rocky or Alma server refuses an old TLS or SSH peer? Fix one connection or add a small policy module first, and keep full LEGACY as the last resort.
Why update-crypto-policies blocks your old peer
On Rocky Linux 9 and AlmaLinux 9, update-crypto-policies sets one cryptographic policy for the whole system, and most crypto libraries on the box read their allowed protocols and algorithms from it. OpenSSL, GnuTLS, NSS and OpenSSH all take their limits from that one setting. So when your VPS cannot reach an old HTTPS site, SMTP (mail) server, LDAP (directory) server or SSH (Secure Shell) device, the application is often fine. The system policy refuses the protocol or the algorithm that the old peer offers.
This guide reads the policy and shows exactly what it writes into each library's config. Then it fixes the problem with the smallest change that works. The order matters. First fix or front the old server. Then change one connection. Then add a small custom module. Full LEGACY comes last, because it weakens every program on the box, and on release 9 it does less than most people expect.
Check which versions you are on
Everything below depends on the crypto-policies package version, so check it first.
grep -E '^(NAME|VERSION_ID)=' /etc/os-release
rpm -q crypto-policies openssl openssh-clientsAs of 12 November 2026, the Rocky 9 and Alma 9 BaseOS repositories both carry crypto-policies 20260224, built from upstream commit ea0f072. The Rocky 9 repository carries OpenSSL 3.5.8 and OpenSSH 9.9p1. Facts about policy contents in this guide come from that package's source and from Red Hat's RHEL 9 documentation. If rpm -q shows a different crypto-policies version, read its changelog with rpm -q --changelog crypto-policies | head -20 before you trust anything here. Rocky and Alma ship the same package, so the commands are the same on both. Where the two distros do differ is covered in Rocky Linux vs AlmaLinux.
Is update-crypto-policies installed?
The policy data and the tool are two separate packages. In the current CentOS Stream 9 package spec, crypto-policies holds the policies and the back-end files, and crypto-policies-scripts holds /usr/bin/update-crypto-policies (and fips-mode-setup). A minimal image can have the first package without the second.
command -v update-crypto-policies || echo "update-crypto-policies is not installed"
rpm -qf /usr/bin/update-crypto-policiesrpm -qf names the package that owns the file. If the tool is missing, install it:
sudo dnf install -y crypto-policies-scripts
update-crypto-policies --show--show prints the active policy. A plain policy prints one name. A policy with modules prints the names joined by colons, such as DEFAULT:SHA1 in Red Hat's examples. Write down what yours prints, because you will set it back to exactly that later.
Which policies and modules does the box have?
ls /usr/share/crypto-policies/policies/
ls /usr/share/crypto-policies/policies/modules/
ls /etc/crypto-policies/policies/modules/A file ending in .pol is a full policy. A file ending in .pmod is a subpolicy, called a module, which you stack on top of a policy with a colon. The shipped files live under /usr/share. Your own go under /etc/crypto-policies/policies/. Red Hat's RHEL 9 docs describe four predefined policies: DEFAULT, LEGACY, FUTURE and FIPS. Trust your own ls output over any list, including one in a guide, because the set changes between releases. Release 10 dropped a module that release 9 docs still teach (see the section on release 10 below).
How the policy reaches OpenSSL and OpenSSH
The tool writes one file per library into /etc/crypto-policies/back-ends/. Two of them matter most here. opensslcnf.config is read by OpenSSL. openssh.config is read by the ssh client, and opensshserver.config is the one for sshd. Each library pulls its file in from its own config, which you can see:
ls -l /etc/crypto-policies/back-ends/
grep -n crypto-policies "$(openssl version -d | cut -d'"' -f2)/openssl.cnf"
grep -rn crypto-policies /etc/ssh/ssh_config /etc/ssh/ssh_config.d/openssl version -d prints the directory OpenSSL reads its config from, and the grep shows the line that includes the policy file.
The package source tells you which lines can change. The OpenSSL generator writes CipherString, Ciphersuites, TLS.MinProtocol, SignatureAlgorithms and Groups. When the policy allows SHA-1 hashes, it also adds rh-allow-sha1-signatures = yes. The @SECLEVEL value inside CipherString comes only from the policy's minimum RSA and DH (Diffie-Hellman) sizes: below 1023 bits gives level 0, below 2048 gives level 1, below 3072 gives level 2, and 3072 or more gives level 3. The OpenSSH generator writes Ciphers, MACs, KexAlgorithms, PubkeyAcceptedAlgorithms, CASignatureAlgorithms and RequiredRSASize for the client.
What does switching DEFAULT to LEGACY change?
Do not guess. Take a copy of the back-end files, switch, compare, and switch back. Do this on a test server, because every program started while LEGACY is active runs with it.
update-crypto-policies --show
sudo cp -rL /etc/crypto-policies/back-ends /root/back-ends.DEFAULT
sudo update-crypto-policies --set LEGACY
sudo diff -r /root/back-ends.DEFAULT /etc/crypto-policies/back-endscp -rL copies the contents of the files, not the symlinks, so the copy stays the same after the switch. If --show did not print DEFAULT, name the copy after what it printed. In the diff, look at the CipherString and TLS.MinProtocol lines in opensslcnf.config. In openssh.config, look at Ciphers, KexAlgorithms, PubkeyAcceptedAlgorithms and RequiredRSASize.
Compare what you see with the source. In this package, DEFAULT.pol and LEGACY.pol both contain protocol@TLS = TLS1.3 TLS1.2 DTLS1.2, and both contain min_rsa_size = 2048 and min_dh_size = 2048. Because the security level is computed from those two sizes, LEGACY on release 9 keeps the same TLS (transport layer security) minimum and the same @SECLEVEL. What LEGACY.pol adds includes SHA-1 in the hash and signature lists. Red Hat's RHEL 9 crypto policy docs say the same: LEGACY allows only TLS 1.2 and 1.3, with SHA-1 allowed and keys of at least 2048 bits. The upstream Fedora man page on the master branch describes LEGACY with TLS 1.0 and 1.1. That text is for Fedora. The man page in the release 9 package (man crypto-policies) says TLS 1.2 and 1.3. The practical result: a peer that only speaks TLS 1.0, or that has a 1024-bit RSA key, is still out of reach after you switch the whole box to LEGACY.
Now read what the tool printed, and switch back:
sudo update-crypto-policies --set DEFAULT
sudo diff -r /root/back-ends.DEFAULT /etc/crypto-policies/back-ends && echo "identical to the copy"
update-crypto-policies --is-applied && echo "policy applied"Red Hat's docs show this output for --set DEFAULT:SHA1:
Setting system policy to DEFAULT:SHA1
Note: System-wide crypto policies are applied on application start-up.
It is recommended to restart the system for the change of policies
to fully take place.Trust what your own box prints over this. The cause behind the note is in the man page: by default the tool makes some running applications reload the policy, and every other program keeps the settings it loaded at start. A long-running server such as httpd has to be restarted. So after any --set, restart the services that talk to the old peer, or reboot. The same discipline you use for finding which services need a restart after updates applies here.
Diagnose the old peer before you change anything
These tests need outbound network access to the real peer, so run them yourself. Replace old.example.com with your peer.
openssl s_client -connect old.example.com:443 -servername old.example.com -tls1_2 </dev/null
openssl s_client -connect old.example.com:443 -servername old.example.com -tls1_2 -cipher 'DEFAULT:@SECLEVEL=1' </dev/null
openssl s_client -connect old.example.com:443 -servername old.example.com -tls1 -cipher 'DEFAULT:@SECLEVEL=0' </dev/null-servername sends SNI (server name indication), which many HTTPS servers need. -cipher replaces the cipher list for TLS 1.2 and below, and @SECLEVEL=n inside it sets the OpenSSL security level for this one connection. The OpenSSL 3.5 docs define the levels. Level 1 forbids SHA-1 and MD5 signatures and disables TLS 1.0 and 1.1. Level 2 also forbids RSA, DSA and DH keys below 2048 bits, and RC4. So if the second command connects and the first does not, the peer needs something level 2 forbids. Look at the Server public key is line in the output for the key size. If only the third command connects, the peer needs TLS older than 1.2 or a SHA-1 signature.
-cipher changes only the cipher list and the level. The policy's other lines, such as SignatureAlgorithms and TLS.MinProtocol, still apply to s_client, so a failure at level 0 does not prove the peer is unreachable from every client. For mail and directory servers, use STARTTLS:
openssl s_client -connect mail.example.com:25 -starttls smtp </dev/null
openssl s_client -connect ldap.example.com:389 -starttls ldap </dev/nullIf the handshake works but the error is about an untrusted certificate, the policy is not the problem. That is a trust store question, covered in adding or distrusting a CA on Rocky and Alma.
For SSH, run ssh -v admin@192.0.2.10 and read the Unable to negotiate line. Its Their offer: part lists what the peer offers. Compare that with what your client can do at all, with ssh -Q kex and ssh -Q sig. If you also manage Ubuntu servers, the same error there is covered in fixing the no matching key exchange method error on Ubuntu.
Fix 1: fix or front the old server
The best fix leaves your VPS alone. Upgrade the peer's TLS library, or replace its 1024-bit key. If you do not control the peer, put a small machine next to it that speaks the old protocol to the peer and modern TLS to you, such as a reverse proxy on the same private network. The weak settings then live on one isolated box.
For SSH, be careful about what a jump host does. ssh -J jump.example.com admin@192.0.2.10 makes an SSH connection to the jump host and then a TCP forwarding to the target. The key exchange with the old device still happens on your own client, under your own policy. A jump host helps only when you log in to it and run ssh from there, with the weaker settings on that box instead of on yours.
Fix 2: change one connection
For one-off TLS checks, the s_client flags above are the per-connection override. Red Hat's docs show the same idea for curl, with @SECLEVEL inside --ciphers. Many server programs have their own cipher setting that applies to one service only.
For SSH, a Host block in ~/.ssh/config changes one peer and nothing else:
Host oldswitch
HostName 192.0.2.10
User admin
KexAlgorithms +diffie-hellman-group14-sha1
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsaAdd only the lines that the Their offer: output asks for. This works because ssh reads ~/.ssh/config before the system files, and for each directive the first value it finds wins. A leading + appends the named algorithms to OpenSSH's default set. Check the result:
ssh -G oldswitch | grep -iE '^(kexalgorithms|hostkeyalgorithms|pubkeyacceptedalgorithms) '
ssh oldswitchssh -G prints the settings after it evaluates Host blocks, so you see the list this host really gets. For a single test without editing a file, use ssh -o KexAlgorithms=+diffie-hellman-group14-sha1 admin@192.0.2.10. If the algorithm is missing from ssh -Q kex, no config line can add it. Go back to Fix 1.
Fix 3: a small custom .pmod module
When several programs need the same exception, a module is cleaner than many per-program overrides. A module changes only the keys it names. Scopes such as @SSH or @TLS limit a change to one protocol. Module file names must be upper case, apart from the .pmod suffix.
This module allows SHA-1 for SSH only. It covers ssh-rsa signatures, and SHA-1 key exchange where the policy already allows that exchange and group:
sudo tee /etc/crypto-policies/policies/modules/SSH-SHA1.pmod >/dev/null <<'EOF'
# Allow SHA-1 for SSH only, for one old device
hash@SSH = SHA1+
sign@SSH = RSA-SHA1+
EOF
sudo update-crypto-policies --set DEFAULT:SSH-SHA1
update-crypto-policies --show
sudo diff -r /root/back-ends.DEFAULT /etc/crypto-policies/back-ends
grep -n SHA1 /etc/crypto-policies/state/CURRENT.pol | headThe trailing + appends a value to the list. In the generator source, RSA-SHA1 maps to ssh-rsa, and DHE with FFDHE-2048 and SHA1 maps to diffie-hellman-group14-sha1. Red Hat's example notes that @SSH covers libssh and OpenSSH, which means the server side too. The client generator also answers to @openssh-client in the source, which leaves sshd out. If you use it, confirm it in the diff.
The diff is your test. A narrow module gives a narrow diff. If it touches opensslcnf.config, the module is wider than you meant. Restart the affected services or reboot, then connect to the old device again.
To revert, set the old policy and delete the file. Then prove the back-ends match your copy:
sudo update-crypto-policies --set DEFAULT
sudo rm /etc/crypto-policies/policies/modules/SSH-SHA1.pmod
sudo diff -r /root/back-ends.DEFAULT /etc/crypto-policies/back-ends && echo "identical to the copy"Last resort: full LEGACY
sudo update-crypto-policies --set LEGACY weakens every program on the box at once. That includes sshd, dnf, Kerberos and every program that uses OpenSSL, such as your web server. Red Hat's own docs warn that LEGACY also enables many other algorithms that are not secure. On release 9 it also keeps the TLS 1.2 minimum and the 2048-bit key floor, as the source shows, so it does not fix the two most common old-peer problems. Use it only after you have read the diff and know that it fixes your case. Leave a note in your runbook, and set the policy back with --set DEFAULT when the peer is gone. A box built with a hardened new Rocky Linux server setup should not quietly run LEGACY for years.
What changes on release 10
This section is documented behaviour, not output measured on a release 9 box. The CentOS Stream 10 crypto-policies changelog records "Shape up RHEL-10: remove SHA1 subpolicy" and, on 25 July 2024, "LEGACY: disable sign = *-SHA1". So a release 9 server set to DEFAULT:SHA1, or relying on LEGACY for SHA-1 signatures, loses that exception on release 10. Run update-crypto-policies --show before any upgrade, including an in-place AlmaLinux 9 to 10 upgrade with ELevate. If it prints anything other than DEFAULT, read Red Hat's RHEL 10 crypto policy chapter and its cryptographic changes in RHEL 10 for the supported replacements before you upgrade.
FAQ
How do I see the current crypto policy on Rocky Linux or AlmaLinux?
Run update-crypto-policies --show. It prints the policy name, plus any modules joined by colons, such as DEFAULT:SHA1. If the command is not found, it is in the crypto-policies-scripts package, so install it with sudo dnf install -y crypto-policies-scripts. rpm -qf /usr/bin/update-crypto-policies confirms which package owns the tool.
Does LEGACY re-enable TLS 1.0 on Rocky 9 or Alma 9?
No. In the crypto-policies 20260224 package that both distros ship, LEGACY.pol has the same protocol@TLS = TLS1.3 TLS1.2 DTLS1.2 line as DEFAULT, and Red Hat's RHEL 9 docs say LEGACY allows only TLS 1.2 and 1.3. Its minimum RSA and DH size is also 2048 bits, so the OpenSSL security level does not drop. Confirm it on your box by comparing /etc/crypto-policies/back-ends/ before and after the switch with diff -r.
Do I need to reboot after update-crypto-policies --set?
Programs read the policy when they start. The tool makes some running applications reload by default, but anything else keeps the old settings until you restart it. A long-running server such as httpd has to be restarted. Red Hat recommends a reboot so that the change fully takes place. At minimum, restart every service that talks to the old peer.
Why does a jump host not fix "no matching key exchange method found"?
With ssh -J, your client makes a TCP forwarding through the jump host and then does the key exchange with the target itself. Your own policy still decides which algorithms you offer. Either add a Host block with KexAlgorithms +<algorithm> on your client, or log in to the jump host and run ssh from there.
What happens to DEFAULT:SHA1 when I upgrade to release 10?
The CentOS Stream 10 crypto-policies changelog records that the SHA1 subpolicy was removed, and that SHA-1 signatures were disabled in LEGACY. A server that depends on either will lose that exception after the upgrade. Run update-crypto-policies --show first, and read Red Hat's RHEL 10 crypto policy docs for the supported replacement before you upgrade.