Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access SSL contexts using names instead of Settings #30953

Merged
merged 39 commits into from
Jul 13, 2018
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8fbe6e1
Refer to SSL contexts by name not settings
tvernum May 7, 2018
222015b
Merge branch 'master' into fix/30344-ssl-context-names
tvernum May 10, 2018
a360d22
[WIP] Use named SSL context in LDAP
tvernum May 14, 2018
29077e2
Merge branch 'master' into fix/30344-ssl-context-names
tvernum May 28, 2018
9ea7a52
Update openldap QA tests for named SSL contexts
tvernum May 28, 2018
997a1ec
Remove sslSocketFactory(Settings) from SSLService
tvernum May 28, 2018
2999649
Deprecate createSSLEngine(Settings)
tvernum May 29, 2018
bcde8a5
Remove createSSLEngine(Settings)
tvernum May 29, 2018
6ce4d32
Reduce use of Settings in SSL
tvernum May 30, 2018
f9cc028
Merge branch 'master' into fix/30344-ssl-context-names
tvernum May 30, 2018
e0561ee
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jun 12, 2018
bee987c
Improve SSLService tests
tvernum Jun 12, 2018
7c060d7
Small cleanup
tvernum Jun 12, 2018
2282d01
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jun 13, 2018
1aa0c14
Add additional test for named SSL configurations
tvernum Jun 14, 2018
39e6629
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jun 14, 2018
ef58ff1
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jun 14, 2018
d94dd57
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jun 14, 2018
ee32357
Remove unused imports
tvernum Jun 14, 2018
5a57fd6
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jun 15, 2018
cf2fdf0
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jun 18, 2018
42e3aa1
Fix test (feedback)
tvernum Jun 18, 2018
fb0505e
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jun 22, 2018
37cc028
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jun 26, 2018
817c565
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jul 9, 2018
2eb845a
Fix monitoring to work with dynamic SSL settings
tvernum Jul 9, 2018
2f6c87b
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jul 10, 2018
255a42e
Cleanup test static vars
tvernum Jul 10, 2018
8ea7e35
Address feedback from @jaymode (round 1)
tvernum Jul 10, 2018
e8d8299
Fix import
tvernum Jul 10, 2018
b11d61b
Rename test & context name
tvernum Jul 11, 2018
f4bab91
Remove more uses of sslConfiguration from settings
tvernum Jul 11, 2018
f637dc7
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jul 11, 2018
f774e6d
Remove remaining uses of deprecated methods
tvernum Jul 11, 2018
d1f3147
Don't use JKS keystore in test
tvernum Jul 11, 2018
44c4cf1
Fix broken test
tvernum Jul 11, 2018
9a0c026
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jul 12, 2018
bc3095e
Fix broken tests
tvernum Jul 12, 2018
9f6fa6d
Merge branch 'master' into fix/30344-ssl-context-names
tvernum Jul 13, 2018
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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils;
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
import org.elasticsearch.xpack.core.ssl.SSLService;
import org.elasticsearch.xpack.monitoring.exporter.ClusterAlertsUtil;
import org.elasticsearch.xpack.monitoring.exporter.Exporter;
Expand Down Expand Up @@ -443,8 +444,15 @@ private static void configureHeaders(final RestClientBuilder builder, final Conf
* @throws SettingsException if any setting causes issues
*/
private static void configureSecurity(final RestClientBuilder builder, final Config config, final SSLService sslService) {
final Settings sslSettings = SSL_SETTING.getConcreteSettingForNamespace(config.name()).get(config.settings());
final SSLIOSessionStrategy sslStrategy = sslService.sslIOSessionStrategy(sslSettings);
final Setting<Settings> concreteSetting = SSL_SETTING.getConcreteSettingForNamespace(config.name());
final SSLConfiguration sslConfiguration = sslService.getSSLConfiguration(concreteSetting.getKey());
final SSLIOSessionStrategy sslStrategy;
if (sslConfiguration == null) {
final Settings sslSettings = concreteSetting.get(config.settings());
sslStrategy = sslService.sslIOSessionStrategy(sslSettings);
} else {
sslStrategy = sslService.sslIOSessionStrategy(sslConfiguration);
}
final CredentialsProvider credentialsProvider = createCredentialsProvider(config);
List<String> hostList = HOST_SETTING.getConcreteSettingForNamespace(config.name()).get(config.settings());;
// sending credentials in plaintext!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PkiRealmBootstrapCheck implements BootstrapCheck {
private List<SSLConfiguration> loadSslConfigurations(Settings settings) {
final List<SSLConfiguration> list = new ArrayList<>();
if (HTTP_SSL_ENABLED.get(settings)) {
list.add(sslService.sslConfiguration(SSLService.getHttpTransportSSLSettings(settings), Settings.EMPTY));
list.add(sslService.getHttpTransportSSLConfiguration());
}

if (XPackSettings.TRANSPORT_SSL_ENABLED.get(settings)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,17 @@
import org.elasticsearch.xpack.core.security.authz.accesscontrol.SecurityIndexSearcherWrapper;
import org.elasticsearch.xpack.core.security.authz.permission.FieldPermissions;
import org.elasticsearch.xpack.core.security.authz.permission.FieldPermissionsCache;
import org.elasticsearch.xpack.security.authz.store.FileRolesStore;
import org.elasticsearch.xpack.core.security.authz.store.ReservedRolesStore;
import org.elasticsearch.xpack.core.security.index.IndexAuditTrailField;
import org.elasticsearch.xpack.core.security.user.AnonymousUser;
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
import org.elasticsearch.xpack.core.ssl.SSLConfigurationSettings;
import org.elasticsearch.xpack.core.ssl.SSLService;
import org.elasticsearch.xpack.core.ssl.TLSLicenseBootstrapCheck;
import org.elasticsearch.xpack.core.ssl.action.GetCertificateInfoAction;
import org.elasticsearch.xpack.core.ssl.action.TransportGetCertificateInfoAction;
import org.elasticsearch.xpack.core.ssl.rest.RestGetCertificateInfoAction;
import org.elasticsearch.xpack.core.template.TemplateUtils;
import org.elasticsearch.xpack.security.action.filter.SecurityActionFilter;
import org.elasticsearch.xpack.security.action.interceptor.BulkShardRequestInterceptor;
import org.elasticsearch.xpack.security.action.interceptor.IndicesAliasesRequestInterceptor;
Expand Down Expand Up @@ -172,6 +173,7 @@
import org.elasticsearch.xpack.security.authz.SecuritySearchOperationListener;
import org.elasticsearch.xpack.security.authz.accesscontrol.OptOutQueryCache;
import org.elasticsearch.xpack.security.authz.store.CompositeRolesStore;
import org.elasticsearch.xpack.security.authz.store.FileRolesStore;
import org.elasticsearch.xpack.security.authz.store.NativeRolesStore;
import org.elasticsearch.xpack.security.ingest.SetSecurityUserProcessor;
import org.elasticsearch.xpack.security.rest.SecurityRestFilter;
Expand Down Expand Up @@ -201,7 +203,6 @@
import org.elasticsearch.xpack.security.transport.filter.IPFilter;
import org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4HttpServerTransport;
import org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4ServerTransport;
import org.elasticsearch.xpack.core.template.TemplateUtils;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

Expand Down Expand Up @@ -230,9 +231,9 @@
import static java.util.Collections.singletonList;
import static org.elasticsearch.cluster.metadata.IndexMetaData.INDEX_FORMAT_SETTING;
import static org.elasticsearch.xpack.core.XPackSettings.HTTP_SSL_ENABLED;
import static org.elasticsearch.xpack.security.support.SecurityIndexManager.SECURITY_TEMPLATE_NAME;
import static org.elasticsearch.xpack.security.support.SecurityIndexManager.SECURITY_INDEX_NAME;
import static org.elasticsearch.xpack.security.support.SecurityIndexManager.INTERNAL_INDEX_FORMAT;
import static org.elasticsearch.xpack.security.support.SecurityIndexManager.SECURITY_INDEX_NAME;
import static org.elasticsearch.xpack.security.support.SecurityIndexManager.SECURITY_TEMPLATE_NAME;

public class Security extends Plugin implements ActionPlugin, IngestPlugin, NetworkPlugin, ClusterPlugin,
DiscoveryPlugin, MapperPlugin, ExtensiblePlugin {
Expand Down Expand Up @@ -861,10 +862,9 @@ public UnaryOperator<RestHandler> getRestHandlerWrapper(ThreadContext threadCont
return null;
}
final boolean ssl = HTTP_SSL_ENABLED.get(settings);
Settings httpSSLSettings = SSLService.getHttpTransportSSLSettings(settings);
boolean extractClientCertificate = ssl && getSslService().isSSLClientAuthEnabled(httpSSLSettings);
return handler -> new SecurityRestFilter(getLicenseState(), threadContext, authcService.get(), handler,
extractClientCertificate);
final SSLConfiguration httpSSLConfig = getSslService().getHttpTransportSSLConfiguration();
boolean extractClientCertificate = ssl && getSslService().isSSLClientAuthEnabled(httpSSLConfig);
return handler -> new SecurityRestFilter(getLicenseState(), threadContext, authcService.get(), handler, extractClientCertificate);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.elasticsearch.xpack.core.common.socket.SocketAccess;
import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken;
import org.elasticsearch.xpack.core.security.authz.RoleDescriptor;
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
import org.elasticsearch.xpack.security.authz.store.FileRolesStore;
import org.elasticsearch.xpack.core.ssl.SSLService;
import org.elasticsearch.xpack.security.authc.file.FileUserPasswdStore;
Expand Down Expand Up @@ -148,12 +149,12 @@ private String postURL(Settings settings, Environment env, String method, String
HttpURLConnection conn;
// If using SSL, need a custom service because it's likely a self-signed certificate
if ("https".equalsIgnoreCase(uri.getScheme())) {
Settings sslSettings = settings.getByPrefix(setting("http.ssl."));
final SSLService sslService = new SSLService(settings, env);
final SSLConfiguration sslConfiguration = sslService.getSSLConfiguration(setting("http.ssl"));
final HttpsURLConnection httpsConn = (HttpsURLConnection) url.openConnection();
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
// Requires permission java.lang.RuntimePermission "setFactory";
httpsConn.setSSLSocketFactory(sslService.sslSocketFactory(sslSettings));
httpsConn.setSSLSocketFactory(sslService.sslSocketFactory(sslConfiguration));
return null;
});
conn = httpsConn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.common.socket.SocketAccess;
import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken;
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
import org.elasticsearch.xpack.core.ssl.SSLService;
import org.elasticsearch.xpack.security.authc.esnative.tool.HttpResponse.HttpResponseBuilder;

import javax.net.ssl.HttpsURLConnection;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Expand All @@ -35,8 +37,6 @@
import java.util.Collections;
import java.util.List;

import javax.net.ssl.HttpsURLConnection;

import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_PORT;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_PUBLISH_HOST;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_PUBLISH_PORT;
Expand Down Expand Up @@ -86,11 +86,10 @@ public HttpResponse execute(String method, URL url, String user, SecureString pa
final SSLService sslService = new SSLService(settings, env);
final HttpsURLConnection httpsConn = (HttpsURLConnection) url.openConnection();
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
final Settings sslSettings = SSLService.getHttpTransportSSLSettings(settings);
final SSLConfiguration sslConfiguration = sslService.getHttpTransportSSLConfiguration();
// Requires permission java.lang.RuntimePermission "setFactory";
httpsConn.setSSLSocketFactory(sslService.sslSocketFactory(sslSettings));
final boolean isHostnameVerificationEnabled =
sslService.getVerificationMode(sslSettings, Settings.EMPTY).isHostnameVerificationEnabled();
httpsConn.setSSLSocketFactory(sslService.sslSocketFactory(sslConfiguration));
final boolean isHostnameVerificationEnabled = sslConfiguration.verificationMode().isHostnameVerificationEnabled();
if (isHostnameVerificationEnabled == false) {
httpsConn.setHostnameVerifier((hostname, session) -> true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.elasticsearch.xpack.core.security.authc.RealmConfig;
import org.elasticsearch.xpack.core.security.authc.RealmSettings;
import org.elasticsearch.xpack.core.security.authc.ldap.support.SessionFactorySettings;
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
import org.elasticsearch.xpack.core.ssl.SSLConfigurationSettings;
import org.elasticsearch.xpack.core.ssl.SSLService;
import org.elasticsearch.xpack.core.ssl.VerificationMode;
Expand Down Expand Up @@ -180,7 +181,8 @@ private ServerSet serverSet(RealmConfig realmConfig, SSLService clientSSLService
Settings settings = realmConfig.settings();
SocketFactory socketFactory = null;
if (ldapServers.ssl()) {
socketFactory = clientSSLService.sslSocketFactory(settings.getByPrefix("ssl."));
SSLConfiguration ssl = clientSSLService.getSSLConfiguration(RealmSettings.getFullSettingKey(realmConfig, "ssl"));
socketFactory = clientSSLService.sslSocketFactory(ssl);
if (settings.getAsBoolean(SessionFactorySettings.HOSTNAME_VERIFICATION_SETTING, true)) {
logger.debug("using encryption for LDAP connections with hostname verification");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.elasticsearch.xpack.core.security.authc.RealmSettings;
import org.elasticsearch.xpack.core.security.authc.saml.SamlRealmSettings;
import org.elasticsearch.xpack.core.security.user.User;
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
import org.elasticsearch.xpack.core.ssl.CertParsingUtils;
import org.elasticsearch.xpack.core.ssl.SSLService;
import org.elasticsearch.xpack.core.ssl.X509KeyPairSettings;
Expand Down Expand Up @@ -498,10 +499,11 @@ private static Tuple<AbstractReloadingMetadataResolver, Supplier<EntityDescripto

HttpClientBuilder builder = HttpClientBuilder.create();
// ssl setup
Settings sslSettings = config.settings().getByPrefix(SamlRealmSettings.SSL_PREFIX);
boolean isHostnameVerificationEnabled = sslService.getVerificationMode(sslSettings, Settings.EMPTY).isHostnameVerificationEnabled();
final String sslKey = RealmSettings.getFullSettingKey(config, SamlRealmSettings.SSL_PREFIX);
final SSLConfiguration sslConfiguration = sslService.getSSLConfiguration(sslKey);
boolean isHostnameVerificationEnabled = sslConfiguration.verificationMode().isHostnameVerificationEnabled();
HostnameVerifier verifier = isHostnameVerificationEnabled ? new DefaultHostnameVerifier() : NoopHostnameVerifier.INSTANCE;
SSLConnectionSocketFactory factory = new SSLConnectionSocketFactory(sslService.sslSocketFactory(sslSettings), verifier);
SSLConnectionSocketFactory factory = new SSLConnectionSocketFactory(sslService.sslSocketFactory(sslConfiguration), verifier);
builder.setSSLSocketFactory(factory);

HTTPMetadataResolver resolver = new PrivilegedHTTPMetadataResolver(builder.build(), metadataUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
public class SecurityNetty4HttpServerTransport extends Netty4HttpServerTransport {

private final IPFilter ipFilter;
private final Settings sslSettings;
private final SSLService sslService;
private final SSLConfiguration sslConfiguration;

Expand All @@ -42,10 +41,9 @@ public SecurityNetty4HttpServerTransport(Settings settings, NetworkService netwo
super(settings, networkService, bigArrays, threadPool, xContentRegistry, dispatcher);
this.ipFilter = ipFilter;
final boolean ssl = HTTP_SSL_ENABLED.get(settings);
this.sslSettings = SSLService.getHttpTransportSSLSettings(settings);
this.sslService = sslService;
if (ssl) {
this.sslConfiguration = sslService.sslConfiguration(sslSettings, Settings.EMPTY);
this.sslConfiguration = sslService.getHttpTransportSSLConfiguration();
if (sslService.isConfigurationValidForServerUsage(sslConfiguration) == false) {
throw new IllegalArgumentException("a key must be provided to run as a server. the key should be configured using the " +
"[xpack.security.http.ssl.key] or [xpack.security.http.ssl.keystore.path] setting");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.env.TestEnvironment;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.security.authc.ldap.support.SessionFactorySettings;
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
import org.elasticsearch.xpack.core.ssl.SSLService;
import org.elasticsearch.xpack.core.ssl.VerificationMode;
import org.elasticsearch.xpack.security.authc.ldap.support.LdapUtils;
Expand Down Expand Up @@ -59,16 +60,13 @@ public static LDAPConnection openConnection(String url, String bindDN, String bi
options.setConnectTimeoutMillis(Math.toIntExact(SessionFactorySettings.TIMEOUT_DEFAULT.millis()));
options.setResponseTimeoutMillis(SessionFactorySettings.TIMEOUT_DEFAULT.millis());

Settings connectionSettings;
final SSLConfiguration sslConfiguration;
if (useGlobalSSL) {
connectionSettings = Settings.EMPTY;
sslConfiguration = sslService.getSSLConfiguration("_global");
Copy link
Member

Choose a reason for hiding this comment

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

_global -> xpack.ssl

} else {
MockSecureSettings connSecureSettings = new MockSecureSettings();
connSecureSettings.setString("truststore.secure_password", "changeit");
connectionSettings = Settings.builder().put("truststore.path", truststore)
.setSecureSettings(connSecureSettings).build();
sslConfiguration = sslService.getSSLConfiguration("xpack.security.authc.realms.foo.ssl");
}
return LdapUtils.privilegedConnect(() -> new LDAPConnection(sslService.sslSocketFactory(connectionSettings), options,
return LdapUtils.privilegedConnect(() -> new LDAPConnection(sslService.sslSocketFactory(sslConfiguration), options,
ldapurl.getHost(), ldapurl.getPort(), bindDN, bindPassword));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.xpack.core.security.transport.netty4.SecurityNetty4Transport;
import org.elasticsearch.xpack.core.ssl.SSLClientAuth;
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
import org.elasticsearch.xpack.core.ssl.SSLService;
import org.junit.Before;

Expand Down Expand Up @@ -200,7 +201,9 @@ public void testTransportSSLOverridesGlobalSSL() throws Exception {
assertFalse(engine.getWantClientAuth());

// get the global and verify that it is different in that it requires client auth
final SSLEngine globalEngine = sslService.createSSLEngine(Settings.EMPTY, Settings.EMPTY);
SSLConfiguration configuration = sslService.getSSLConfiguration("_global");
assertNotNull(configuration);
final SSLEngine globalEngine = sslService.createSSLEngine(configuration, null, -1);
assertTrue(globalEngine.getNeedClientAuth());
assertFalse(globalEngine.getWantClientAuth());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
import org.elasticsearch.transport.Transport;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.core.common.socket.SocketAccess;
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
import org.elasticsearch.xpack.core.ssl.SSLService;

import javax.net.SocketFactory;
import javax.net.ssl.HandshakeCompletedListener;
import javax.net.ssl.SSLSocket;

import java.io.IOException;
import java.net.InetAddress;
import java.net.SocketTimeoutException;
Expand Down Expand Up @@ -159,7 +159,8 @@ public void testBindUnavailableAddress() {
@SuppressForbidden(reason = "Need to open socket connection")
public void testRenegotiation() throws Exception {
SSLService sslService = createSSLService();
SocketFactory factory = sslService.sslSocketFactory(Settings.EMPTY);
final SSLConfiguration sslConfiguration = sslService.sslConfiguration(Settings.EMPTY, Settings.EMPTY);
SocketFactory factory = sslService.sslSocketFactory(sslConfiguration);
try (SSLSocket socket = (SSLSocket) factory.createSocket()) {
SocketAccess.doPrivileged(() -> socket.connect(serviceA.boundAddress().publishAddress().address()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.elasticsearch.xpack.core.TestXPackTransportClient;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.common.socket.SocketAccess;
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
import org.elasticsearch.xpack.core.ssl.SSLService;
import org.elasticsearch.xpack.security.LocalStateSecurity;

Expand Down Expand Up @@ -121,8 +122,9 @@ public void testThatConnectionToHTTPWorks() throws Exception {
CredentialsProvider provider = new BasicCredentialsProvider();
provider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(nodeClientUsername(),
new String(nodeClientPassword().getChars())));
SSLConfiguration sslConfiguration = service.sslConfiguration(Settings.EMPTY, Settings.EMPTY);
Copy link
Member

Choose a reason for hiding this comment

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

why do we still have these methods? It seems like this just asks for programming mistakes

try (CloseableHttpClient client = HttpClients.custom()
.setSSLSocketFactory(new SSLConnectionSocketFactory(service.sslSocketFactory(Settings.EMPTY),
.setSSLSocketFactory(new SSLConnectionSocketFactory(service.sslSocketFactory(sslConfiguration),
SSLConnectionSocketFactory.getDefaultHostnameVerifier()))
.setDefaultCredentialsProvider(provider).build();
CloseableHttpResponse response = SocketAccess.doPrivileged(() -> client.execute(new HttpGet(getNodeUrl())))) {
Expand Down
Loading