-
Notifications
You must be signed in to change notification settings - Fork 776
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require certificates under name constraints use SANs.
The common name fallback does not interact well with name constraints. Until we remove this fallback, we must resolve this conflict. Blindly applying name constraints to the common name will reject "decorative" common names that aren't intended to be hostnames (e.g. [0]). We need to guess based on format whether the common name is a DNS name. It is important this same check is applied to *both* name constraints and name matching, which means the OpenSSL version (see 5bd5dcd49605ca2aa7931599894302a3ac4b0b04, d02d80b2e80adfdde49f76cf7c7af4e013f45005, and 55a6250f1e7336e8a7d89fb609eb23398715ff6f) is unsuitable as a compatibility data point. In theory we could limit this to chains with name constraints, which are uncommon, but X509_check_host sees only the leaf. We must apply it uniformly. That means a strict check risks problems with malformed non-WebPKI setups like [1]. For a first pass, mirror Go's behavior. Like Go, rather than run SAN-less DNS-like common names through name constraints, we simply reject all such certificates. Name constraints now exclude all leaf certificates that can trigger the common name fallback. They are rare enough that we can hopefully hold them to a higher standard. Note this does not make misclassified decorative common names any worse, compared to the checking the name constraint. Such names would not have matched the constraint anyway. Update-Note: This can may cause two kinds of errors: 1. Leaf certificates whose chain contains a name constraint and lack SANs may be rejected with X509_V_ERR_NAME_CONSTRAINTS_WITHOUT_SANS. 2. Leaf certificates which use the common name fallback and verify against an insufficiently DNS-looking hostname may fail with X509_V_ERR_HOSTNAME_MISMATCH. In both cases, the fix is to include the subjectAltName in the certificate, rather than rely on the common name fallback. (Refining the heuristic is also an option, but the two failure modes pull it in opposite directions, so this is tricky.) [0] golang/go#24151 [1] GoogleCloudPlatform/cloud-sql-proxy#194 Change-Id: If25557de428768292a14ba3bdeeffbd74e3a3bf8 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/35665 Reviewed-by: Adam Langley <agl@google.com>
- Loading branch information
Showing
10 changed files
with
349 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.