Configurable SSLEngineProvider in classic remoting, #23732
This commit is contained in:
parent
e343222505
commit
27e9587a3b
11 changed files with 419 additions and 173 deletions
|
|
@ -14,11 +14,13 @@ import akka.remote.transport.netty.{ NettySSLSupport, SSLSettings }
|
|||
import akka.testkit._
|
||||
import akka.util.Timeout
|
||||
import com.typesafe.config._
|
||||
|
||||
import scala.concurrent.{ Await, Future }
|
||||
import scala.concurrent.duration._
|
||||
import scala.reflect.classTag
|
||||
|
||||
import akka.event.Logging
|
||||
import akka.remote.transport.netty.ConfigSSLEngineProvider
|
||||
|
||||
object Configuration {
|
||||
// set this in your JAVA_OPTS to see all ssl debug info: "-Djavax.net.debug=ssl,keymanager"
|
||||
// The certificate will expire in 2109
|
||||
|
|
@ -63,14 +65,15 @@ object Configuration {
|
|||
val fullConfig = config.withFallback(AkkaSpec.testConf).withFallback(ConfigFactory.load).getConfig("akka.remote.netty.ssl.security")
|
||||
val settings = new SSLSettings(fullConfig)
|
||||
|
||||
val rng = settings.createSecureRandom(NoMarkerLogging)
|
||||
val sslEngineProvider = new ConfigSSLEngineProvider(NoMarkerLogging, settings)
|
||||
val rng = sslEngineProvider.createSecureRandom()
|
||||
|
||||
rng.nextInt() // Has to work
|
||||
val sRng = settings.SSLRandomNumberGenerator
|
||||
if (rng.getAlgorithm != sRng && sRng != "")
|
||||
throw new NoSuchAlgorithmException(sRng)
|
||||
|
||||
val engine = NettySSLSupport(settings, NoMarkerLogging, isClient = true).getEngine
|
||||
val engine = sslEngineProvider.createClientSSLEngine()
|
||||
val gotAllSupported = enabled.toSet diff engine.getSupportedCipherSuites.toSet
|
||||
val gotAllEnabled = enabled.toSet diff engine.getEnabledCipherSuites.toSet
|
||||
gotAllSupported.isEmpty || (throw new IllegalArgumentException("Cipher Suite not supported: " + gotAllSupported))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue