我想在 spring boot 版本 1.4.0.RELEASE 中禁用 TLSv1.0。我们使用带有 spring boot 的嵌入式码头版本 9.2.13.v20150730。
我认为 spring boot 属性不可能做到这一点。我尝试了以下操作,但 TLSv1 仍处于启用状态。
server.ssl.protocol TLS
server.ssl.enabled-protocols TLSv1.1,TLSv1.2
所以我检查了spring boot自动配置代码。以下是 Jetty 的 SSLContext 是如何初始化的
没有从以下 configureSsl 方法调用 factory.setExcludeProtocols 方法。尽管 SslContextFactory 中有 setExcludeProtocols 方法。
能否在 spring boot 中添加 server.ssl.disabled-protocols 属性?或者如果这已经可以禁用 TLSv1.0,请告诉我。
/**
* Configure the SSL connection.
* @param factory the Jetty {@link SslContextFactory}.
* @param ssl the ssl details.
*/
protected void configureSsl(SslContextFactory factory, Ssl ssl) {
factory.setProtocol(ssl.getProtocol());
configureSslClientAuth(factory, ssl);
configureSslPasswords(factory, ssl);
factory.setCertAlias(ssl.getKeyAlias());
if (!ObjectUtils.isEmpty(ssl.getCiphers())) {
factory.setIncludeCipherSuites(ssl.getCiphers());
factory.setExcludeCipherSuites();
}
if (ssl.getEnabledProtocols() != null) {
factory.setIncludeProtocols(ssl.getEnabledProtocols());
}
if (getSslStoreProvider() != null) {
try {
factory.setKeyStore(getSslStoreProvider().getKeyStore());
factory.setTrustStore(getSslStoreProvider().getTrustStore());
}
catch (Exception ex) {
throw new IllegalStateException("Unable to set SSL store", ex);
}
}
else {
configureSslKeyStore(factory, ssl);
configureSslTrustStore(factory, ssl);
}
}
最佳答案
我发现的一种方法是设置仅受 TLSv1.2 支持的密码。 前任: 如果你将放入 application.yml
server.ssl.ciphers:TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
和使用 CURL
openssl s_client -connect example.com:443 -tls1
您会看到该请求将被忽略/拒绝,因为您在 application.yml 中设置的密码将仅验证 TLSv1.2 请求。
关于spring-boot - 在带有嵌入式码头 v 9.2.13 的 spring boot v 1.4.0 中禁用 TLSv1.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39280025/