44
44
import java .util .List ;
45
45
import java .util .Map ;
46
46
import java .util .Objects ;
47
+ import java .util .Optional ;
47
48
import java .util .Set ;
48
49
import java .util .concurrent .atomic .AtomicReference ;
49
50
import java .util .function .BiFunction ;
112
113
import org .opensearch .plugins .ExtensionAwarePlugin ;
113
114
import org .opensearch .plugins .IdentityPlugin ;
114
115
import org .opensearch .plugins .MapperPlugin ;
116
+ import org .opensearch .plugins .SecureSettingsFactory ;
117
+ import org .opensearch .plugins .SecureTransportSettingsProvider ;
115
118
import org .opensearch .repositories .RepositoriesService ;
116
119
import org .opensearch .rest .RestController ;
117
120
import org .opensearch .rest .RestHandler ;
148
151
import org .opensearch .security .dlic .rest .validation .PasswordValidator ;
149
152
import org .opensearch .security .filter .SecurityFilter ;
150
153
import org .opensearch .security .filter .SecurityRestFilter ;
151
- import org .opensearch .security .http .SecurityHttpServerTransport ;
152
- import org .opensearch .security .http .SecurityNonSslHttpServerTransport ;
154
+ import org .opensearch .security .http .NonSslHttpServerTransport ;
155
+ import org .opensearch .security .http .SecureHttpServerTransport ;
153
156
import org .opensearch .security .http .XFFResolver ;
154
157
import org .opensearch .security .identity .SecurityTokenManager ;
155
158
import org .opensearch .security .privileges .PrivilegesEvaluator ;
165
168
import org .opensearch .security .securityconf .DynamicConfigFactory ;
166
169
import org .opensearch .security .setting .OpensearchDynamicSetting ;
167
170
import org .opensearch .security .setting .TransportPassiveAuthSetting ;
171
+ import org .opensearch .security .ssl .OpenSearchSecureSettingsFactory ;
168
172
import org .opensearch .security .ssl .OpenSearchSecuritySSLPlugin ;
169
173
import org .opensearch .security .ssl .SslExceptionHandler ;
170
174
import org .opensearch .security .ssl .http .netty .ValidatingDispatcher ;
171
175
import org .opensearch .security .ssl .transport .DefaultPrincipalExtractor ;
172
- import org .opensearch .security .ssl .transport .SecuritySSLNettyTransport ;
173
176
import org .opensearch .security .ssl .util .SSLConfigConstants ;
174
177
import org .opensearch .security .support .ConfigConstants ;
175
178
import org .opensearch .security .support .GuardedSearchOperationWrapper ;
197
200
import org .opensearch .transport .TransportRequestOptions ;
198
201
import org .opensearch .transport .TransportResponseHandler ;
199
202
import org .opensearch .transport .TransportService ;
203
+ import org .opensearch .transport .netty4 .ssl .SecureNetty4Transport ;
200
204
import org .opensearch .watcher .ResourceWatcherService ;
201
205
202
206
import static org .opensearch .security .dlic .rest .api .RestApiAdminPrivilegesEvaluator .ENDPOINTS_WITH_PERMISSIONS ;
@@ -855,44 +859,44 @@ public <T extends TransportResponse> void sendRequest(
855
859
}
856
860
857
861
@ Override
858
- public Map <String , Supplier <Transport >> getTransports (
862
+ public Map <String , Supplier <Transport >> getSecureTransports (
859
863
Settings settings ,
860
864
ThreadPool threadPool ,
861
865
PageCacheRecycler pageCacheRecycler ,
862
866
CircuitBreakerService circuitBreakerService ,
863
867
NamedWriteableRegistry namedWriteableRegistry ,
864
868
NetworkService networkService ,
869
+ SecureTransportSettingsProvider secureTransportSettingsProvider ,
865
870
Tracer tracer
866
871
) {
867
872
Map <String , Supplier <Transport >> transports = new HashMap <String , Supplier <Transport >>();
868
873
869
874
if (SSLConfig .isSslOnlyMode ()) {
870
- return super .getTransports (
875
+ return super .getSecureTransports (
871
876
settings ,
872
877
threadPool ,
873
878
pageCacheRecycler ,
874
879
circuitBreakerService ,
875
880
namedWriteableRegistry ,
876
881
networkService ,
882
+ secureTransportSettingsProvider ,
877
883
tracer
878
884
);
879
885
}
880
886
881
887
if (transportSSLEnabled ) {
882
888
transports .put (
883
889
"org.opensearch.security.ssl.http.netty.SecuritySSLNettyTransport" ,
884
- () -> new SecuritySSLNettyTransport (
885
- settings ,
890
+ () -> new SecureNetty4Transport (
891
+ migrateSettings ( settings ) ,
886
892
Version .CURRENT ,
887
893
threadPool ,
888
894
networkService ,
889
895
pageCacheRecycler ,
890
896
namedWriteableRegistry ,
891
897
circuitBreakerService ,
892
- sks ,
893
- evaluateSslExceptionHandler (),
894
898
sharedGroupFactory ,
895
- SSLConfig ,
899
+ secureTransportSettingsProvider ,
896
900
tracer
897
901
)
898
902
);
@@ -901,7 +905,7 @@ public Map<String, Supplier<Transport>> getTransports(
901
905
}
902
906
903
907
@ Override
904
- public Map <String , Supplier <HttpServerTransport >> getHttpTransports (
908
+ public Map <String , Supplier <HttpServerTransport >> getSecureHttpTransports (
905
909
Settings settings ,
906
910
ThreadPool threadPool ,
907
911
BigArrays bigArrays ,
@@ -911,11 +915,12 @@ public Map<String, Supplier<HttpServerTransport>> getHttpTransports(
911
915
NetworkService networkService ,
912
916
Dispatcher dispatcher ,
913
917
ClusterSettings clusterSettings ,
918
+ SecureTransportSettingsProvider secureTransportSettingsProvider ,
914
919
Tracer tracer
915
920
) {
916
921
917
922
if (SSLConfig .isSslOnlyMode ()) {
918
- return super .getHttpTransports (
923
+ return super .getSecureHttpTransports (
919
924
settings ,
920
925
threadPool ,
921
926
bigArrays ,
@@ -925,6 +930,7 @@ public Map<String, Supplier<HttpServerTransport>> getHttpTransports(
925
930
networkService ,
926
931
dispatcher ,
927
932
clusterSettings ,
933
+ secureTransportSettingsProvider ,
928
934
tracer
929
935
);
930
936
}
@@ -940,17 +946,16 @@ public Map<String, Supplier<HttpServerTransport>> getHttpTransports(
940
946
evaluateSslExceptionHandler ()
941
947
);
942
948
// TODO close odshst
943
- final SecurityHttpServerTransport odshst = new SecurityHttpServerTransport (
944
- settings ,
949
+ final SecureHttpServerTransport odshst = new SecureHttpServerTransport (
950
+ migrateSettings ( settings ) ,
945
951
networkService ,
946
952
bigArrays ,
947
953
threadPool ,
948
- sks ,
949
- evaluateSslExceptionHandler (),
950
954
xContentRegistry ,
951
955
validatingDispatcher ,
952
956
clusterSettings ,
953
957
sharedGroupFactory ,
958
+ secureTransportSettingsProvider ,
954
959
tracer ,
955
960
securityRestHandler
956
961
);
@@ -959,15 +964,16 @@ public Map<String, Supplier<HttpServerTransport>> getHttpTransports(
959
964
} else if (!client ) {
960
965
return Collections .singletonMap (
961
966
"org.opensearch.security.http.SecurityHttpServerTransport" ,
962
- () -> new SecurityNonSslHttpServerTransport (
963
- settings ,
967
+ () -> new NonSslHttpServerTransport (
968
+ migrateSettings ( settings ) ,
964
969
networkService ,
965
970
bigArrays ,
966
971
threadPool ,
967
972
xContentRegistry ,
968
973
dispatcher ,
969
974
clusterSettings ,
970
975
sharedGroupFactory ,
976
+ secureTransportSettingsProvider ,
971
977
tracer ,
972
978
securityRestHandler
973
979
)
@@ -2003,6 +2009,11 @@ public SecurityTokenManager getTokenManager() {
2003
2009
return tokenManager ;
2004
2010
}
2005
2011
2012
+ @ Override
2013
+ public Optional <SecureSettingsFactory > getSecureSettingFactory (Settings settings ) {
2014
+ return Optional .of (new OpenSearchSecureSettingsFactory (settings , sks , sslExceptionHandler ));
2015
+ }
2016
+
2006
2017
public static class GuiceHolder implements LifecycleComponent {
2007
2018
2008
2019
private static RepositoriesService repositoriesService ;
0 commit comments