Skip to content

Commit

Permalink
backport of commit 464b9de (#20342)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Scheel <[email protected]>
  • Loading branch information
1 parent 0ab01c4 commit 14bd0f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions builtin/logical/pki/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4761,12 +4761,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",
Expand All @@ -4779,6 +4780,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",
Expand Down
2 changes: 1 addition & 1 deletion builtin/logical/pki/path_fetch_issuers.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,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
Expand Down
3 changes: 3 additions & 0 deletions changelog/20341.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
secrets/pki: Fix patching of leaf_not_after_behavior on issuers.
```

0 comments on commit 14bd0f7

Please sign in to comment.