Channelz security changes - Follow up from #25593 (#25624)

reviewable/pr25609/r5
Yash Tibrewal 4 years ago committed by GitHub
parent ec31fa8455
commit 8d95aad50c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/core/lib/channel/channelz.cc
  2. 21
      test/cpp/end2end/channelz_service_test.cc

@ -375,7 +375,7 @@ Json SocketNode::Security::RenderJson() {
break;
case ModelType::kOther:
if (other) {
data["other"] = tls->RenderJson();
data["other"] = *other;
}
break;
}

@ -151,20 +151,17 @@ std::shared_ptr<grpc::ChannelCredentials> GetChannelCredentials(
return InsecureChannelCredentials();
}
args->SetSslTargetNameOverride("foo.test.google.fr");
// TODO(yashykt): Switch to using C++ API once b/173823806 is fixed.
grpc_tls_credentials_options* options = grpc_tls_credentials_options_create();
grpc_tls_credentials_options_set_certificate_provider(
options,
grpc_core::MakeRefCounted<grpc_core::StaticDataCertificateProvider>(
ReadFile(kCaCertPath),
ReadTlsIdentityPair(kClientKeyPath, kClientCertPath))
.get());
std::vector<experimental::IdentityKeyCertPair> identity_key_cert_pairs = {
{ReadFile(kClientKeyPath), ReadFile(kClientCertPath)}};
grpc::experimental::TlsChannelCredentialsOptions options;
options.set_certificate_provider(
std::make_shared<grpc::experimental::StaticDataCertificateProvider>(
ReadFile(kCaCertPath), identity_key_cert_pairs));
if (type == CredentialsType::kMtls) {
grpc_tls_credentials_options_watch_identity_key_cert_pairs(options);
options.watch_identity_key_cert_pairs();
}
grpc_tls_credentials_options_watch_root_certs(options);
return std::make_shared<SecureChannelCredentials>(
grpc_tls_credentials_create(options));
options.watch_root_certs();
return grpc::experimental::TlsCredentials(options);
}
std::shared_ptr<grpc::ServerCredentials> GetServerCredentials(

Loading…
Cancel
Save