This project is mirrored from https://gitee.com/NQL886/vault.git.
Pull mirroring failed .
Repository mirroring has been paused due to too many failed attempts. It can be resumed by a project maintainer.
Repository mirroring has been paused due to too many failed attempts. It can be resumed by a project maintainer.
- 29 Apr, 2022 7 commits
-
-
Alexander Scheel authored
Several locations needed to guard against early usage of the new issuers endpoint pre-migration. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
We need a write lock around writes to ensure serialization of modifications. We use a single lock for both issuer and key updates, in part because certain operations (like deletion) will potentially affect both. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Steve Clark authored
-
Steve Clark authored
- Address an issue that we were scheduling the rebuilding of a CRL on standby nodes, which would not be able to write to storage. - Fix an issue with standby nodes not correctly determining that a migration previously occurred.
-
Steve Clark authored
- Hook into the backend invalidation function so that secondaries are notified of new/updated issuer or migrations occuring on the primary cluster. Upon notification schedule a CRL rebuild to take place upon the next process to read/update the CRL or within the periodic function if no request comes in.
-
Steven Clark authored
-
Alexander Scheel authored
* Add aliased path for root/rotate/:exported This adds a user-friendly path name for generating a rotated root. We automatically choose the name "next" for the newly generated root at this path if it doesn't already exist. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com> * Add aliased path for intermediate/cross-sign This allows cross-signatures to work. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com> * Add path for replacing the current root This updates default to point to the value of the issuer with name "next" rather than its current value. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com> * Remove plural issuers/ in signing paths These paths use a single issuer and thus shouldn't include the plural issuers/ as a path prefix, instead using the singular issuer/ path prefix. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com> * Only warn if default issuer was imported When the default issuer was not (re-)imported, we'd fail to find it, causing an extraneous warning about missing keys, even though this issuer indeed had a key. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com> * Add missing issuer sign/issue paths Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
- 28 Apr, 2022 1 commit
-
-
kitography authored
* These parts work (put in signature so that backend wouldn't break, but missing fields, desc, etc.) * Import and Generate API calls w/ needed additions to SDK. * make fmt * Add Help/Sync Text, fix some of internal/exported/kms code. * Fix PEM/DER Encoding issue. * make fmt * Standardize keyIdParam, keyNameParam, keyTypeParam * Add error response if key to be deleted is in use. * replaces all instances of "default" in code with defaultRef * Updates from Callbacks to Operations Function with explicit forwarding. * Fixes a panic with names not being updated everywhere. * add a logged error in addition to warning on deleting default key. * Normalize whitespace upon importing keys. Authored-by:
Alexander Scheel <alexander.m.scheel@gmail.com> * Fix isKeyInUse functionality. * Fixes tests associated with newline at end of key pem.
-
- 26 Apr, 2022 7 commits
-
-
Alexander Scheel authored
The backend Framework has updated Callbacks (used extensively in PKI) to become deprecated; Operations takes their place and clarifies forwarding of requests. We switch to the new format everywhere, updating some bad assumptions about forwarding along the way. Anywhere writes are handled (that should be propagated to all nodes in all clusters), we choose to forward the request all the way up to the performance primary cluster's primary node. This holds for issuers/keys, roles, and configs (such as CRL config, which is globally set for all clusters despite all clusters having their own separate CRL). Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
Vault previously strictly enforced NotAfter/ttl values on certificate requests, erring if the requested TTL extended past the NotAfter date of the issuer. In the event of issuing an intermediate, this behavior was ignored, instead permitting the issuance. Users generally do not think to check their issuer's NotAfter date when requesting a certificate; thus this behavior was generally surprising. Per RFC 5280 however, issuers need to maintain status information throughout the life cycle of the issued cert. If this leaf cert were to be issued for a longer duration than the parent issuer, the CA must still maintain revocation information past its expiration. Thus, we add an option to the issuer to change the desired behavior: - err, to err out, - permit, to permit the longer NotAfter date, or - truncate, to silently truncate the expiration to the issuer's NotAfter date. Since expiration of certificates in the system's trust store are not generally validated (when validating an arbitrary leaf, e.g., during TLS validation), permit should generally only be used in that case. However, browsers usually validate intermediate's validity periods, and thus truncate should likely be used (as with permit, the leaf's chain will not validate towards the end of the issuance period). Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
When a role is used to generate a certificate (such as with the sign/ and issue/ legacy paths or the legacy sign-verbatim/ paths), we prefer that issuer to the one on the request. This allows operators to set an issuer (other than default) for requests to be issued against, effectively making the change no different from the users' perspective as it is "just" a different role name. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
This merges the ca_chain JSON field (of the /certs/ca_chain path) with the regular certificate field, returning the root of trust always. This also affects the non-JSON (raw) endpoints as well. We return the default issuer's chain here, rather than all known issuers (as that may not form a strict chain). Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
- 25 Apr, 2022 1 commit
-
-
Steve Clark authored
- Some PR feedback and handle a case in which the primary cluster does not have a CA bundle within storage but somehow a secondary does.
-
- 22 Apr, 2022 4 commits
-
-
Steve Clark authored
- Track the migration state forbidding an issuer/key writing api call if we have not migrated - For operations that just need to read the CA bundle, use the same tracking variable to switch between reading the legacy bundle or use the new key/issuer storage. - Add an invalidation function that will listen for updates to our log path to refresh the state on secondary clusters.
-
Steve Clark authored
- Leverage an existing helper method within the PKI backend tests to setup a PKI backend with storage.
-
Steven Clark authored
-
Alexander Scheel authored
We add a new API endpoint to fetch the specified issuer's CRL directly (rather than the default issuer's CRL at /crl and /certs/crl). We also add a new test to validate the CRL in a multi-root scenario and ensure it is signed with the correct keys. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
- 21 Apr, 2022 5 commits
-
-
Alexander Scheel authored
In previous versions of Vault, it was possible to sign an empty CRL (when the CRL was disabled and a force-rebuild was requested). Add a comment about this case. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Kit Haines authored
When using the older Certificate.CreateCRL(...) call, Go's x509 library copies the parsed pkix.Name version of the CRL Issuer's Subject field. For certain constructed CAs, this fails since pkix.Name is not suitable for round-tripping. This also builds a CRLv1 (per RFC 5280) CRL. In updating to the newer x509.CreateRevocationList(...) call, we can construct the CRL in the CRLv2 format and correctly copy the issuer's name. However, this requires holding an additional field per-CRL, the CRLNumber field, which is required in Go's implementation of CRLv2 (though OPTIONAL in the spec). We store this on the new LocalCRLConfigEntry object, per-CRL. Co-authored-by:
Alexander Scheel <alex.scheel@hashicorp.com> Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
This updates fetchCertBySerial to support querying the default issuer's CRL. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
When building CRLs, we've gotta make sure certs issued by that issuer land up on that issuer's CRL and not some other CRL. If no CRL is found (matching a cert), we'll place it on the default CRL. However, in the event of equivalent issuers (those with the same subject AND the same key material) -- perhaps due to reissuance -- we'll only create a single (unified) CRL for them. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
- 20 Apr, 2022 15 commits
-
-
Steve Clark authored
keyId -> keyID issuerId -> issuerID key -> keyEntry issuer -> issuerEntry keyConfig -> keyConfigEntry issuerConfig -> issuerConfigEntry
-
Alexander Scheel authored
We wish to ensure that each desired certificate in the chain is only present once. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
Don't set the legacy IssuingCA field on the certificate bundle, as we prefer the CAChain field over it. Additionally, building the full chain could result in duplicate certificates when the CAChain included the leaf certificate itself. When building the full chain, ensure we don't include the bundle's certificate twice. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
This ensures each issuer is only a single certificate entry (as validated by count and parsing) without any trailing data. We further ensure that each certificate PEM has leading and trailing spaces removed with only a single trailing new line remaining. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
We break the clique, instead building these chains manually, ensuring that the remaining chains do not change and only the modified certs change. We then reset them (back to implicit chain building) and ensure we get the same results as earlier. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
With the new issuer field (manual_chain), we can no longer err when a name already exists: we might be updating the existing issuer (with the same name), but changing its manual_chain field. Detect this error and correctly handle it. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
Using the issuance infrastructure, we generate new certificates (either roots or intermediates), positing that this is roughly equivalent to importing an external bundle (minus error handling during partial imports). This allows us to incrementally construct complex chains, creating reissuance cliques and cross-signing cycles. By using ECDSA certificates, we avoid high signature verification and key generation times. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
This returns the CA Chain attribute of an issuer, showing its computed chain based on other issuers in the database, when fetching a specific issuer. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
With the one-entry-per-issuer approach, CA Chains become implicitly constructed from the pool of issuers. This roughly matches the existing expectations from /config/ca (wherein a chain could be provided) and /intemediate/set-signed (where a chain may be provided). However, in both of those cases, we simply accepted a chain. Here, we need to be able to reconstruct the chain from parts on disk. However, with potential rotation of roots, we need to be aware of disparate chains. Simply concating together all issuers isn't sufficient. Thus we need to be able to parse a certificate's Issuer and Subject field and reconstruct valid (and potentially parallel) parent<->child mappings. This attempts to handle roots, intermediates, cross-signed intermediates, cross-signed roots, and rotated keys (wherein one might not have a valid signature due to changed key material with the same subject). Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Steve Clark authored
- Since the elements of the struct were not exported we serialized an empty migration log to disk and would re-run the migration
-
Alexander Scheel authored
When importing complex chains, we should identify in which certificate or key the failure occurred. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Steve Clark authored
- Add a call to buildCRL if we created an issuer within pathImportIssuers - Augment existing FullCAChain to verify we have a proper CRL post set-signed api call - Remove a code block writing out "ca" storage entry that is no longer used.
-
Steve Clark authored
- Detail I missed from the RFC was to assign the Name field as "current" for migrated key and issuer.
-
Steve Clark authored
- Validate that generate/root calls are no longer idempotent, but the bundle importing does not generate new keys/issuers - As before make sure that the delete root api resets everything - Address a bug within the storage that we bombed when we had multiple different key types within storage.
-