28
28
import org .elasticsearch .common .settings .Setting ;
29
29
import org .elasticsearch .common .settings .Settings ;
30
30
import org .elasticsearch .common .settings .SettingsFilter ;
31
- import org .elasticsearch .common .ssl .SslConfiguration ;
32
31
import org .elasticsearch .common .util .BigArrays ;
33
32
import org .elasticsearch .core .Booleans ;
34
33
import org .elasticsearch .env .Environment ;
110
109
import org .elasticsearch .xpack .core .security .authz .RoleMappingMetadata ;
111
110
import org .elasticsearch .xpack .core .ssl .SSLConfigurationReloader ;
112
111
import org .elasticsearch .xpack .core .ssl .SSLService ;
112
+ import org .elasticsearch .xpack .core .ssl .extension .SslProfileExtension ;
113
113
import org .elasticsearch .xpack .core .termsenum .action .TermsEnumAction ;
114
114
import org .elasticsearch .xpack .core .termsenum .action .TransportTermsEnumAction ;
115
115
import org .elasticsearch .xpack .core .termsenum .rest .RestTermsEnumAction ;
@@ -185,6 +185,8 @@ public Void run() {
185
185
private static SetOnce <XPackLicenseState > licenseState = new SetOnce <>();
186
186
private static SetOnce <LicenseService > licenseService = new SetOnce <>();
187
187
188
+ private final List <SslProfileExtension > sslExtensions = new ArrayList <>();
189
+
188
190
public XPackPlugin (final Settings settings ) {
189
191
super ();
190
192
// FIXME: The settings might be changed after this (e.g. from "additionalSettings" method in other plugins)
@@ -465,6 +467,8 @@ public List<Setting<?>> getSettings() {
465
467
List <Setting <?>> settings = super .getSettings ();
466
468
settings .add (SourceOnlySnapshotRepository .SOURCE_ONLY );
467
469
470
+ settings .addAll (SSLService .getExtensionSettings (this .sslExtensions ));
471
+
468
472
// Don't register the license setting if there is an alternate implementation loaded as an extension.
469
473
// this relies on the order in which methods are called - loadExtensions, (this method) getSettings, then createComponents
470
474
if (getSharedLicenseService () == null ) {
@@ -496,9 +500,9 @@ public Collection<IndexSettingProvider> getAdditionalIndexSettingProviders(Index
496
500
* of SSLContexts when configuration files change on disk.
497
501
*/
498
502
private SSLService createSSLService (Environment environment , ResourceWatcherService resourceWatcherService ) {
499
- final Map < String , SslConfiguration > sslConfigurations = SSLService .getSSLConfigurations (environment );
503
+ final SSLService . LoadedSslConfigurations sslConfigurations = SSLService .getSSLConfigurations (environment , this . sslExtensions );
500
504
// Must construct the reloader before the SSL service so that we don't miss any config changes, see #54867
501
- final SSLConfigurationReloader reloader = new SSLConfigurationReloader (resourceWatcherService , sslConfigurations . values () );
505
+ final SSLConfigurationReloader reloader = new SSLConfigurationReloader (resourceWatcherService , sslConfigurations );
502
506
final SSLService sslService = new SSLService (environment , sslConfigurations );
503
507
reloader .setSSLService (sslService );
504
508
setSslService (sslService );
@@ -507,6 +511,11 @@ private SSLService createSSLService(Environment environment, ResourceWatcherServ
507
511
508
512
@ Override
509
513
public void loadExtensions (ExtensionLoader loader ) {
514
+ loadLicenseService (loader );
515
+ this .sslExtensions .addAll (loader .loadExtensions (SslProfileExtension .class ));
516
+ }
517
+
518
+ private void loadLicenseService (ExtensionLoader loader ) {
510
519
List <MutableLicenseService > licenseServices = loader .loadExtensions (MutableLicenseService .class );
511
520
if (licenseServices .size () > 1 ) {
512
521
throw new IllegalStateException (MutableLicenseService .class + " may not have multiple implementations" );
0 commit comments