Fix issuer patch of leaf_not_after_behavior (#20341)
* Fix patching issuer leaf_not_after_behavior Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> * Add tests for patching leaf_not_after_behavior Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> * Add changelog entry Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> --------- Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
This commit is contained in:
parent
1e433add83
commit
918305d450
|
@ -4984,12 +4984,13 @@ func TestIssuanceTTLs(t *testing.T) {
|
|||
})
|
||||
require.Error(t, err, "expected issuance to fail due to longer default ttl than cert ttl")
|
||||
|
||||
resp, err = CBWrite(b, s, "issuer/root", map[string]interface{}{
|
||||
"issuer_name": "root",
|
||||
resp, err = CBPatch(b, s, "issuer/root", map[string]interface{}{
|
||||
"leaf_not_after_behavior": "permit",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, resp)
|
||||
require.NotNil(t, resp.Data)
|
||||
require.Equal(t, resp.Data["leaf_not_after_behavior"], "permit")
|
||||
|
||||
_, err = CBWrite(b, s, "issue/local-testing", map[string]interface{}{
|
||||
"common_name": "testing",
|
||||
|
@ -5002,6 +5003,8 @@ func TestIssuanceTTLs(t *testing.T) {
|
|||
})
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, resp)
|
||||
require.NotNil(t, resp.Data)
|
||||
require.Equal(t, resp.Data["leaf_not_after_behavior"], "truncate")
|
||||
|
||||
_, err = CBWrite(b, s, "issue/local-testing", map[string]interface{}{
|
||||
"common_name": "testing",
|
||||
|
|
|
@ -783,7 +783,7 @@ func (b *backend) pathPatchIssuer(ctx context.Context, req *logical.Request, dat
|
|||
}
|
||||
|
||||
// Leaf Not After Changes
|
||||
rawLeafBehaviorData, ok := data.GetOk("leaf_not_after_behaivor")
|
||||
rawLeafBehaviorData, ok := data.GetOk("leaf_not_after_behavior")
|
||||
if ok {
|
||||
rawLeafBehavior := rawLeafBehaviorData.(string)
|
||||
var newLeafBehavior certutil.NotAfterBehavior
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
secrets/pki: Fix patching of leaf_not_after_behavior on issuers.
|
||||
```
|
Loading…
Reference in New Issue