OpenSSL on Fedora 42 aarch64 unexpectedly produces OpenSSH private key (using openssl req -x509)

Thanks for the replies and for testing it on your own system — that’s helpful!

To clarify: yes, my issue is with the admin.key file, not the admin.crt, and you’re absolutely right — your output confirms it is a proper PEM-formatted private key (-----BEGIN PRIVATE KEY-----), as expected from OpenSSL.

I’ve since run the same command in a clean directory (no smart quotes this time), explicitly calling /usr/bin/openssl, and I consistently get an OpenSSH private key (-----BEGIN OPENSSH PRIVATE KEY-----). This happens even outside /etc, with no sudo, in ~/openssl-test.

Here’s what I’ve done to investigate:

  • Verified /usr/bin/openssl → correct binary and RPM match (openssl-3.2.4-3.fc42.aarch64)
  • Verified /lib64/libcrypto.so.3 → correct hash and from openssl-libs
  • rpm -V on both packages → no changes
  • No LD_PRELOAD or suspicious environment variables
  • No tampering detected by aide or clamscan
  • Reinstalled openssl, openssl-libs, crypto-policies, and ca-certificates
  • Still reproducible

This system was originally installed with Fedora 40 and upgraded to 42 via the dnf system-upgrade method (Option B from this Fedora Pi upgrade post).

So at this point, I’m strongly leaning toward a deeper corruption or side-effect from that upgrade path — perhaps some library or config that RPM isn’t tracking, or that was carried over silently.

I’ll likely reinstall Fedora 42 cleanly to confirm the problem disappears — and to restore full confidence in TLS tools like Caddy?