-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Custom plugins mounted over built in plugins can lead to a bricked installation #11687
Comments
A more self-contained reproducer is below.
|
I can confirm the fix outlined in my original post resolves this issue. Logs from the fix:
|
corybolar
added a commit
to corybolar/vault
that referenced
this issue
May 22, 2021
Checking if a plugin is a builtin by comparing it's type to those in the builtin registry allows for a custom plugin loaded with the same name to be considered a builtin during error handling of the mounting process. This can cause the vault installation to brick itself because it cannot be unsealed to register a new sha256 or file path for a previously loaded custom plugin. Improve this logic by checking the plugin catalog rather than the builtin registry. Fixes hashicorp#11687
sgmiller
pushed a commit
that referenced
this issue
May 27, 2021
Checking if a plugin is a builtin by comparing it's type to those in the builtin registry allows for a custom plugin loaded with the same name to be considered a builtin during error handling of the mounting process. This can cause the vault installation to brick itself because it cannot be unsealed to register a new sha256 or file path for a previously loaded custom plugin. Improve this logic by checking the plugin catalog rather than the builtin registry. Fixes #11687
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Describe the bug
If a custom plugin is mounted over a built in plugin then removed or otherwise altered, vault will refuse to unseal.
To Reproduce
Assuming a working plugin at $PLUGINDIR and a binary at $PLUGINBIN. In this example vault-plugin-auth-jwt
Logs:
Seemingly no recovery from this point. Vault cannot be unsealed to remove the plugin or in the case of a sha256 mismatch, reregister it. Very similar to #3602
Expected behavior
Vault starts albeit in a degraded state but from which it can be repaired by removing or reregistering the plugin.
Environment:
vault status
): 1.7.1vault version
): v1.7.1Vault server configuration file(s):
Additional context
Having now reviewed the relevant code sections, this might be caused by the logic of:
vault/vault/auth.go
Line 688 in 6d6ea18
As I read this, the intended purpose is to continue on with mounting if the plugin is not a builtin. Unfortunately the lookup here only matches the plugin type to the builtin registry rather than actually checking to see if it's a built in or not. That information is available, just not being used here. A possible solution would be to query the plugin catalog instead. This builds but I have not yet tested it resolves my issue as a complete build of vault with the ui takes a lifetime on my machine.
The need to mount this particular custom plugin or top of the existing builtin is to retain the ui configuration and authentication listing visibility of the original oidc plugin. Mounting this with an alternate path and preserving those features does not seem possible.
The text was updated successfully, but these errors were encountered: