[Git][NTPsec/ntpsec][master] ntpd/nts_client.c: don't match the CN when SANs exist

Matt Selsky (@selsky) gitlab at mg.gitlab.com
Sat Nov 7 17:15:09 UTC 2026



Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
66aba586 by Matt Selsky at 2026-11-07T17:06:14+00:00
ntpd/nts_client.c: don't match the CN when SANs exist

RFC 8915 section 3 requires clients to follow RFC 6125 when checking
the NTS-KE server's identity, and RFC 6125 section 6.4.4 forbids
matching the subject Common Name when the certificate has DNS names
in its Subject Alternative Name. "Fix derecation warning from OpenSSL
4.1.0-alpha1" set X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT so that a
self-signed test certificate would match by CN, which makes OpenSSL
accept a certificate whose CN, but none of whose DNS SANs, names the
server.

Drop the flag. Without it, X509_check_host(3) documents that the CN
is still checked when a certificate has no DNS SANs. A test
certificate that relies on its CN needs the name added as a DNS SAN,
or the client's server line needs noval.

- - - - -


1 changed file:

- ntpd/nts_client.c


Changes:

=====================================
ntpd/nts_client.c
=====================================
@@ -497,7 +497,7 @@ void set_hostname(SSL *ssl, const char *hostname) {
  * of wildcards to make it clear that they're permitted unless specifically
  * prohibited in an RFC
  */
-        SSL_set_hostflags(ssl, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS | X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT);
+        SSL_set_hostflags(ssl, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);
 #if OPENSSL_VERSION_NUMBER >= 0x40000000L
 {
         sockaddr_u addr;



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/66aba586b59d05fa9d3deecf653f609a1f5f02a3

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/66aba586b59d05fa9d3deecf653f609a1f5f02a3
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20261107/932f3b02/attachment.htm>


More information about the vc mailing list