|
34 | 34 | import org.elasticsearch.common.regex.Regex;
|
35 | 35 | import org.elasticsearch.common.settings.ClusterSettings;
|
36 | 36 | import org.elasticsearch.common.settings.IndexScopedSettings;
|
| 37 | +import org.elasticsearch.common.settings.SecureSettings; |
37 | 38 | import org.elasticsearch.common.settings.Setting;
|
38 | 39 | import org.elasticsearch.common.settings.Setting.Property;
|
39 | 40 | import org.elasticsearch.common.settings.Settings;
|
@@ -811,11 +812,22 @@ private static void addTribeSettings(Settings settings, Settings.Builder setting
|
811 | 812 | }
|
812 | 813 |
|
813 | 814 | // we passed all the checks now we need to copy in all of the x-pack security settings
|
814 |
| - settings.keySet().forEach(k -> { |
| 815 | + SecureSettings secureSettings = Settings.builder().put(settings).getSecureSettings(); // hack to get at secure settings... |
| 816 | + Set<String> secureSettingKeys = secureSettings == null ? Collections.emptySet() : secureSettings.getSettingNames(); |
| 817 | + List<String> invalidSettings = new ArrayList<>(); |
| 818 | + for (String k : settings.keySet()) { |
815 | 819 | if (k.startsWith("xpack.security.")) {
|
816 |
| - settingsBuilder.copy(tribePrefix + k, k, settings); |
| 820 | + if (secureSettingKeys.contains(k)) { |
| 821 | + invalidSettings.add(k); |
| 822 | + } else { |
| 823 | + settingsBuilder.copy(tribePrefix + k, k, settings); |
| 824 | + } |
817 | 825 | }
|
818 |
| - }); |
| 826 | + } |
| 827 | + if (invalidSettings.isEmpty() == false) { |
| 828 | + throw new IllegalArgumentException("Secure settings " + invalidSettings.toString() + |
| 829 | + " cannot be used with tribe client node"); |
| 830 | + } |
819 | 831 | }
|
820 | 832 |
|
821 | 833 | Map<String, Settings> realmsSettings = settings.getGroups(SecurityField.setting("authc.realms"), true);
|
|
0 commit comments