Skip to content

Add TLS configuration settings/endpoints for auxiliary transports #5152

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

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e2e31aa
Spotless apply
finnegancarroll Feb 27, 2025
96269e1
Fill in additional post-fix literals with constants.
finnegancarroll Mar 4, 2025
a492af3
Add aux transport constants.
finnegancarroll Feb 28, 2025
c6426b2
Add aux to CertType enum.
finnegancarroll Feb 28, 2025
449f830
Load aux settings in SslSettingsManager.
finnegancarroll Feb 28, 2025
3e87d90
Comment typos.
finnegancarroll Feb 28, 2025
11ab6e4
Add SECURITY_SSL_AUX_ENABLE_OPENSSL_IF_AVAILABLE to openSslWarnings.
finnegancarroll Mar 3, 2025
14c8fc3
Consolidate testFailsIfNoConfigDefine tests under single helper.
finnegancarroll Mar 3, 2025
b20b21f
httpConfigFailsIfHttpEnabledButButNotDefined and transportFailsIfNoCo…
finnegancarroll Mar 3, 2025
dc64854
Replace httpConfigFailsIfBothPemAndJDKSettingsWereSet with transport …
finnegancarroll Mar 3, 2025
0cbde43
Replace httpConfigFailsIfClientAuthRequiredAndJdkTrustStoreNotSet wit…
finnegancarroll Mar 3, 2025
c47e295
Fix error message for validate keystore/pemstore - Print missing sett…
finnegancarroll Mar 3, 2025
60688a5
Replace httpConfigFailsIfClientAuthRequiredAndPemTrustedCasNotSet wit…
finnegancarroll Mar 3, 2025
e54ede7
Add simple asserts for aux transport to SslSettingsManagerTest.
finnegancarroll Mar 3, 2025
cbbda6a
Update SSLConfigConstants aux constants with new constants.
finnegancarroll Mar 4, 2025
721296b
Refactor SslSettingsManagerReloadListenerTest to abstract helpers for…
finnegancarroll Mar 4, 2025
b32f435
Refactor SslParameters to load from CertType instead of 'ishttp' bool.
finnegancarroll Mar 5, 2025
4a9d709
Add aux case for Pem and JDK cert loader tests.
finnegancarroll Mar 12, 2025
e79fef6
Abstract getSecureSSLProtocols and getSecureSSLCiphers to handle prov…
finnegancarroll Mar 12, 2025
d48105d
Add aux cases for SSLConfigConstantsTest.
finnegancarroll Mar 12, 2025
fb30688
Implement getSecureAuxTransportSettingsProvider to link with core.
finnegancarroll Mar 14, 2025
78efaad
Expose aux settings to core through plugin class.
finnegancarroll Mar 19, 2025
61d79f2
Remove engine from settings provider. Fetch raw params instead.
finnegancarroll Mar 21, 2025
ca85266
Rebase.
finnegancarroll Mar 21, 2025
2745eda
Remove cert revocation settings for aux.
finnegancarroll Apr 2, 2025
d42fdec
Merge branch 'main' into aux-transport
willyborankin Apr 7, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import org.opensearch.SpecialPermission;
import org.opensearch.common.settings.Settings;
import org.opensearch.env.Environment;
import org.opensearch.security.ssl.config.CertType;
import org.opensearch.security.ssl.util.CertFileProps;
import org.opensearch.security.ssl.util.CertFromFile;
import org.opensearch.security.ssl.util.CertFromKeystore;
Expand Down Expand Up @@ -874,16 +875,16 @@ private String[] getEnabledSSLProtocols(final SslProvider provider, boolean http
private void initEnabledSSLCiphers() {

final ImmutableSet<String> allowedSecureHttpSSLCiphers = ImmutableSet.copyOf(
SSLConfigConstants.getSecureSSLCiphers(settings, true)
SSLConfigConstants.getSecureSSLCiphers(settings, CertType.HTTP)
);
final ImmutableSet<String> allowedSecureTransportSSLCiphers = ImmutableSet.copyOf(
SSLConfigConstants.getSecureSSLCiphers(settings, false)
SSLConfigConstants.getSecureSSLCiphers(settings, CertType.TRANSPORT)
);
final ImmutableSet<String> allowedSecureHttpSSLProtocols = ImmutableSet.copyOf(
(SSLConfigConstants.getSecureSSLProtocols(settings, true))
(SSLConfigConstants.getSecureSSLProtocols(settings, CertType.HTTP))
);
final ImmutableSet<String> allowedSecureTransportSSLProtocols = ImmutableSet.copyOf(
SSLConfigConstants.getSecureSSLProtocols(settings, false)
SSLConfigConstants.getSecureSSLProtocols(settings, CertType.TRANSPORT)
);

if (OpenSearchSecuritySSLPlugin.OPENSSL_SUPPORTED && OpenSsl.isAvailable()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import org.opensearch.OpenSearchException;
import org.opensearch.common.settings.Settings;
import org.opensearch.security.ssl.config.CertType;
import org.opensearch.security.ssl.util.SSLConfigConstants;

public class ExternalSecurityKeyStore implements SecurityKeyStore {
Expand Down Expand Up @@ -72,17 +73,17 @@ public SSLEngine createClientTransportSSLEngine(final String peerHost, final int
final SSLParameters sslParams = new SSLParameters();
sslParams.setEndpointIdentificationAlgorithm("HTTPS");
engine.setSSLParameters(sslParams);
engine.setEnabledProtocols(evalSecure(engine.getEnabledProtocols(), SSLConfigConstants.getSecureSSLProtocols(settings, false)));
engine.setEnabledProtocols(evalSecure(engine.getEnabledProtocols(), SSLConfigConstants.getSecureSSLProtocols(settings, CertType.TRANSPORT)));
engine.setEnabledCipherSuites(
evalSecure(engine.getEnabledCipherSuites(), SSLConfigConstants.getSecureSSLCiphers(settings, false).toArray(new String[0]))
evalSecure(engine.getEnabledCipherSuites(), SSLConfigConstants.getSecureSSLCiphers(settings, CertType.TRANSPORT).toArray(new String[0]))
);
engine.setUseClientMode(true);
return engine;
} else {
final SSLEngine engine = externalSslContext.createSSLEngine();
engine.setEnabledProtocols(evalSecure(engine.getEnabledProtocols(), SSLConfigConstants.getSecureSSLProtocols(settings, false)));
engine.setEnabledProtocols(evalSecure(engine.getEnabledProtocols(), SSLConfigConstants.getSecureSSLProtocols(settings, CertType.TRANSPORT)));
engine.setEnabledCipherSuites(
evalSecure(engine.getEnabledCipherSuites(), SSLConfigConstants.getSecureSSLCiphers(settings, false).toArray(new String[0]))
evalSecure(engine.getEnabledCipherSuites(), SSLConfigConstants.getSecureSSLCiphers(settings, CertType.TRANSPORT).toArray(new String[0]))
);
engine.setUseClientMode(true);
return engine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,23 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLException;
import javax.net.ssl.TrustManagerFactory;

import org.opensearch.common.network.NetworkService;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.core.indices.breaker.CircuitBreakerService;
import org.opensearch.http.HttpServerTransport;
import org.opensearch.http.netty4.ssl.SecureNetty4HttpServerTransport;
import org.opensearch.plugins.NetworkPlugin;
import org.opensearch.plugins.SecureHttpTransportSettingsProvider;
import org.opensearch.plugins.SecureAuxTransportSettingsProvider;
import org.opensearch.plugins.SecureSettingsFactory;
import org.opensearch.plugins.SecureTransportSettingsProvider;
import org.opensearch.plugins.TransportExceptionHandler;
Expand All @@ -32,6 +39,7 @@
import org.opensearch.security.ssl.http.netty.Netty4ConditionalDecompressor;
import org.opensearch.security.ssl.http.netty.Netty4HttpRequestHeaderVerifier;
import org.opensearch.security.ssl.transport.SSLConfig;
import org.opensearch.telemetry.tracing.Tracer;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.Transport;
import org.opensearch.transport.TransportAdapterProvider;
Expand Down Expand Up @@ -185,4 +193,49 @@ public Optional<SSLEngine> buildSecureHttpServerEngine(Settings settings, HttpSe
}
});
}

@Override
public Optional<SecureAuxTransportSettingsProvider> getSecureAuxTransportSettingsProvider(Settings settings) {
return Optional.of(new SecureAuxTransportSettingsProvider() {
@Override
public Optional<SecureAuxTransportSettingsProvider.SecureAuxTransportParameters> parameters() {
return Optional.of(new SecureAuxTransportSettingsProvider.SecureAuxTransportParameters() {

@Override
public Optional<String> sslProvider() {
return sslSettingsManager.sslConfiguration(CertType.AUX).map(config -> config.sslParameters().provider().name());
}

@Override
public Optional<String> clientAuth() {
return sslSettingsManager.sslConfiguration(CertType.AUX).map(config -> config.sslParameters().clientAuth().name());
}

@Override
public Collection<String> protocols() {
return sslSettingsManager.sslConfiguration(CertType.AUX)
.map(config -> config.sslParameters().allowedProtocols())
.orElse(Collections.emptyList());
}

@Override
public Collection<String> cipherSuites() {
return sslSettingsManager.sslConfiguration(CertType.AUX)
.map(config -> config.sslParameters().allowedCiphers())
.orElse(Collections.emptyList());
}

@Override
public Optional<KeyManagerFactory> keyManagerFactory() {
return sslSettingsManager.sslConfiguration(CertType.AUX).map(SslConfiguration::keyStoreFactory);
}

@Override
public Optional<TrustManagerFactory> trustManagerFactory() {
return sslSettingsManager.sslConfiguration(CertType.AUX).map(SslConfiguration::trustStoreFactory);
}
});
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,54 @@ public List<Setting<?>> getSettings() {
)
);

/**
* TLS settings for aux transports.
*/
settings.add(
Setting.boolSetting(
SSLConfigConstants.SECURITY_SSL_AUX_ENABLE_OPENSSL_IF_AVAILABLE,
OPENSSL_SUPPORTED,
Property.NodeScope,
Property.Filtered
)
);
settings.add(
Setting.boolSetting(
SSLConfigConstants.SECURITY_SSL_AUX_ENABLED,
SSLConfigConstants.SECURITY_SSL_AUX_ENABLED_DEFAULT,
Property.NodeScope,
Property.Filtered
)
);
settings.add(
Setting.listSetting(
SSLConfigConstants.SECURITY_SSL_AUX_ENABLED_CIPHERS,
Collections.emptyList(),
Function.identity(),
Property.NodeScope
)
);
settings.add(
Setting.listSetting(
SSLConfigConstants.SECURITY_SSL_AUX_ENABLED_PROTOCOLS,
Collections.emptyList(),
Function.identity(),
Property.NodeScope
)
);
settings.add(Setting.simpleString(SSLConfigConstants.SECURITY_SSL_AUX_CLIENTAUTH_MODE, Property.NodeScope, Property.Filtered));
settings.add(Setting.simpleString(SSLConfigConstants.SECURITY_SSL_AUX_KEYSTORE_ALIAS, Property.NodeScope, Property.Filtered));
settings.add(Setting.simpleString(SSLConfigConstants.SECURITY_SSL_AUX_KEYSTORE_FILEPATH, Property.NodeScope, Property.Filtered));
settings.add(Setting.simpleString(SSLConfigConstants.SECURITY_SSL_AUX_KEYSTORE_TYPE, Property.NodeScope, Property.Filtered));
settings.add(Setting.simpleString(SSLConfigConstants.SECURITY_SSL_AUX_TRUSTSTORE_ALIAS, Property.NodeScope, Property.Filtered));
settings.add(Setting.simpleString(SSLConfigConstants.SECURITY_SSL_AUX_TRUSTSTORE_FILEPATH, Property.NodeScope, Property.Filtered));
settings.add(Setting.simpleString(SSLConfigConstants.SECURITY_SSL_AUX_TRUSTSTORE_TYPE, Property.NodeScope, Property.Filtered));
settings.add(Setting.simpleString(SSLConfigConstants.SECURITY_SSL_AUX_PEMCERT_FILEPATH, Property.NodeScope, Property.Filtered));
settings.add(Setting.simpleString(SSLConfigConstants.SECURITY_SSL_AUX_PEMKEY_FILEPATH, Property.NodeScope, Property.Filtered));
settings.add(
Setting.simpleString(SSLConfigConstants.SECURITY_SSL_AUX_PEMTRUSTEDCAS_FILEPATH, Property.NodeScope, Property.Filtered)
);

return settings;
}

Expand Down
Loading
Loading