Bug #6493

OpenSSL::SSL ignores DN if subjectAltName is specified

Added by djmitche (Dustin Mitchell) over 8 years ago. Updated about 1 year ago.

Target version:
ruby -v:


In ext/openssl/lib/openssl/ssl.rb, verify_certificate_identity seems to intentionally not check the DN if any subjectAltName extensions are found.

RFC3280 says

The subject alternative names extension allows additional identities
to be bound to the subject of the certificate. ...

which suggests that it contains additional identities, and thus does not exclude the subject.

This functionality was added way back in 2005, r7970:

* ext/openssl/lib/openssl/ssl.rb
  (OpenSSL::SSL::SSLSocket#post_connection_check): new method.

and moved around several times since then.

Updated by drbrain (Eric Hodel) over 8 years ago

  • Category set to ext
  • Status changed from Open to Assigned
  • Assignee set to MartinBosslet (Martin Bosslet)
  • Target version set to 2.0.0

Updated by MartinBosslet (Martin Bosslet) over 8 years ago

  • Status changed from Assigned to Feedback
  • Priority changed from Normal to 3

RFC 3280 was obsoleted by 5280 and there, the wording is slightly different:

8<-------- Subject Alternative Name

The subject alternative name extension allows identities to be bound
to the subject of the certificate. These identities may be included
in addition to or in place of the identity in the subject field of
the certificate.


But I think we should orient ourselves at RFC 6125 [1], which
explicitly addresses how to do hostname verification for TLS services.

There, it says:


6.4.4. Checking of Common Names

As noted, a client MUST NOT seek a match for a reference identifier
of CN-ID if the presented identifiers include a DNS-ID, SRV-ID,
URI-ID, or any application-specific identifier types supported by the


Therefore current behavior is in line with this and correct in doing so.
But what's missing is verification of the service type parts and
interpretation of the otherName attributes of type srvName (RFC4985), I
could imagine adding support in the future, especially if CAs start to
follow these recommendations.

But I'll mark this as low prio for now if nobody objects.


Updated by mame (Yusuke Endoh) over 7 years ago

  • Target version changed from 2.0.0 to 2.6

Updated by zzak (Zachary Scott) about 5 years ago

  • Assignee changed from MartinBosslet (Martin Bosslet) to openssl

Updated by jeremyevans0 (Jeremy Evans) about 1 year ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF