Skip to content

Commit 0a41b13

Browse files
jaymodetvernum
authored andcommitted
Remove the client transport profile filter (#43236)
Now that the transport client has been removed, the client transport profile filter can be removed from security. This filter prevented node actions from being executed using a transport client.
1 parent 1f61152 commit 0a41b13

File tree

9 files changed

+88
-464
lines changed

9 files changed

+88
-464
lines changed

docs/reference/migration/migrate_8_0/security.asciidoc

+8
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,11 @@ The `elasticsearch-migrate` tool provided a way to convert file
3333
realm users and roles into the native realm. It has been deprecated
3434
since 7.2.0. Users and roles should now be created in the native
3535
realm directly.
36+
37+
[float]
38+
[[separating-node-and-client-traffic]]
39+
==== The `transport.profiles.*.xpack.security.type` setting has been removed
40+
41+
The `transport.profiles.*.xpack.security.type` setting has been removed since
42+
the Transport Client has been removed and therefore all client traffic now uses
43+
the HTTP transport. Transport profiles using this setting should be removed.

docs/reference/security/securing-communications/separating-node-client-traffic.asciidoc

-68
This file was deleted.

x-pack/docs/en/security/configuring-es.asciidoc

-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ include::{es-repo-dir}/security/securing-communications/configuring-tls-docker.a
148148
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/security/securing-communications/enabling-cipher-suites.asciidoc
149149
include::{es-repo-dir}/security/securing-communications/enabling-cipher-suites.asciidoc[]
150150

151-
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/security/securing-communications/separating-node-client-traffic.asciidoc
152-
include::{es-repo-dir}/security/securing-communications/separating-node-client-traffic.asciidoc[]
153-
154151
:edit_url:
155152
include::authentication/configuring-active-directory-realm.asciidoc[]
156153
include::authentication/configuring-file-realm.asciidoc[]

x-pack/docs/en/security/securing-communications.asciidoc

-5
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,3 @@ include::{es-repo-dir}/security/securing-communications/setting-up-ssl.asciidoc[
2424
=== Enabling cipher suites for stronger encryption
2525

2626
See {ref}/ciphers.html[Enabling Cipher Suites for Stronger Encryption].
27-
28-
[[separating-node-client-traffic]]
29-
=== Separating node-to-node and client traffic
30-
31-
See {ref}/separating-node-client-traffic.html[Separating node-to-node and client traffic].

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java

-1
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,6 @@ public static List<Setting<?>> getSettings(List<SecurityExtension> securityExten
604604
settingsList.add(TokenService.TOKEN_EXPIRATION);
605605
settingsList.add(TokenService.DELETE_INTERVAL);
606606
settingsList.add(TokenService.DELETE_TIMEOUT);
607-
settingsList.add(SecurityServerTransportInterceptor.TRANSPORT_TYPE_PROFILE_SETTING);
608607
settingsList.addAll(SSLConfigurationSettings.getProfileSettings());
609608
settingsList.add(ApiKeyService.PASSWORD_HASHING_ALGORITHM);
610609
settingsList.add(ApiKeyService.DELETE_TIMEOUT);

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/transport/SecurityServerTransportInterceptor.java

+2-29
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.elasticsearch.action.support.DestructiveOperations;
1313
import org.elasticsearch.cluster.service.ClusterService;
1414
import org.elasticsearch.common.CheckedConsumer;
15-
import org.elasticsearch.common.settings.Setting;
1615
import org.elasticsearch.common.settings.Settings;
1716
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
1817
import org.elasticsearch.common.util.concurrent.ThreadContext;
@@ -45,24 +44,13 @@
4544
import java.util.HashMap;
4645
import java.util.Map;
4746
import java.util.concurrent.Executor;
48-
import java.util.function.Function;
4947

5048
import static org.elasticsearch.xpack.core.security.SecurityField.setting;
5149

5250
public class SecurityServerTransportInterceptor implements TransportInterceptor {
5351

54-
private static final Function<String, Setting<String>> TRANSPORT_TYPE_SETTING_TEMPLATE = key -> new Setting<>(key, "node", v -> {
55-
if (v.equals("node") || v.equals("client")) {
56-
return v;
57-
}
58-
throw new IllegalArgumentException("type must be one of [client, node]");
59-
}, Setting.Property.NodeScope);
60-
private static final String TRANSPORT_TYPE_SETTING_KEY = "xpack.security.type";
6152
private static final Logger logger = LogManager.getLogger(SecurityServerTransportInterceptor.class);
6253

63-
public static final Setting.AffixSetting<String> TRANSPORT_TYPE_PROFILE_SETTING = Setting.affixKeySetting("transport.profiles.",
64-
TRANSPORT_TYPE_SETTING_KEY, TRANSPORT_TYPE_SETTING_TEMPLATE);
65-
6654
private final AuthenticationService authcService;
6755
private final AuthorizationService authzService;
6856
private final SSLService sslService;
@@ -71,7 +59,6 @@ public class SecurityServerTransportInterceptor implements TransportInterceptor
7159
private final ThreadPool threadPool;
7260
private final Settings settings;
7361
private final SecurityContext securityContext;
74-
private final boolean reservedRealmEnabled;
7562

7663
private volatile boolean isStateNotRecovered = true;
7764

@@ -92,7 +79,6 @@ public SecurityServerTransportInterceptor(Settings settings,
9279
this.sslService = sslService;
9380
this.securityContext = securityContext;
9481
this.profileFilters = initializeProfileFilters(destructiveOperations);
95-
this.reservedRealmEnabled = XPackSettings.RESERVED_REALM_ENABLED_SETTING.get(settings);
9682
clusterService.addListener(e -> isStateNotRecovered = e.state().blocks().hasGlobalBlock(GatewayService.STATE_NOT_RECOVERED_BLOCK));
9783
}
9884

@@ -187,21 +173,8 @@ private Map<String, ServerTransportFilter> initializeProfileFilters(DestructiveO
187173
for (Map.Entry<String, SSLConfiguration> entry : profileConfigurations.entrySet()) {
188174
final SSLConfiguration profileConfiguration = entry.getValue();
189175
final boolean extractClientCert = transportSSLEnabled && sslService.isSSLClientAuthEnabled(profileConfiguration);
190-
final String type = TRANSPORT_TYPE_PROFILE_SETTING.getConcreteSettingForNamespace(entry.getKey()).get(settings);
191-
switch (type) {
192-
case "client":
193-
profileFilters.put(entry.getKey(), new ServerTransportFilter.ClientProfile(authcService, authzService,
194-
threadPool.getThreadContext(), extractClientCert, destructiveOperations, reservedRealmEnabled,
195-
securityContext, licenseState));
196-
break;
197-
case "node":
198-
profileFilters.put(entry.getKey(), new ServerTransportFilter.NodeProfile(authcService, authzService,
199-
threadPool.getThreadContext(), extractClientCert, destructiveOperations, reservedRealmEnabled,
200-
securityContext, licenseState));
201-
break;
202-
default:
203-
throw new IllegalStateException("unknown profile type: " + type);
204-
}
176+
profileFilters.put(entry.getKey(), new ServerTransportFilter(authcService, authzService, threadPool.getThreadContext(),
177+
extractClientCert, destructiveOperations, securityContext, licenseState));
205178
}
206179

207180
return Collections.unmodifiableMap(profileFilters);

0 commit comments

Comments
 (0)