-
Notifications
You must be signed in to change notification settings - Fork 548
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
add option to revoke certificate with private key #2242
base: main
Are you sure you want to change the base?
Conversation
Hi i missed something to review @fairclothjm ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @lde, thanks for the contribution!
Overall great but I think we'd like to have the new revoke_with_key
conflict with the existing revoke
key to avoid user confusion of needing to set both keys to true to get the new behavior.
@@ -69,6 +69,8 @@ The following arguments are supported: | |||
|
|||
* `revoke` - If set to `true`, the certificate will be revoked on resource destruction. | |||
|
|||
* `revoke_with_key` - if set to `true`, use method `revoke-with-key` to revoke the certificate on resource destruction. Used to revoke certificate without using privileged operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to call out in the docs that the revoke
and revoke_with_key
fields can not be set simultaneously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the PR with my review comments and sorry about the delay, just catching up from the holiday vacation.
This is looking great, I have two small nits I'd like to get addressed before merging this in.
@@ -357,28 +365,41 @@ func pkiSecretBackendCertUpdate(ctx context.Context, d *schema.ResourceData, m i | |||
} | |||
|
|||
func pkiSecretBackendCertDelete(_ context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | |||
if d.Get(consts.FieldRevoke).(bool) { | |||
var revokeWithKey bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This can be simplified with just as the d.Get
call will never return nil.
revokeWithKey := d.Get(consts.FieldRevokeWithKey).(bool)
@@ -67,7 +67,9 @@ The following arguments are supported: | |||
|
|||
* `auto_renew` - (Optional) If set to `true`, certs will be renewed if the expiration is within `min_seconds_remaining`. Default `false` | |||
|
|||
* `revoke` - If set to `true`, the certificate will be revoked on resource destruction. | |||
* `revoke` - If set to `true`, the certificate will be revoked on resource destruction. Needs privileged access on Vault engine. Conflicts with `revoke_with_key`. Default `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs privileged access on Vault engine.
Sorry I meant to call this out in my initial review but I seem to have missed it. This might lead to people thinking that revoke_with_key
doesn't need to be authorized in Vault which is does and is up to an operator's policy decisions on making it more privileged or not.
Could we update this to
* `revoke` - If set to `true`, the certificate will be revoked on resource destruction. Needs privileged access on Vault engine. Conflicts with `revoke_with_key`. Default `false`. | |
* `revoke` - If set to `true`, the certificate will be revoked on resource destruction using the `revoke` PKI API. Conflicts with `revoke_with_key`. Default `false`. | |
* `revoke_with_key` - If set to `true`, the certificate will be revoked on resource destruction using the `revoke-with-key` PKI API. Conflicts with `revoke`. Default `false` |
Description
Ability to revoke certificate with private_key trough endpoint
revoke-with-key
witch is an unprivileged operation.Checklist
Output from acceptance testing:
Community Note