Skip to content

Commit

Permalink
backport of commit 464b9de
Browse files Browse the repository at this point in the history
  • Loading branch information
cipherboy authored Apr 25, 2023
1 parent 4d8b6c8 commit ba4237d
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 @@ -4939,12 +4939,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 @@ -4957,6 +4958,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 @@ -601,7 +601,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 ba4237d

Please sign in to comment.