You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/12/21 07:34:06 UTC

[GitHub] [skywalking] buxingzhe commented on issue #6040: Skywalking agent fails to establish gRPC channel with TLS when no CA files

buxingzhe commented on issue #6040:
URL: https://github.com/apache/skywalking/issues/6040#issuecomment-748816625


   Suggest to make a change to file org.apache.skywalking.apm.agent.core.remote.TLSChannelBuilder.java as below:
   
   public class TLSChannelBuilder implements ChannelBuilder<NettyChannelBuilder> {
       private static String CA_FILE_NAME = "ca" + Constants.PATH_SEPARATOR + "ca.crt";
   
       @Override
       public NettyChannelBuilder build(
           NettyChannelBuilder managedChannelBuilder) throws AgentPackageNotFoundException, SSLException {
           File caFile = new File(AgentPackagePath.getPath(), CA_FILE_NAME);
           boolean hasCAFile = caFile.exists() && caFile.isFile();
           boolean shouldTlsEnabled = "true".equalsIgnoreCase(System.getProperty("skywalking.grpc.tls.enabled", "true"));
           if (hasCAFile || shouldTlsEnabled) {
               SslContextBuilder builder = GrpcSslContexts.forClient();
               if (hasCAFile) {
                   builder.trustManager(caFile);
               }
               managedChannelBuilder = managedChannelBuilder.negotiationType(NegotiationType.TLS)
                       .sslContext(builder.build());
           }
           return managedChannelBuilder;
       }
   }
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org