Skip to content

Commit

Permalink
Add new PKI key prefix to seal wrapped storage (#15126)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevendpclark committed Apr 22, 2022
1 parent 39f8606 commit 4c41dd2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin/logical/pki/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ func Backend(conf *logical.BackendConfig) *backend {
},

SealWrapStorage: []string{
"config/ca_bundle",
legacyCertBundlePath,
keyPrefix,
},
},

Expand Down
11 changes: 11 additions & 0 deletions builtin/logical/pki/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4908,6 +4908,17 @@ func TestIntermediateWithExistingKey(t *testing.T) {
require.Equal(t, myKeyId1, myKeyId3, "our new ca did not seem to reuse the key as we expected.")
}

func TestSealWrappedStorageConfigured(t *testing.T) {
b, _ := createBackendWithStorage(t)
wrappedEntries := b.Backend.PathsSpecial.SealWrapStorage

// Make sure our legacy bundle is within the list
// NOTE: do not convert these test values to constants, we should always have these paths within seal wrap config
require.Contains(t, wrappedEntries, "config/ca_bundle", "Legacy bundle missing from seal wrap")
// The trailing / is important as it treats the entire folder requiring seal wrapping, not just config/key
require.Contains(t, wrappedEntries, "config/key/", "key prefix with trailing / missing from seal wrap.")
}

var (
initTest sync.Once
rsaCAKey string
Expand Down

0 comments on commit 4c41dd2

Please sign in to comment.