Rocky Linux 10 Tutorial / Diagnose SSH and TLS cryptographic compatibility errors

When an SSH or TLS connection fails on Rocky Linux 10, first compare the algorithms and protocols supported on both sides, the effective settings, and the identity being authenticated . Immediately relaxing the system-wide cryptographic policy can hide the cause or affect other services. Diagnose negotiation failures separately from key and certificate verification failures.

Distinguish between system policies and actual service settings

The system-wide cryptographic policy supplies algorithm settings for participating cryptographic libraries and services. SSH (Secure Shell) remote access or TLS (Transport Layer Security) secure connections can be affected by it. However, applications must use the system settings, and some programs may limit operation with their own options or use separate configurations.

update-crypto-policies --show
update-crypto-policies --is-applied
update-crypto-policies --check
rpm -q crypto-policies crypto-policies-scripts openssh-server
ssh -V
sudo sshd -T -C user=lfstudent,addr=10.0.2.2,host=localhost \
  | grep -E '^(kexalgorithms|ciphers|macs|hostkeyalgorithms|pubkeyacceptedalgorithms) '

The above command is executed on the Rocky VM. Adjust the account, source, and host in sshd -T -C to match the actual connection conditions to be checked. In this tutorial, the Windows host connection appeared as 10.0.2.2 on the guest through NAT. If other conditions are applied, the results of Match settings may also differ.

The source VM policy was DEFAULT, and both --is-applied and --check succeeded. The installed crypto-policies version is 20260216-1.git0e54016.el10_2.2, and the OpenSSH server is 9.9p1-29.el10_2.rocky.0.1. Simply knowing the version and policy name does not guarantee a successful connection with a specific counterpart.

As described in the update-crypto-policies command manual, --is-applied checks whether the selected policy is applied, and --check checks if the current generated settings match the policy. It does not test the values actually read by the service process or the algorithms proposed by the counterpart. Policy changes require a plan for applications to adopt the new settings. The upstream RHEL 10 guide to system-wide cryptographic policies recommends restarting the system after a policy change. This source diagnosis changed neither the policy nor the SSH server configuration.

Check the support list, effective list, and negotiation results separately.

Key Exchange (KEX) is the process of agreeing on secret values to use in communication. Its role is different from that of cryptographic algorithms, message authentication, server host keys, and user login keys. By distinguishing the following list, you can reduce misinterpretation of error messages.

Items to Check How to Query Meaning
Supported List of Client Implementations ssh -Q kex This is the method implemented in the program and does not necessarily match the currently allowed list.
Client Settings for a Specific Target ssh -G and Target/Options Effective client values reflecting the Host settings and command-line options.
Server Settings for Connection Conditions sshd -T -C Effective server values according to conditions such as account and source.
Actually Selected Method New connection with ssh -vv Shows both the actual negotiation result and the failure step.

Run the server checks and client checks on their respective computers. In Windows PowerShell, use the existing dedicated key from the SSH key and host-key verification lesson . The server host key must already be verified against a fingerprint obtained through a trusted console and registered in the client known-hosts file.

$Key = Join-Path $env:USERPROFILE '.ssh/rocky10-lab'
ssh -V
ssh -Q kex
ssh -G -p 22222 lfstudent@127.0.0.1 | Select-String '^(kexalgorithms|ciphers|hostkeyalgorithms|pubkeyacceptedalgorithms) '

If the key file is in a different path, replace it with the actual value. ssh -G is not a command to access the network. If a separate -o option is used for the connection you want to compare, use the same option for the query. OpenSSH client configuration manual explains KexAlgorithms and how to check the support list.

Reproduce a connection with SSH key exchange mismatch.

The source lab compared the Windows OpenSSH 9.5p2 client and the OpenSSH 9.9p1 server on Rocky Linux 10.2. Since the Rocky Linux server policy does not change the Windows client settings themselves, check both separately. The first command below is for reproducing the failure . Only diffie-hellman-group14-sha1 is specified for this connection on the client, and the server or permanent client settings are not changed.

ssh -vv -p 22222 -i $Key -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o PreferredAuthentications=publickey -o KexAlgorithms=diffie-hellman-group14-sha1 lfstudent@127.0.0.1 'id -un'
$LASTEXITCODE

This client implementation had that method, but it was not in the effective allowed list on the server. The result was exit status 255 and the following error. Their offer is followed by the method proposed by the server.

no matching key exchange method found

This error occurs before checking the registration of the user's public key. In this situation, rewriting authorized_keys or turning on password authentication is not the appropriate measure for the cause.

Now remove only the failure reproduction option and make a new connection to the same target. The host key verification and key authentication conditions are maintained.

ssh -vv -p 22222 -i $Key -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o PreferredAuthentications=publickey lfstudent@127.0.0.1 'id -un'
$LASTEXITCODE

Under normal conditions, the new public key authentication was successful. In the actual diagnostic output, the key exchange was negotiated as curve25519-sha256, the server host key as ssh-ed25519, and the cipher as chacha20-poly1305@openssh.com. This is the result of this version and configuration, and it does not mean that all clients will choose the same values.

no matching host key type may be an issue with the key method used for server identification, and Permission denied (publickey) may be an issue at the user authentication stage. In the OpenSSH compatibility guide , algorithm types are also distinguished. As explained in the signature change of OpenSSH 8.8 , the SHA-1 signature method of ssh-rsa and the RSA key itself are not the same thing. Since SHA-2 signatures supported by the same RSA key can be used, it cannot be concluded that old signatures must be re-allowed just because an RSA key is used.

Prepare a local TLS server and a test certificate.

In TLS, the trust and name of the server certificate are verified separately from protocol and cipher negotiations. The practice below uses only 127.0.0.1:25443 within the same Rocky VM. The source VM initially lacked the OpenSSL command, so the source lab installed the openssl package. Its command and library versions were 3.5.8.

sudo dnf install openssl
openssl version
sudo ss -lntp '( sport = :25443 )'

If another program is listening on 25443, stop this procedure and choose a free test port consistently in all commands. The following is an example executed on a general user terminal of a VM. Create a self-signed trial certificate and key valid for one day in a new dedicated directory under the home directory. Do not overwrite existing directories.

bash <<'BASH'
set -eu
dir="$HOME/lf-tls19"
test ! -e "$dir"
umask 077
mkdir "$dir"
openssl req -x509 -newkey rsa:2048 -noenc \
  -keyout "$dir/key.pem" -out "$dir/cert.pem" -days 1 \
  -subj /CN=localhost \
  -addext 'subjectAltName=IP:127.0.0.1,DNS:localhost'
chmod 600 "$dir/key.pem"
openssl x509 -in "$dir/cert.pem" -noout -subject -dates
BASH

The OpenSSL req documentation describes -addext, used here to add certificate name information. Put 127.0.0.1 and localhost in the SAN (Subject Alternative Name) for use in name verification. The private key is a file for this temporary server and is not to be output or shared. -noenc saves the private key without a passphrase as a trial condition, so maintain the dedicated directory and permissions and clean up after practice.

Start and leave open the following server in the same terminal. Specifying to accept only TLS 1.2 is for reproducing version mismatches. This is not an example recommending disabling TLS 1.3 in production services.

openssl s_server -accept 127.0.0.1:25443 \
  -cert "$HOME/lf-tls19/cert.pem" -key "$HOME/lf-tls19/key.pem" \
  -www -tls1_2

OpenSSL s_server is a test server tool. While the server is running, test connections from another VM terminal. In the source automated verification, the same server options were run in a dedicated one-time systemd unit, and the temporary certificate materials were placed in a root-only directory. Distinguish between normal user foreground execution in the main text and its operational method.

Compare TLS version mismatch with normal verification.

The first request only proposes TLS 1.3. The test server only accepts 1.2, so there is no common protocol. All TLS client commands are executed inside the VM.

openssl s_client -connect 127.0.0.1:25443 -servername localhost \
  -tls1_3 -CAfile "$HOME/lf-tls19/cert.pem" \
  -verify_ip 127.0.0.1 -verify_return_error -brief < /dev/null

The result was exit status 1 and alert protocol version error. Even if the system policy is DEFAULT, the service command restricts acceptance to 1.2, so this request failed. There is no reason to relax the system policy to resolve this failure.

In the next request, the client also uses 1.2. Only the test certificate is designated as trusted for this command, and IP address verification and stop-on-verification-error are maintained. The test certificate is not registered in the system certificate store.

openssl s_client -connect 127.0.0.1:25443 -servername localhost \
  -tls1_2 -CAfile "$HOME/lf-tls19/cert.pem" \
  -verify_ip 127.0.0.1 -verify_return_error -brief < /dev/null

This time, it connected with exit status 0, and the output included Protocol version: TLSv1.2 and Verification: OK. The actual negotiated cipher was ECDHE-RSA-AES256-GCM-SHA384. The SNI (Server Name Indication) option -servername that passes the server name and -verify_ip that checks the certificate IP have different roles.

HTTPS (Hypertext Transfer Protocol Secure) requests can also be verified using the same test certificate.

curl --noproxy '*' --cacert "$HOME/lf-tls19/cert.pem" \
  --tlsv1.2 --tls-max 1.2 --max-time 5 -sS -o /dev/null \
  -w 'HTTP %{http_code}\n' https://127.0.0.1:25443/

The actual result was HTTP 200. The source comparison retained certificate verification and fixed the protocol by specifying --tlsv1.2 along with the upper limit --tls-max 1.2.

Even if the protocol matches, examine the certificate name separately.

The last request checks a name not on the certificate while maintaining TLS 1.2. wrong.example is the mismatch name for this test and is not a command to access the domain.

openssl s_client -connect 127.0.0.1:25443 -servername localhost \
  -tls1_2 -CAfile "$HOME/lf-tls19/cert.pem" \
  -verify_hostname wrong.example -verify_return_error -brief < /dev/null

The server address and TLS version remain the same, but the result was termination status 1 and hostname mismatch. It is necessary to check if it connects with the actual name, whether that name is in the certificate SAN, and whether the validity period and issuance chain are correct. Algorithm compatibility and certificate identity verification are not treated as the same issue.

OpenSSL s_client official description states that this tool can continue even after a certificate error during diagnosis. Therefore, in this example, a verification failure with -verify_return_error is treated as an actual failure. Do not judge verification as successful merely because the certificate was displayed on the screen.

Comparison conditions Actual result First target to investigate
Specified KEX in SSH client that the server does not allow No matching key exchange, exit 255 Allowed key exchange list on both sides
Remove the corresponding SSH option New public key authentication successful Confirmed normal negotiation under the same server policy
TLS 1.3-only client → 1.2-only server Protocol version error, exit 1 Protocol minimum·maximum version
TLS 1.2 with proper trust·IP verification Verification OK, HTTPS 200 Normal comparison reference
TLS 1.2 but verifying a different name Hostname mismatch, exit 1 Connection Name and Certificate SAN

Choose a scoped remedy and clean up the lab

If the actual counterpart only supports outdated methods, first check whether it is possible to update the counterpart's software, firmware, certificates, and key configurations. Also investigate whether there are unnecessarily restrictive settings in the client configuration. If an exception is absolutely necessary, review whether it can be limited to the target service and connection, and consider the application period and conditions for reverting. The source lab did not enable weak methods by default or perform LEGACY policy conversion.

Global encryption policies can change several services at once, and it cannot be assumed that one policy name will restore all of the counterpart's outdated functions. Changes that may disconnect existing management access due to service restarts require separate recovery plans such as verifying a new SSH connection and console recovery .

End the server in the test server terminal using Ctrl+C. Inspect the dedicated directory and certificate, then remove only the temporary key and certificate created for this test. If there are other files, do not add them to the deletion target; just check them.

ls -la "$HOME/lf-tls19"
openssl x509 -in "$HOME/lf-tls19/cert.pem" -noout -subject -dates
rm -- "$HOME/lf-tls19/key.pem" "$HOME/lf-tls19/cert.pem"
rmdir "$HOME/lf-tls19"
sudo ss -lntp '( sport = :25443 )'
update-crypto-policies --show
update-crypto-policies --check

In the source verification, the dedicated TLS unit was stopped, certificate fingerprints and dedicated paths were checked, and temporary keys and authentication materials were removed. The policy remained DEFAULT, and the encryption policy files, symbolic links, SSH server settings, and firewall matched the originals. The OpenSSL diagnostic package was left intact, and the existing SSH access paths and SELinux Enforcing were maintained.