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.
- 02 May, 2022 40 commits
-
-
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>
-
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>
-
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.
-
Steve Clark authored
- Replace hardcoded "default" references with a constant to easily identify various usages. - Use the addIssuerRefField function instead of redefining the field in various locations.
-
Alexander Scheel authored
The old DELETE /root code must now delete all keys and issuers for backwards compatibility. We strongly suggest calling individual delete methods (DELETE /key/:key_ref or DELETE /issuer/:issuer_ref) instead, for finer control. In the process, we detect whether the deleted key/issuers was set as the default. This will allow us to warn (from the single key/deletion issuer code) whether or not the default was deleted (while allowing the operation to succeed). Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
This makes two minor changes to the existing test suite: 1. Importing partial bundles should now succeed, where they'd previously error. 2. fetchCertBySerial no longer handles CA certificates. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
When the default issuer and key are missing (and haven't yet been specified), we should clarify that error message. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
The existing bundle import code will satisfy the intermediate import; use it instead of the old ca_bundle import logic. Additionally, update /config/ca to use the new import code as well. While testing, a panic was discovered: > reflect.Value.SetMapIndex: value of type string is not assignable to type pki.keyId This was caused by returning a map with type issuerId->keyId; instead switch to returning string->string maps so the audit log can properly HMAC them. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Steve Clark authored
- Addresses some test failures due to an incorrect refactoring of a legacy api path /sign-verbatim within PKI
-
Steve Clark authored
-
Steve Clark authored
- PR feedback, move setting up the default configuration references within the import methods instead of within the writeCaBundle method. This should now cover all use cases of us setting up the defaults properly.
-
Steve Clark authored
- Use the buildPath convention for the function name instead of common...
-
Steve Clark authored
- Add utility methods to fetch the issuer_name, issuer_ref, key_name and key_ref arguments from data fields. - Centralize the logic to clean up these inputs and apply various validations to all of them.
-
Steve Clark authored
- Update all new API endpoints to use the new agreed upon argument names. - issuer_ref & key_ref to refer to existing - issuer_name & key_name for new definitions - Update returned values to always user issuer_id and key_id
-
Steve Clark authored
-
Steve Clark authored
-
Alexander Scheel authored
This updates the /sign and /issue endpoints, allowing them to take the default issuer (if none is provided by a role) and adding issuer-specific versions of them. Note that at this point in time, the behavior isn't yet ideal (as /sign/:role allows adding the ref=... parameter to override the default issuer); a later change adding role-based issuer specification will fix this incorrect behavior. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
After setting a default issuer, one should be able to use the old /ca, /ca_chain, and /cert/{ca,ca_chain} endpoints to fetch the default issuer (and its chain). Update the fetchCertBySerial helper to no longer support fetching the ca and prefer fetchCAInfo for that instead (as we've already updated that to support fetching the new issuer location). Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
Using the new updateDefaultIssuerId(...) from the storage migration PR allows for easy implementation of configuring the default issuer. We restrict callers from setting blank defaults and setting default to default. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
This endpoint allows existing issuers to be used to directly sign CSRs. In the process, we've updated the existing /sign-verbatim endpoint to be equivalent to a call to /issuer/:ref/sign-verbatim. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-
Alexander Scheel authored
This endpoint allows existing issuers to be used to sign self-signed certificates. In the process, we've updated the existing /root/sign-self-issued endpoint to be equivalent to a call to /issuer/default/sign-self-issued. Signed-off-by:
Alexander Scheel <alex.scheel@hashicorp.com>
-