<div dir="ltr">Thanks!</div><br><div class="gmail_quote"><div dir="ltr">On Wed, 19 Sep 2018 at 00:50, Viktor Dukhovni <<a href="mailto:openssl-users@dukhovni.org">openssl-users@dukhovni.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> On Sep 18, 2018, at 5:27 PM, ⁨דרור מויל⁩ <⁨<a href="mailto:moyaldror@gmail.com" target="_blank">moyaldror@gmail.com</a>⁩> wrote:<br>
> <br>
> I'm experiencing some unexpected (in my opinion - and I might be in the wrong here) behavior in hostname checking the OpenSSL CLI utils.<br>
<br>
The default behaviour follows:<br>
<br>
   <a href="https://tools.ietf.org/html/rfc6125#section-6.4.4" rel="noreferrer" target="_blank">https://tools.ietf.org/html/rfc6125#section-6.4.4</a><br>
<br>
which says:<br>
<br>
   As noted, a client MUST NOT seek a match for a reference identifier<br>
   of CN-ID if the presented identifiers include a DNS-ID, SRV-ID,<br>
   URI-ID, or any application-specific identifier types supported by the<br>
   client.<br>
<br>
> I'm trying to verify the hostname of a certificate which has CN=<a href="http://mysite.com" rel="noreferrer" target="_blank">mysite.com</a> and altSubj=localhost (was generated by pyca/cryptography example - <a href="https://cryptography.io/en/latest/x509/tutorial/#creating-a-self-signed-certificate" rel="noreferrer" target="_blank">https://cryptography.io/en/latest/x509/tutorial/#creating-a-self-signed-certificate</a>) and the check always fails on hostname mismatch.<br>
<br>
Your certificate is poorly crafted it must list all the desired domains in the<br>
subjectAltName extension, and then may repeat one of them in the Subject CN as<br>
a fallback for legacy software.<br>
<br>
> The thing is, that when the flags=0, X509_check_host will call do_X509_check<br>
> that will verify only the altSubjNames and not the CN in the Subj.<br>
<br>
As expected.<br>
<br>
> I tried to find a way to set the flags to X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT<br>
> using a CLI flag or config but there is no such option.<br>
> <br>
> Was it meant to work like this? am I missing something?<br>
<br>
Obtain a properly crafted certificate and all will be well.<br>
The host flags, are not IIRC exposed via the CLI.  Good luck.<br>
<br>
-- <br>
        Viktor.<br>
<br>
-- <br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/mailman/listinfo/openssl-users</a><br>
</blockquote></div>