@@ -76,6 +76,7 @@ type localStoreRPCSuite struct {
7676 internodeDynamicTLSFactory * TestFactory
7777 internodeMutualTLSRPCRefreshFactory * TestFactory
7878 frontendMutualTLSRPCRefreshFactory * TestFactory
79+ frontendConfigRootCAForceTLSFactory * TestFactory
7980
8081 internodeCertDir string
8182 frontendCertDir string
@@ -101,6 +102,7 @@ type localStoreRPCSuite struct {
101102 frontendConfigMutualTLS config.GroupTLS
102103 frontendConfigPerHostOverrides config.GroupTLS
103104 frontendConfigRootCAOnly config.GroupTLS
105+ frontendConfigRootCAForceTLS config.GroupTLS
104106 frontendConfigAltRootCAOnly config.GroupTLS
105107 frontendConfigSystemWorker config.WorkerTLS
106108 frontendConfigMutualTLSRefresh config.GroupTLS
@@ -201,6 +203,9 @@ func (s *localStoreRPCSuite) SetupSuite() {
201203 RootCAData : []string {convertFileToBase64 (s .frontendChain .CaPubFile )},
202204 },
203205 }
206+ s .frontendConfigRootCAForceTLS = s .frontendConfigRootCAOnly
207+ s .frontendConfigRootCAForceTLS .Client .ForceTLS = true
208+
204209 s .frontendConfigAltRootCAOnly = config.GroupTLS {
205210 Server : config.ServerTLS {
206211 RequireClientAuth : true ,
@@ -319,6 +324,13 @@ func (s *localStoreRPCSuite) setupFrontend() {
319324 },
320325 }
321326
327+ localStoreRootCAForceTLS := & config.Global {
328+ Membership : s .membershipConfig ,
329+ TLS : config.RootTLS {
330+ Frontend : s .frontendConfigRootCAForceTLS ,
331+ },
332+ }
333+
322334 provider , err := encryption .NewTLSConfigProviderFromConfig (localStoreMutualTLS .TLS , nil , s .logger , nil )
323335 s .NoError (err )
324336 frontendMutualTLSFactory := rpc .NewFactory (rpcTestCfgDefault , "tester" , s .logger , provider , dynamicconfig .NewNoopCollection ())
@@ -355,6 +367,12 @@ func (s *localStoreRPCSuite) setupFrontend() {
355367 s .internodeDynamicTLSFactory = i (dynamicServerTLSFactory )
356368
357369 s .frontendMutualTLSRPCRefreshFactory = f (frontendMutualTLSRefreshFactory )
370+
371+ provider , err = encryption .NewTLSConfigProviderFromConfig (localStoreRootCAForceTLS .TLS , nil , s .logger , nil )
372+ s .NoError (err )
373+ frontendRootCAForceTLSFactory := rpc .NewFactory (rpcTestCfgDefault , "tester" , s .logger , provider , dynamicconfig .NewNoopCollection ())
374+ s .NotNil (frontendServerTLSFactory )
375+ s .frontendConfigRootCAForceTLSFactory = f (frontendRootCAForceTLSFactory )
358376}
359377
360378func (s * localStoreRPCSuite ) setupInternode () {
@@ -789,3 +807,9 @@ func runRingpopTLSTest(s suite.Suite, logger log.Logger, serverA *TestFactory, s
789807 s .NoError (err )
790808 }
791809}
810+
811+ func (s * localStoreRPCSuite ) TestClientForceTLS () {
812+ options , err := s .frontendConfigRootCAForceTLSFactory .RPCFactory .GetFrontendGRPCServerOptions ()
813+ s .NoError (err )
814+ s .Nil (options )
815+ }
0 commit comments