Merge request !1592 broke my testing setup
Matt Selsky
Matthew.Selsky at twosigma.com
Tue Nov 17 03:01:05 UTC 2026
Hal,
On your earlier question, "Is this a bug in OpenSSL?": no. OpenSSL 4.0 changed the default. Its CHANGES.md says certificate verification no longer consults the subject DN by default; the CN is matched only when X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT is set. My commit message for fd749194f quoted the pre-4.0 man page, so its claim that the CN is still checked when there are no DNS SANs is wrong for OpenSSL 4. A CN-only certificate fails there. Built against OpenSSL 1.1.1 through 3.x, it still verifies. That split needs a NEWS entry, and I'll write one.
Your history is right where it matters: since RFC 2818, a client that finds a dNSName SAN ignores the CN, and RFC 9525 (which replaced RFC 6125) drops CN matching entirely. Every name goes in the SAN.
You don't need new keys. Regenerate a CSR from each existing cert and key, then re-sign it with your root, adding the SAN:
openssl x509 -x509toreq -in fed2-old.pem -signkey fed2.key -out fed2.csr
openssl x509 -req -in fed2.csr -CA root.pem -CAkey root.key \
-CAcreateserial -days 825 \
-extfile <(printf 'subjectAltName=DNS:fed2.example.com\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth\n') \
-out fed2.pem
openssl x509 -in fed2.pem -noout -ext subjectAltName
One caution on the recipe James posted: "openssl x509 -req" doesn't copy extensions from the CSR unless you pass -copy_extensions copy (OpenSSL 3.0+) or -extfile, so as written it produces a certificate with no SAN.
On logging, since you asked what's missing: "matching with subject:CN (null)" prints SSL_get0_peername(), which is NULL when nothing matched, so it reads as if the CN were empty. And the "matching with SAN:DNS" branch tests "1 > numgens", which can't be true at that point, so that line never prints. I'll send an MR that logs that no name matched and fixes the branch.
On example.com: certificate matching is a plain string compare, and ntpd does no reverse DNS on NTS-KE servers, so it works. If you ever rename things, RFC 8375 reserves home.arpa for exactly this kind of home LAN.
Cheers,
-Matt
More information about the devel
mailing list