-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spiffe: add support for spiffe bundle format #36190
base: main
Are you sure you want to change the base?
Conversation
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
api/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.proto
Outdated
Show resolved
Hide resolved
api/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.proto
Outdated
Show resolved
Hide resolved
/wait |
api/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.proto
Outdated
Show resolved
Hide resolved
api/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.proto
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. some new comments to the API to start the review. And please address the comment from @markdroth .
api/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.proto
Outdated
Show resolved
Hide resolved
06a982e
to
b360f38
Compare
/lgtm api |
Please merge main. |
b360f38
to
28b5308
Compare
/wait on CI |
ff1fb7e
to
38f5dee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution and patience. And some comments are added.
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.cc
Outdated
Show resolved
Hide resolved
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.cc
Outdated
Show resolved
Hide resolved
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.h
Outdated
Show resolved
Hide resolved
Please also check the CI :) |
Signed-off-by: Brian Sonnenberg <[email protected]>
Signed-off-by: Brian Sonnenberg <[email protected]>
Signed-off-by: Brian Sonnenberg <[email protected]>
Signed-off-by: Brian Sonnenberg <[email protected]>
Signed-off-by: Brian Sonnenberg <[email protected]>
Signed-off-by: Brian Sonnenberg <[email protected]>
Signed-off-by: Brian Sonnenberg <[email protected]>
Signed-off-by: Brian Sonnenberg <[email protected]>
@wbpcode @alyssawilk @markdroth Finally have the CI passing. 😅 Would you folks mind taking another look? |
I'm still not thrilled that we're doing this instead of implementing the certificate provider framework, but at least this doesn't preclude us from doing that later. /lgtm api |
@wbpcode seems that latest comments were addressed, PTAL. |
Will take a look before tomorrow night. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update and the long time investment. It's much better now. I add some comments new but should be easy to address. Thanks again.
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.h
Outdated
Show resolved
Hide resolved
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.h
Outdated
Show resolved
Hide resolved
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.cc
Outdated
Show resolved
Hide resolved
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.cc
Outdated
Show resolved
Hide resolved
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.cc
Outdated
Show resolved
Hide resolved
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.cc
Outdated
Show resolved
Hide resolved
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: Brian Sonnenberg <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall now. Thanks so much for your update, It's near there, only some non-major comments are added.
And merry Christmas!!! 🎄
/wait
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.cc
Outdated
Show resolved
Hide resolved
ENVOY_LOG(error, "Failed to load SPIFFE bundle map from '{}': '{}'", | ||
trust_bundle_file_name_, new_trust_bundle.status()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ENVOY_LOG(error, "Failed to load SPIFFE bundle map from '{}': '{}'", | |
trust_bundle_file_name_, new_trust_bundle.status()); | |
ENVOY_LOG(error, "Failed to load SPIFFE bundle map from '{}': '{}'", | |
trust_bundle_file_name_, new_trust_bundle.status().message()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping for this comment
source/extensions/transport_sockets/tls/cert_validator/spiffe/spiffe_validator.cc
Outdated
Show resolved
Hide resolved
@@ -19,6 +24,7 @@ envoy_extension_cc_test( | |||
], | |||
data = [ | |||
"//test/common/tls/test_data:certs", | |||
"//test/extensions/transport_sockets/tls/cert_validator/spiffe:trust_bundles", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems you only move the generated file to this directory. Sorry for the chaos, maybe keep your previous design is better if we cannot split all these out from the tls/test_data
cleanly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the static files to the test directory and left the generated one in the directory that has the generator. I think this is ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine, if you think that's OKay. Please also create a test_data
sub directory for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And Please also merge the main and resolve the CI problem.
Signed-off-by: Brian Sonnenberg <[email protected]>
/wait |
Signed-off-by: Brian Sonnenberg <[email protected]>
Signed-off-by: Brian Sonnenberg <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some nit comments to improve the code quality (non-block).
And could you check the CI. Thanks.
ENVOY_LOG(error, "Failed to load SPIFFE bundle map from '{}': '{}'", | ||
trust_bundle_file_name_, new_trust_bundle.status()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping for this comment
@@ -30,10 +33,133 @@ namespace Tls { | |||
|
|||
using SPIFFEConfig = envoy::extensions::transport_sockets::tls::v3::SPIFFECertValidatorConfig; | |||
|
|||
absl::StatusOr<std::shared_ptr<SpiffeData>> | |||
SPIFFEValidator::parseTrustBundles(const std::string& trust_bundle_mapping_str) { | |||
Json::ObjectSharedPtr parsed_json_bundle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this line.
return absl::InvalidArgumentError("Invalid JSON found in SPIFFE bundle"); | ||
} | ||
|
||
parsed_json_bundle = json_parse_result.value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parsed_json_bundle = json_parse_result.value(); | |
Json::ObjectSharedPtr parsed_json_bundle = json_parse_result.value(); |
|
||
// User configured "trust_domains", not "trust_bundles" | ||
spiffe_data_ = std::make_shared<SpiffeData>(); | ||
spiffe_data_->trust_bundle_stores_.reserve(n_trust_domains); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spiffe_data_->trust_bundle_stores_.reserve(n_trust_domains); | |
spiffe_data_->trust_bundle_stores_.reserve(message.trust_domains().size()); |
@@ -55,10 +181,36 @@ SPIFFEValidator::SPIFFEValidator(const Envoy::Ssl::CertificateValidationContextC | |||
} | |||
} | |||
|
|||
const auto size = message.trust_domains().size(); | |||
trust_bundle_stores_.reserve(size); | |||
const auto n_trust_domains = message.trust_domains().size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this line.
cc @tyxia could you take another look when you have some free time? |
If @tyxia no explict comments, I think we can merge this after the CI and nit comments are addressed. Thanks for all your time and investment. 🌹 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contribution!
Commit Message: Adds alternative to "trust_domains" config for the spiffe validator—"trust_bundle_map".
Additional Description:
#35567
trust_bundle_map points to a local file containing a SPIFFE bundle map. A file watcher is set up to trigger refreshes to the SPIFFE data when this file is modified. SPIFFE refresh hint and sequence number are currently ignored.
Risk Level: medium
Testing: WIP
Docs Changes: TBD
Release Notes: TBD