Skip to content

Commit

Permalink
Add isDualModeEnabled to SecureTransportSettingsProvider interface
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Oct 18, 2024
1 parent 9096aee commit aa48614
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public SSLServerChannelInitializer(String name) {
protected void initChannel(Channel ch) throws Exception {
super.initChannel(ch);

final boolean dualModeEnabled = NetworkModule.TRANSPORT_SSL_DUAL_MODE_ENABLED.get(settings);
final boolean dualModeEnabled = secureTransportSettingsProvider.isDualModeEnabled(settings);
if (dualModeEnabled) {
logger.info("SSL Dual mode enabled, using port unification handler");
final ChannelHandler portUnificationHandler = new DualModeSslHandler(
Expand Down Expand Up @@ -258,7 +258,7 @@ protected class SSLClientChannelInitializer extends Netty4Transport.ClientChanne
public SSLClientChannelInitializer(DiscoveryNode node) {
this.node = node;

final boolean dualModeEnabled = NetworkModule.TRANSPORT_SSL_DUAL_MODE_ENABLED.get(settings);
final boolean dualModeEnabled = secureTransportSettingsProvider.isDualModeEnabled(settings);
hostnameVerificationEnabled = NetworkModule.TRANSPORT_SSL_ENFORCE_HOSTNAME_VERIFICATION.get(settings);
hostnameVerificationResolveHostName = NetworkModule.TRANSPORT_SSL_ENFORCE_HOSTNAME_VERIFICATION_RESOLVE_HOST_NAME.get(settings);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.opensearch.plugins;

import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.common.network.NetworkModule;
import org.opensearch.common.settings.Settings;
import org.opensearch.transport.Transport;
import org.opensearch.transport.TransportAdapterProvider;
Expand Down Expand Up @@ -36,6 +37,15 @@ default Collection<TransportAdapterProvider<Transport>> getTransportAdapterProvi
return Collections.emptyList();
}

/**
* Returns true if dual mode is enabled. Dual mode domains support both encrypted and non-encrypted traffic
* @param settings settings
* @return a boolean indicating if dual mode is enabled
*/
default boolean isDualModeEnabled(Settings settings) {

}

/**
* If supported, builds the {@link TransportExceptionHandler} instance for {@link Transport} instance
* @param settings settings
Expand Down

0 comments on commit aa48614

Please sign in to comment.