open-vault/builtin/logical
Alexander Scheel 1877fc16d7
Fix broken interactions between glob_domains and wildcards (#14235)
* Allow issuance of wildcard via glob match

From Vault v1.8.0 onwards, we would incorrectly disallow issuance of a
wildcard certificate when allow_glob_domain was enabled with a
multi-part glob domain in allowed_domains (such as *.*.foo) when
attempting to issue a wildcard for a subdomain (such as *.bar.foo).

This fixes that by reverting an errant change in the case insensitivity
patch. Here, when validating against a very powerful glob construct, we
leave the wildcard prefix (*.) from the raw common_name element, to
allow multi-part globs to match wildcard entries.

It is important to note that "sanitizedName" is an incorrect variable
naming here. Wildcard parsing (per RFC 6125 which supercedes RFC 2818)
must be in the left-most segment of the domain, but we lack validation
to ensure no internal wildcards exist. Additionally per item 3 of
section 6.4.3 of RFC 6125, wildcards MAY be internal to a domain
segment, in which case sanitizedName again leaves the wildcard in place.

Resolves: #13530

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Remove duplicate email address check

As pointed out by Steven Clark (author of the removed conditional in
70012cd865b3dcdab376dba0c0e0abc88c48f508), this is duplicate from the
now-reintroduced comparison against name (versus the erroneous
sanitizedName at the time of his commit).

This is a reversion of the changes to builtin/logical/pki/cert_util.go,
but keeping the additional valuable test cases.

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add multi-dimensional PKI role issuance tests

This commit introduces multi-dimensional testing of PKI secrets engine's
role-based certificate issuance with the intent of preventing future
regressions.

Here, dimensions of testing include:

 - AllowedDomains to decide which domains are approved for issuance,
 - AllowBareDomains to decide if raw entries of AllowedDomains are
   permitted,
 - AllowGlobDomains to decide if glob patterns in AllowedDomains are
   parsed,
 - AllowSubdomains to decide if subdomains of AllowedDomains are
   permitted,
 - AllowLocalhost to decide if localhost identifiers are permitted, and
 - CommonName of the certificate to request.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add changelog entry

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2022-02-23 16:44:09 -05:00
..
aws reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
cassandra Migrate to sdk/internalshared libs in go-secure-stdlib (#12090) 2021-07-15 20:17:31 -04:00
consul secret/consul: Add Consul ACL roles support (#14014) 2022-02-16 19:31:08 -06:00
database plugin/catalog: support plugin registration when type is explicitly provided (#14142) 2022-02-17 18:40:33 -08:00
mongodb Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
mssql Migrate to sdk/internalshared libs in go-secure-stdlib (#12090) 2021-07-15 20:17:31 -04:00
mysql Cleanup bool checks (#14102) 2022-02-18 07:35:53 -07:00
nomad builtin/logical/nomad: fix dropped test errors (#12052) 2021-07-13 07:28:46 -04:00
pki Fix broken interactions between glob_domains and wildcards (#14235) 2022-02-23 16:44:09 -05:00
postgresql Cleanup bool checks (#14102) 2022-02-18 07:35:53 -07:00
rabbitmq [VAULT-3008] Update RabbitMQ dependency and fix regression in UserInfo.Tags in v3.9 (#12877) 2021-10-20 09:46:37 -07:00
ssh Allow OpenSSH-style key type identifiers (#14143) 2022-02-18 17:48:16 -05:00
totp base32.DecodeString expects length 8 for the buffer (#11887) 2021-07-14 07:38:10 -04:00
transit Check that all required fields in Transit API are present. (#14074) 2022-02-22 16:00:25 -05:00