From f73d0c7a07150d41828f17a1ba48b32af2effd38 Mon Sep 17 00:00:00 2001 From: Jay Modi Date: Fri, 6 Oct 2017 08:43:32 -0600 Subject: [PATCH] Add transport ssl enabled value back to security usage (elastic/x-pack-elasticsearch#2695) Since the transport ssl enabled setting is usable in 6.x again, this change adds back the value to the xpack security usage so that it can be included in phone home data. Original commit: elastic/x-pack-elasticsearch@52f6176df0feb2f9bd16e91bc2ce9430f2dd89bd --- .../elasticsearch/xpack/security/SecurityFeatureSet.java | 6 +++++- .../xpack/security/SecurityFeatureSetTests.java | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/SecurityFeatureSet.java b/plugin/src/main/java/org/elasticsearch/xpack/security/SecurityFeatureSet.java index f957a0b7c6b..562f36a8c41 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/SecurityFeatureSet.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/SecurityFeatureSet.java @@ -32,6 +32,7 @@ import org.elasticsearch.xpack.security.user.AnonymousUser; import static java.util.Collections.singletonMap; import static org.elasticsearch.xpack.XPackSettings.HTTP_SSL_ENABLED; +import static org.elasticsearch.xpack.XPackSettings.TRANSPORT_SSL_ENABLED; /** * Indicates whether the features of Security are currently in use @@ -141,7 +142,10 @@ public class SecurityFeatureSet implements XPackFeatureSet { } static Map sslUsage(Settings settings) { - return singletonMap("http", singletonMap("enabled", HTTP_SSL_ENABLED.get(settings))); + Map map = new HashMap<>(2); + map.put("http", singletonMap("enabled", HTTP_SSL_ENABLED.get(settings))); + map.put("transport", singletonMap("enabled", TRANSPORT_SSL_ENABLED.get(settings))); + return map; } static Map auditUsage(Settings settings) { diff --git a/plugin/src/test/java/org/elasticsearch/xpack/security/SecurityFeatureSetTests.java b/plugin/src/test/java/org/elasticsearch/xpack/security/SecurityFeatureSetTests.java index cef6ec0a0bd..28ecee00867 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/security/SecurityFeatureSetTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/security/SecurityFeatureSetTests.java @@ -97,6 +97,8 @@ public class SecurityFeatureSetTests extends ESTestCase { final boolean httpSSLEnabled = randomBoolean(); settings.put("xpack.security.http.ssl.enabled", httpSSLEnabled); + final boolean transportSSLEnabled = randomBoolean(); + settings.put("xpack.security.transport.ssl.enabled", transportSSLEnabled); final boolean auditingEnabled = randomBoolean(); settings.put(XPackSettings.AUDIT_ENABLED.getKey(), auditingEnabled); final String[] auditOutputs = randomFrom( @@ -184,8 +186,9 @@ public class SecurityFeatureSetTests extends ESTestCase { assertThat(source.getValue("realms"), is(notNullValue())); } - // check http SSL + // check SSL assertThat(source.getValue("ssl.http.enabled"), is(httpSSLEnabled)); + assertThat(source.getValue("ssl.transport.enabled"), is(transportSSLEnabled)); // auditing assertThat(source.getValue("audit.enabled"), is(auditingEnabled));