I am trying to configure Helidon Webserver with mutual SSL in http4k.
The following is my configuration
class HelidonSsl(val port: Int = 8305) : ServerConfig {
override val stopMode = ServerConfig.StopMode.Immediate
override fun toServer(http: HttpHandler): Http4kServer {
val keystorePath = "keystore/ssl.keystore"
val keystorePassword = "changeit"
// Set up SSL/TLS configuration if keystore and truststore are present
val keyStoreKey = Keys.builder()
.keystore(
KeystoreKeys.builder()
.keystore(Resource.create(keystorePath))
.passphrase(keystorePassword)
.trustStore(true)
.build()
)
.build()
val tlsConfig = TlsConfig.builder()
.trustAll(true)
.privateKey(keyStoreKey)
.clientAuth(TlsClientAuth.OPTIONAL)
.build()
val server = WebServer.builder()
.tls(tlsConfig)
.port(port)
.build()
return object : Http4kServer {
override fun start() = apply { server.start() }
override fun stop() = apply { server.stop() }
override fun port(): Int = if (port != 0) port else server.port()
}
}
The server starts, but when connections are made, I get the following error stack :
I have checked :
- keystore – contains self signed cert usign RSA & password is fine – used the same keystore with Jetty and works fine
- different configuration options
- debugging shows that the key manager is set to DummyKeyManager instance and this seems to cause the errors but not sure how to fix that
1