forked from spiffe/spire
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bundle_file_arn to plugin options for awssecret (spiffe#3578)
* Generate new certificates and keys on every test run The static test keys and certificates that currently live in testdata/keys/EC are brittle and won't pass additional validation added to the plugin. The certificate is expired and if replaced we're just kicking the can down the road. This commit moves towards a setup similar to how the disk upstreamauthority plugin works, with dynamically generated keys and certificates that will never be out of date. Instead of static test data, on each run we generate chains of keys and certificates with generateTestData() which returns both a function that will wrap these values in a fake secrets manager client and a struct containing the keys/certs so that we can use the same values to assert against SPIRE's returned X509CaChain and UpstreamX509Roots. Signed-off-by: Jay Crumb <jay.crumb@unit21.ai> * Add bundle_file_arn to plugin options for awssecret This will allow us to specify addtional certificates that should be added to the trust bundle when using non-self-signed certificates in the cert_file_arn configuration field. Without this, it is only possible to use the awssecret UpstreamAuthority with a self-signed cert. Otherwise, you will end up with a partial chain when presented with the trust bundle + client certificate chain. This parameter is optional, and when omitted does not break existing flows. Signed-off-by: Jay Crumb <jay.crumb@unit21.ai> * Add tests for specifying an intermediate as secret/key This adds a few new testcases: - Ensuring that bundle_file_arn is properly validated if it's present - Ensuring that when specifying a bundle, the non self-signed CA specified in cert_file_arn is included in the resultant x509CaChain and the upstreamX509Roots contains the specified root Signed-off-by: Jay Crumb <jay.crumb@unit21.ai> * Add support for specifying an intermediate CA in cert_file_arn This is a pretty major refactor of the awssecret plugin which allows specifying an intermediate CA in cert_file_arn and brings this plugin much more inline with the disk upstreamauthority. In addition to allowing intermediates, we are now much stricter about checking the provided certificate, key, and bundle at plugin load time. On init, we now check that either cert_file_arn is a single self-signed CA or that it is not self signed and can be verified with the roots specified in bundle_file_arn. Signed-off-by: Jay Crumb <jay.crumb@unit21.ai> * Document new bundle_file_path parameter This new parameter is optional as long as you are using a self-signed CA in cert_file_arn. Otherwise bundle_file_arn should include one or more roots to be included in the trust bundle, one of which must be the end of the chain for the certificate specified in cert_file_arn. Signed-off-by: Jay Crumb <jay.crumb@unit21.ai> * Remove old static test cert/key These are no longer needed since we're generating dynamic ones on every test run now. Signed-off-by: Jay Crumb <jay.crumb@unit21.ai> * Update doc/plugin_server_upstreamauthority_awssecret.md Signed-off-by: Jay Crumb <jay.crumb@unit21.ai> Co-authored-by: Evan Gilman <evan2645@gmail.com> Signed-off-by: Jay Crumb <jay.crumb@unit21.ai> Co-authored-by: Evan Gilman <evan2645@gmail.com>
- Loading branch information
1 parent
62c0ba9
commit c299036
Showing
7 changed files
with
257 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.