Disabling certificate check in gRPC TLS

前端 未结 1 1544
春和景丽
春和景丽 2021-01-14 07:54

Currently, I have a ngnix server (on port 5001) behind which a gRPC server is running, nginx having TLS enabled. All gRPC clients need to send the request to nginx port whic

相关标签:
1条回答
  • 2021-01-14 08:22

    TLS with disabled certificate checking is of questionable usefulness because it can be trivially MITMed and so is not "supported" by gRPC. I highly recommend providing the client with proper root certificates to verify the server.

    That said, you can go around gRPC's API to do this by passing Netty's InsecureTrustManagerFactory to SslContextBuilder.trustManager(TrustManagerFactory):

    NettyChannelBuilder.forAddress("<server IP address>", 5001)
        .sslContext(GrpcSslContexts.forClient()
          .trustManager(InsecureTrustManagerFactory.INSTANCE)
          .build())
        .build();
    
    0 讨论(0)
提交回复
热议问题