<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<p class="details" style="font-style: italic; color: #666;">
<a href="https://gitlab.com/robertsuska">Robert Suska</a> created an issue: <a href="https://gitlab.com/gnutls/gnutls/-/issues/1223">#1223</a>
</p>
<div></div>
<h2 dir="auto">
<a id="user-content-description-of-problem" class="anchor" href="#description-of-problem" aria-hidden="true"></a>Description of problem:</h2>
<p dir="auto">I've noticed that when GnuTLS checks name constraints during validation of X.509 certificates, it performs a case-sensitive matching on DNS names. I think this is a bug, since <a href="https://www.rfc-editor.org/rfc/rfc5280.txt" rel="nofollow noreferrer noopener" target="_blank">RFC 5280</a> (article 7.2) says <em>"When evaluating name constraints, conforming implementations MUST perform a case-insensitive exact match on a label-by-label basis."</em>.</p>
<h2 dir="auto">
<a id="user-content-version-of-gnutls-used" class="anchor" href="#version-of-gnutls-used" aria-hidden="true"></a>Version of gnutls used:</h2>
<p dir="auto">3.6.14</p>
<h2 dir="auto">
<a id="user-content-distributor-of-gnutls-eg-ubuntu-fedora-rhel" class="anchor" href="#distributor-of-gnutls-eg-ubuntu-fedora-rhel" aria-hidden="true"></a>Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)</h2>
<p dir="auto">RHEL 8.3</p>
<h2 dir="auto">
<a id="user-content-how-reproducible" class="anchor" href="#how-reproducible" aria-hidden="true"></a>How reproducible:</h2>
<p dir="auto"><a href="https://gitlab.com/gnutls/gnutls/uploads/fb73fc696d5db4bf969a6e7556c5046d/example_chain.zip" data-link="true" class="gfm">example_chain.zip</a> contains three certificates, where</p>
<p dir="auto"><em>root_ca.pem</em> specifies a single name constraint:</p>
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">X509v3 Name Constraints: critical</span>
<span id="LC2" class="line" lang="plaintext">    Permitted:</span>
<span id="LC3" class="line" lang="plaintext">      DNS:example.com</span></code></pre>
<p dir="auto"><em>server_ok.pem</em> has an alternative name:</p>
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">X509v3 Subject Alternative Name:</span>
<span id="LC2" class="line" lang="plaintext">    DNS:test.example.com</span></code></pre>
<p dir="auto"><em>server_error.pem</em> has an alternative name:</p>
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">X509v3 Subject Alternative Name:</span>
<span id="LC2" class="line" lang="plaintext">    DNS:test.EXAMPLE.COM</span></code></pre>
<p dir="auto">a the following two commands need to be run:</p>
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">certtool --load-ca-certificate root_ca.pem --verify-profile low --verify --infile server_ok.pem</span></code></pre>
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">certtool --load-ca-certificate root_ca.pem --verify-profile low --verify --infile server_error.pem</span></code></pre>
<h2 dir="auto">
<a id="user-content-actual-results" class="anchor" href="#actual-results" aria-hidden="true"></a>Actual results:</h2>
<p dir="auto">The validation result for the first chain (with <em>server_ok.pem</em>) is</p>
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">Chain verification output: Verified. The certificate is trusted.</span></code></pre>
<p dir="auto">while the validation result for the second chain (with <em>server_error.pem</em>) is</p>
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">Chain verification output: Not verified. The certificate is NOT trusted. The certificate chain violates the signer's constraints.</span></code></pre>
<h2 dir="auto">
<a id="user-content-expected-results" class="anchor" href="#expected-results" aria-hidden="true"></a>Expected results:</h2>
<p dir="auto">It would be expected that both chains are validated successfully.</p>
<h2 dir="auto">
<a id="user-content-note" class="anchor" href="#note" aria-hidden="true"></a>Note:</h2>
<p dir="auto">For reference, I've also included a <a href="https://gitlab.com/gnutls/gnutls/uploads/8dd73b9f217b6f3539a8b21fd9919835/real_world_example_chain.zip" data-link="true" class="gfm">real_world_example_chain.zip</a>.</p>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/1223">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/58521454ec9e2b7aa3912120abc1aa64/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/1223"}}</script>


</p>
</div>
</body>
</html>