problem: used slow JDK TLS

This commit is contained in:
Igor Artamonov
2020-05-24 13:03:00 -04:00
committed by GitHub
parent 4a698f8c09
commit 47eb126a75
3 changed files with 14 additions and 2 deletions

View File

@@ -57,8 +57,12 @@ dependencies {
implementation "io.grpc:grpc-protobuf:${grpcVersion}" implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}" implementation "io.grpc:grpc-stub:${grpcVersion}"
implementation "io.grpc:grpc-netty:${grpcVersion}" implementation "io.grpc:grpc-netty:${grpcVersion}"
implementation "io.netty:netty-tcnative-boringssl-static:2.0.29.Final"
implementation "io.netty:netty-transport:$nettyVersion"
implementation "io.netty:netty-common:$nettyVersion"
implementation "io.netty:netty-handler:$nettyVersion" implementation "io.netty:netty-handler:$nettyVersion"
implementation "io.netty:netty-tcnative:2.0.30.Final:linux-x86_64@jar"
implementation "io.netty:netty-tcnative-boringssl-static:2.0.30.Final:linux-x86_64@jar"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "org.jetbrains.kotlin:kotlin-reflect" implementation "org.jetbrains.kotlin:kotlin-reflect"

View File

@@ -21,6 +21,7 @@ import io.grpc.netty.GrpcSslContexts
import io.netty.handler.ssl.ClientAuth import io.netty.handler.ssl.ClientAuth
import io.netty.handler.ssl.SslContext import io.netty.handler.ssl.SslContext
import io.netty.handler.ssl.SslContextBuilder import io.netty.handler.ssl.SslContextBuilder
import io.netty.handler.ssl.SslProvider
import org.apache.commons.lang3.StringUtils import org.apache.commons.lang3.StringUtils
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Autowired
@@ -61,6 +62,10 @@ class TlsSetup(
} }
if (mustBeSecure || (!tlsDisabled && hasServerCertificate)) { if (mustBeSecure || (!tlsDisabled && hasServerCertificate)) {
log.info("Using TLS for $category") log.info("Using TLS for $category")
if (SslContext.defaultServerProvider() == SslProvider.JDK) {
log.warn("Using JDK TLS implementation. Install OpenSSL to better performance")
}
val sslContextBuilder = if (grpc) { val sslContextBuilder = if (grpc) {
GrpcSslContexts.forServer( GrpcSslContexts.forServer(
fileResolver.resolve(config.certificate!!), fileResolver.resolve(config.certificate!!),

View File

@@ -19,6 +19,7 @@ package io.emeraldpay.dshackle
import io.emeraldpay.dshackle.config.AuthConfig import io.emeraldpay.dshackle.config.AuthConfig
import io.netty.handler.ssl.ClientAuth import io.netty.handler.ssl.ClientAuth
import io.netty.handler.ssl.OpenSslServerContext import io.netty.handler.ssl.OpenSslServerContext
import io.netty.handler.ssl.SslContext
import spock.lang.Specification import spock.lang.Specification
import sun.security.x509.X509CertImpl import sun.security.x509.X509CertImpl
@@ -73,8 +74,10 @@ class TlsSetupSpec extends Specification {
act != null act != null
act.server act.server
!act.client !act.client
// run test on OS with OpenSSL installed
with((OpenSslServerContext) act) { with((OpenSslServerContext) act) {
act.clientAuth == ClientAuth.REQUIRE clientAuth == ClientAuth.REQUIRE
with((X509CertImpl) keyCertChain[0]) { with((X509CertImpl) keyCertChain[0]) {
getIssuerDN().name == "CN=ca.myhost.dev, OU=Blockchain CA, O=My Company" getIssuerDN().name == "CN=ca.myhost.dev, OU=Blockchain CA, O=My Company"
} }