You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
private_key_provider support fallback. When current private provider is not available, Envoy will fallback to default implementation and private_key field will be used in this condition.
And I have already tested this scenario, and it is indeed the case.
When private_key and private_key_provider are configured simultaneously, envoy will try to use private_key_provider. If private_key_provider is not available and fallback is true, private key will be used.
related code:
if (config.has_private_key_provider()) {
private_key_method_ =
factory_context.sslContextManager()
.privateKeyMethodManager()
.createPrivateKeyMethodProvider(config.private_key_provider(), factory_context);
if (private_key_method_ == nullptr ||
(!private_key_method_->isAvailable() && !config.private_key_provider().fallback())) {
creation_status =
absl::InvalidArgumentError(fmt::format("Failed to load private key provider: {}",
config.private_key_provider().provider_name()));
return;
}
if (!private_key_method_->isAvailable()) {
private_key_method_ = nullptr;
}
}
if (certificate_chain_.empty()) {
creation_status = absl::InvalidArgumentError(
fmt::format("Failed to load incomplete certificate from {}: certificate chain not set",
certificate_chain_path_));
}
if (private_key_.empty() && private_key_method_ == nullptr) {
creation_status = absl::InvalidArgumentError(
fmt::format("Failed to load incomplete private key from path: {}", private_key_path_));
}
Envoy::Ssl::PrivateKeyMethodProviderSharedPtr private_key_method_provider =
tls_certificate.privateKeyMethod();
// We either have a private key or a BoringSSL private key method provider.if (private_key_method_provider) {
ctx.private_key_method_provider_ = private_key_method_provider;
// The provider has a reference to the private key method for the context lifetime.
Ssl::BoringSslPrivateKeyMethodSharedPtr private_key_method =
private_key_method_provider->getBoringSslPrivateKeyMethod();
if (private_key_method == nullptr) {
creation_status = absl::InvalidArgumentError(
fmt::format("Failed to get BoringSSL private key method from provider"));
return;
}
#ifdef BORINGSSL_FIPS
if (!ctx.private_key_method_provider_->checkFips()) {
creation_status = absl::InvalidArgumentError(
fmt::format("Private key method doesn't support FIPS mode with current parameters"));
return;
}
#endifSSL_CTX_set_private_key_method(ctx.ssl_ctx_.get(), private_key_method.get());
} elseif (!tls_certificate.privateKey().empty()) {
// Load private key.
creation_status =
ctx.loadPrivateKey(tls_certificate.privateKey(), tls_certificate.privateKeyPath(),
tls_certificate.password());
if (!creation_status.ok()) {
return;
}
}
The text was updated successfully, but these errors were encountered:
Title: Documentation error, private_key and private_key_provider can be configured simultaneously
Description:
current doc
private_key_provider
supportfallback
. When current private provider is not available, Envoy will fallback to default implementation and private_key field will be used in this condition.And I have already tested this scenario, and it is indeed the case.
When private_key and private_key_provider are configured simultaneously, envoy will try to use private_key_provider. If private_key_provider is not available and fallback is true, private key will be used.
related code:
The text was updated successfully, but these errors were encountered: