Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix Shallow copy snapshot failures on closed index ([#16868](https://github.com/opensearch-project/OpenSearch/pull/16868))
- Fix multi-value sort for unsigned long ([#16732](https://github.com/opensearch-project/OpenSearch/pull/16732))
- The `phone-search` analyzer no longer emits the tel/sip prefix, international calling code, extension numbers and unformatted input as a token ([#16993](https://github.com/opensearch-project/OpenSearch/pull/16993))
- Fix GRPC AUX_TRANSPORT_PORT and SETTING_GRPC_PORT settings and remove lingering HTTP terminology ([#17037](https://github.com/opensearch-project/OpenSearch/pull/17037))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import static org.opensearch.transport.grpc.Netty4GrpcServerTransport.GRPC_TRANSPORT_SETTING_KEY;
import static org.opensearch.transport.grpc.Netty4GrpcServerTransport.SETTING_GRPC_BIND_HOST;
import static org.opensearch.transport.grpc.Netty4GrpcServerTransport.SETTING_GRPC_HOST;
import static org.opensearch.transport.grpc.Netty4GrpcServerTransport.SETTING_GRPC_PORTS;
import static org.opensearch.transport.grpc.Netty4GrpcServerTransport.SETTING_GRPC_PORT;
import static org.opensearch.transport.grpc.Netty4GrpcServerTransport.SETTING_GRPC_PUBLISH_HOST;
import static org.opensearch.transport.grpc.Netty4GrpcServerTransport.SETTING_GRPC_PUBLISH_PORT;
import static org.opensearch.transport.grpc.Netty4GrpcServerTransport.SETTING_GRPC_WORKER_COUNT;
Expand Down Expand Up @@ -58,7 +58,7 @@ public Map<String, Supplier<AuxTransport>> getAuxTransports(
@Override
public List<Setting<?>> getSettings() {
return List.of(
SETTING_GRPC_PORTS,
SETTING_GRPC_PORT,
SETTING_GRPC_HOST,
SETTING_GRPC_PUBLISH_HOST,
SETTING_GRPC_BIND_HOST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public class Netty4GrpcServerTransport extends NetworkPlugin.AuxTransport {

/**
* Port range on which to bind.
* Note this setting is configured through AffixSetting AUX_TRANSPORT_PORTS where the aux transport type matches the GRPC_TRANSPORT_SETTING_KEY.
* Note this setting is configured through AffixSetting AUX_TRANSPORT_PORT where the aux transport type matches the GRPC_TRANSPORT_SETTING_KEY.
*/
public static final Setting<PortsRange> SETTING_GRPC_PORTS = AUX_TRANSPORT_PORTS.getConcreteSettingForNamespace(
public static final Setting<PortsRange> SETTING_GRPC_PORT = AUX_TRANSPORT_PORT.getConcreteSettingForNamespace(
GRPC_TRANSPORT_SETTING_KEY
);

Expand Down Expand Up @@ -134,20 +134,21 @@ public class Netty4GrpcServerTransport extends NetworkPlugin.AuxTransport {
* @param networkService the bind/publish addresses.
*/
public Netty4GrpcServerTransport(Settings settings, List<BindableService> services, NetworkService networkService) {
logger.debug("Initializing Netty4GrpcServerTransport with settings = {}", settings);
this.settings = Objects.requireNonNull(settings);
this.services = Objects.requireNonNull(services);
this.networkService = Objects.requireNonNull(networkService);

final List<String> httpBindHost = SETTING_GRPC_BIND_HOST.get(settings);
this.bindHosts = (httpBindHost.isEmpty() ? NetworkService.GLOBAL_NETWORK_BIND_HOST_SETTING.get(settings) : httpBindHost).toArray(
final List<String> grpcBindHost = SETTING_GRPC_BIND_HOST.get(settings);
this.bindHosts = (grpcBindHost.isEmpty() ? NetworkService.GLOBAL_NETWORK_BIND_HOST_SETTING.get(settings) : grpcBindHost).toArray(
Strings.EMPTY_ARRAY
);

final List<String> httpPublishHost = SETTING_GRPC_PUBLISH_HOST.get(settings);
this.publishHosts = (httpPublishHost.isEmpty() ? NetworkService.GLOBAL_NETWORK_PUBLISH_HOST_SETTING.get(settings) : httpPublishHost)
final List<String> grpcPublishHost = SETTING_GRPC_PUBLISH_HOST.get(settings);
this.publishHosts = (grpcPublishHost.isEmpty() ? NetworkService.GLOBAL_NETWORK_PUBLISH_HOST_SETTING.get(settings) : grpcPublishHost)
.toArray(Strings.EMPTY_ARRAY);

this.port = SETTING_GRPC_PORTS.get(settings);
this.port = SETTING_GRPC_PORT.get(settings);
this.nettyEventLoopThreads = SETTING_GRPC_WORKER_COUNT.get(settings);
}

Expand Down Expand Up @@ -229,7 +230,7 @@ private void bindServer() {
+ publishInetAddress
+ "). "
+ "Please specify a unique port by setting "
+ SETTING_GRPC_PORTS.getKey()
+ SETTING_GRPC_PORT.getKey()
+ " or "
+ SETTING_GRPC_PUBLISH_PORT.getKey()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public void test() {
}

private static Settings createSettings() {
return Settings.builder().put(Netty4GrpcServerTransport.SETTING_GRPC_PORTS.getKey(), getPortRange()).build();
return Settings.builder().put(Netty4GrpcServerTransport.SETTING_GRPC_PORT.getKey(), getPortRange()).build();
}
}
6 changes: 3 additions & 3 deletions server/src/main/java/org/opensearch/bootstrap/Security.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
import static org.opensearch.bootstrap.FilePermissionUtils.addDirectoryPath;
import static org.opensearch.bootstrap.FilePermissionUtils.addSingleFilePath;
import static org.opensearch.plugins.NetworkPlugin.AuxTransport.AUX_PORT_DEFAULTS;
import static org.opensearch.plugins.NetworkPlugin.AuxTransport.AUX_TRANSPORT_PORTS;
import static org.opensearch.plugins.NetworkPlugin.AuxTransport.AUX_TRANSPORT_PORT;
import static org.opensearch.plugins.NetworkPlugin.AuxTransport.AUX_TRANSPORT_TYPES_SETTING;

/**
Expand Down Expand Up @@ -423,7 +423,7 @@ private static void addSocketPermissionForHttp(final Permissions policy, final S
}

/**
* Add dynamic {@link SocketPermission} based on AffixSetting AUX_TRANSPORT_PORTS.
* Add dynamic {@link SocketPermission} based on AffixSetting AUX_TRANSPORT_PORT.
* If an auxiliary transport type is enabled but has no corresponding port range setting fall back to AUX_PORT_DEFAULTS.
*
* @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to.
Expand All @@ -432,7 +432,7 @@ private static void addSocketPermissionForHttp(final Permissions policy, final S
private static void addSocketPermissionForAux(final Permissions policy, final Settings settings) {
Set<PortsRange> portsRanges = new HashSet<>();
for (String auxType : AUX_TRANSPORT_TYPES_SETTING.get(settings)) {
Setting<PortsRange> auxTypePortSettings = AUX_TRANSPORT_PORTS.getConcreteSettingForNamespace(auxType);
Setting<PortsRange> auxTypePortSettings = AUX_TRANSPORT_PORT.getConcreteSettingForNamespace(auxType);
if (auxTypePortSettings.exists(settings)) {
portsRanges.add(auxTypePortSettings.get(settings));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ abstract class AuxTransport extends AbstractLifecycleComponent {
public static final String AUX_SETTINGS_PREFIX = "aux.transport.";
public static final String AUX_TRANSPORT_TYPES_KEY = AUX_SETTINGS_PREFIX + "types";
public static final String AUX_PORT_DEFAULTS = "9400-9500";
public static final Setting.AffixSetting<PortsRange> AUX_TRANSPORT_PORTS = affixKeySetting(
public static final Setting.AffixSetting<PortsRange> AUX_TRANSPORT_PORT = affixKeySetting(
AUX_SETTINGS_PREFIX,
"ports",
"port",
key -> new Setting<>(key, AUX_PORT_DEFAULTS, PortsRange::new, Setting.Property.NodeScope)
);

Expand Down