Netflix / eureka

AWS Service registry for resilient mid-tier load balancing and failover.
Apache License 2.0
12.37k stars 3.74k forks source link

How to config SslContext for peer eureka nodes in https protocol? #1443

Open BrookShiwenge opened 2 years ago

BrookShiwenge commented 2 years ago

I have set sslContext into DiscoveryClient.DiscoveryClientOptionalArgs . But now it seems the configuration doesn't work! I hope get a specification guide about configuration of peer eureka nodes in https protocol

@Bean
public SSLContext sslContext() throws Exception {
     return SSLContextBuilder.
             create().
             loadTrustMaterial(ResourceUtils.getFile(trustStorePath), trustStorePassword.toCharArray()).
             build();
}

@Bean
public DiscoveryClient.DiscoveryClientOptionalArgs discoveryClientOptionalArgs(SSLContext sslContext) {
    DiscoveryClient.DiscoveryClientOptionalArgs discoveryClientOptionalArgs = new DiscoveryClient.DiscoveryClientOptionalArgs();
    discoveryClientOptionalArgs.setSSLContext(sslContext);
    discoveryClientOptionalArgs.setHostnameVerifier(new AllowAllHostnameVerifier());   
    return discoveryClientOptionalArgs;
}
Ch1ang commented 1 month ago

hihi, did you fixed this problem? What is the solution?