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

Optional automatic default issuer selection #17824

Merged
merged 7 commits into from Nov 8, 2022

Conversation

cipherboy
Copy link
Contributor

@cipherboy cipherboy commented Nov 4, 2022

When attempting compatibility against multiple versions of Vault, one major breaking change in Vault 1.11 was the multiple issuer's functionality and behavior changes around importing issuers (wherein /config/ca required a deletion first) and generation of new issuers (where both root/intermediate generation silently removed old keys!).

While we don't wish to remove key material any more, thus becoming more safe, the net was a breaking change across APIs: because the default issuer was not updated on these operations, the issuer would appear "lost" to any callers. Only when an operator updated the default issuer would non-multi-issuer aware applications see this new CA.

However, not everyone will want to automatically change the default issuer: for applications and operators aware of multi-issuer functionality, who wish to proactively prime new isseurs prior to enabling them (perhaps for distribution purposes), this change shouldn't be automatic and retroactive.

Thus, make this an opt-in change on /config/issuers.


This obviously needs:

  • Tests
  • Changelog
  • Docs

Like #17823, I'm curious to get people's thoughts.

When setting a new default issuer, our helper function would overwrite
other parameters in the issuer configuration entry. However, up until
now, there were none.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
@cipherboy cipherboy added bug Used to indicate a potential bug secret/pki backport/1.11.x labels Nov 4, 2022
@cipherboy cipherboy added this to the 1.13.0-rc1 milestone Nov 4, 2022
@cipherboy cipherboy requested review from kitography, sgmiller and a team November 4, 2022 16:08
@@ -52,6 +53,11 @@ func pathConfigIssuers(b *backend) *framework.Path {
Type: framework.TypeString,
Description: `Reference (name or identifier) to the default issuer.`,
},
"default_follows_latest_issuer": {
Type: framework.TypeBool,
Description: `Whether the default issuer should automatically follow the latest generated or imported issuer. Defaults to false.`,
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 is meant to allow opt-in to unbreak a change, should the original change be documented as breaking, and point to this new field as a way to opting into the previous behavior if necessary, while suggesting that callers move to using the new multi-issuer functionality more explicitly as they can? (just a thought)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah, its in the web docs that I've not pushed, one second.

This parameter will allow operators to have the default issuer
automatically update when a new root is generated or a single issuer
with a key (potentially with others lacking key) is imported.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
These internal members shouldn't be tested by the storage migration
code, and so should be elided from the test results.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
This updates the two places where issuers can be created (outside of
legacy CA bundle migration which already sets the default) to follow
newly created issuers when the config is set.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
@cipherboy cipherboy force-pushed the cipherboy-automatic-default-issuer branch from ffc9861 to 3ae7100 Compare November 8, 2022 16:29
Copy link
Collaborator

@sgmiller sgmiller left a comment

Choose a reason for hiding this comment

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

Looks good to me. I had the tiny concern that the concept of "follows" in the API docs wasn't clear enough but the main docs are.

@cipherboy
Copy link
Contributor Author

If you have suggestions, I'm happy to update. But in general I think we point people towards the online docs as being more comprehensive than the in-Vault docs.

@sgmiller
Copy link
Collaborator

sgmiller commented Nov 8, 2022

If you have suggestions, I'm happy to update. But in general I think we point people towards the online docs as being more comprehensive than the in-Vault docs.

Nah, its fine.

Copy link
Contributor

@kitography kitography left a comment

Choose a reason for hiding this comment

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

This looks great to me!

builtin/logical/pki/config_util.go Show resolved Hide resolved
@cipherboy cipherboy deleted the cipherboy-automatic-default-issuer branch December 1, 2022 14:56
jayant07-yb pushed a commit to jayant07-yb/hashicorp-vault-integrations that referenced this pull request Mar 15, 2023
* Correctly preserve other issuer config params

When setting a new default issuer, our helper function would overwrite
other parameters in the issuer configuration entry. However, up until
now, there were none.

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

* Add new parameter to allow default to follow new

This parameter will allow operators to have the default issuer
automatically update when a new root is generated or a single issuer
with a key (potentially with others lacking key) is imported.

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

* Storage migration tests fail on new members

These internal members shouldn't be tested by the storage migration
code, and so should be elided from the test results.

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

* Follow new issuer on root generation, import

This updates the two places where issuers can be created (outside of
legacy CA bundle migration which already sets the default) to follow
newly created issuers when the config is set.

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

* Add changelog entry

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

* Add documentation

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

* Add test for new default-following behavior

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

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to indicate a potential bug secret/pki
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants