Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PKI read legacy CA bundle prior to migration #15120

Conversation

stevendpclark
Copy link
Contributor

When the new Vault version starts up and becomes the leader node on a secondary performance cluster it should be able to still support certificate issue/revoke and list commands even when the storage was not migrated.

Known limitations

The new api on the secondary does not return the proper information in regards to issuers and keys as we don't fallback for those api calls.

Testing performed

  • Started up a primary and secondary performance clusters on 1.10 setting up a full CA within two separate mounts.
  • Upgraded the secondary performance cluster and verified that I could issue a new certificate from it as well as revoking a cert.
  • Upgraded the primary and verified that the new issuers api started working without restarting Vault on the secondary performance cluster.

Copy link
Contributor

@cipherboy cipherboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Largely looks good, some minor nits I think.

Will this PR handle updating the buildCRL path (now that it has merged) or should I do that after this merges?

Also, not sure if the complete "new APIs should error" will be done here now or in a separate PR :-)

// and reset its compatibility mode.
b.updatePkiStorageVersion(ctx)
}
// FIXME: We need to hook into CRL generation here for issuer/bundle updates.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we merged the CRL stuff, a call to buildCRLs should suffice here. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will defer to another PR, since we don't have a request object here this isn't as trivial as calling buildCRLs.

if err != nil {
return err
return migrationInfo, err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this has been deleted (or never created), does it mean we'll err out here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think we don't err. Only on other storage issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, but this comment led me to a missing nil check within fetchCAInfo so thanks 👍

builtin/logical/pki/backend.go Show resolved Hide resolved
builtin/logical/pki/cert_util.go Outdated Show resolved Hide resolved
builtin/logical/pki/path_intermediate.go Outdated Show resolved Hide resolved
 - Leverage an existing helper method within the PKI backend tests to setup a PKI backend with storage.
…red on secondaries.

 - 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.
@stevendpclark stevendpclark force-pushed the stevendpclark/vault-5748-read-legacy-on-secondary branch 2 times, most recently from 771c042 to 19a2981 Compare April 22, 2022 20:58
@stevendpclark stevendpclark requested review from cipherboy and removed request for sgmiller April 25, 2022 15:11
 - 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.
@stevendpclark stevendpclark force-pushed the stevendpclark/vault-5748-read-legacy-on-secondary branch from 19a2981 to 0c53f24 Compare April 25, 2022 16:25
@stevendpclark stevendpclark merged commit 0c53f24 into pki-pod-rotation Apr 25, 2022
@stevendpclark stevendpclark deleted the stevendpclark/vault-5748-read-legacy-on-secondary branch April 25, 2022 18:51
@cipherboy
Copy link
Contributor

This PR was merged in #15277. See that PR and the relevant docs PR #15238 for more information about this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants