【问题标题】:Disable TLSv1.0 in spring boot v 1.4.0 with embedded jetty v 9.2.13在带有嵌入式码头 v 9.2.13 的 Spring Boot v 1.4.0 中禁用 TLSv1.0
【发布时间】:2016-09-01 20:04:16
【问题描述】:

我想在 Spring Boot 版本 1.4.0.RELEASE 中禁用 TLSv1.0。我们正在使用带有 spring boot 的嵌入式 jetty 版本 9.2.13.v20150730。

我认为弹簧靴属性不可能做到这一点。我已尝试关注,但 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);
    }
}

【问题讨论】:

    标签: spring-boot


    【解决方案1】:

    我发现的一种方法是设置仅受 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 请求。

    【讨论】:

      猜你喜欢
      • 2016-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-13
      • 2017-09-14
      • 2019-05-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多