Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/envoy/http/authn/http_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,26 @@ namespace Istio {
namespace AuthN {

AuthenticationFilter::AuthenticationFilter(const FilterConfig& filter_config)
: filter_config_(filter_config) {}
: filter_config_(filter_config) {
for (const auto& method : filter_config.policy().peers()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we wrap this entire loop with something that logs every 1000 calls?

Copy link
Contributor Author

@yangminzhu yangminzhu Feb 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already logging at low frequency. Most users only have 1 method in peers TLS related setting. Also note per @PiotrSikora's comment, I have moved this from the data path to the control path, it should only log when a new authN policy is first initialized and won't trigger for any requests. Is this enough to leave it as-is?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't notice that you moved this to control path. This should be fine, then. Thanks!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, SGTM to me too

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And apparently it wasn't: istio/istio#11925

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it turns out Envoy actually allocate the filter for every request, so putting it in the constructor doesn't make it on the data path. I moved it to the filter factory createFilterFactory() (#2125) and confirmed it's only called when a new config is received by Envoy, not on every request.

switch (method.params_case()) {
case iaapi::PeerAuthenticationMethod::ParamsCase::kMtls:
if (method.mtls().mode() == iaapi::MutualTls_Mode_PERMISSIVE) {
ENVOY_LOG(
warn,
"mTLS PERMISSIVE mode is used, connection can be either "
"plaintext or TLS, and client cert can be omitted. "
"Please consider to upgrade to mTLS STRICT mode for more secure "
"configuration that only allows TLS connection with client cert. "
"See https://istio.io/docs/tasks/security/mtls-migration/");
return;
}
break;
default:
break;
}
}
}

AuthenticationFilter::~AuthenticationFilter() {}

Expand Down