sce*_*ler 6 java ssl jdbc sql-server-2012 sql-server-2014
我正在为 Microsoft SQL Server 2012 和 2014 使用 Progress DataDirect (glorious...) JDBC 驱动程序。两台服务器都是完全更新的窗口以及 SQL 服务器。两者都强制加密。
我现在正尝试使用符合 FIPS 的信任存储和适当的 java.security 文件、jar、无限强度密码套件,通过我的 java 客户端应用程序连接到它们。信任存储包含我自己的 CA 的自签名证书。使用的算法是RSA。
使用 JDK 1.7.0_21 它可以完美运行,但是当我更改为 1.8.0_74(最近的 afaik)时它失败了,因为 SQL 服务器不想在 ClientHello 之后回复。之后它只是通过连接重置断开连接。
此外,我尝试以不同的组合独立地设置这些属性,但对 JDK 1.8 没有任何效果。
JDBC 连接属性也是开/关,不同的组合:
我尝试了 TLS 1.2、1.1 和 1,但没有任何效果。
由于它适用于 JDK 1.7,我倾向于认为 JDK 1.8 破坏了这种机制。
JDK 1.8 的调试日志包含这个与 JDK 1.7 完全不同的日志条目
1.8:
Ignoring unavailable cipher suite: TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
Ignoring unavailable cipher suite: TLS_RSA_WITH_AES_128_GCM_SHA256
Ignoring unavailable cipher suite: TLS_RSA_WITH_AES_256_GCM_SHA384
Ignoring unavailable cipher suite: TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
Ignoring unavailable cipher suite: TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
Ignoring unavailable cipher suite: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
Run Code Online (Sandbox Code Playgroud)
1.7
Ignoring unavailable cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256
Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
Ignoring unavailable cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
Ignoring unavailable cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA
Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
Ignoring unavailable cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA
Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_128_CBC_SHA256
Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
Run Code Online (Sandbox Code Playgroud)
我还能尝试什么来解决这个问题?不幸的是,切换回 1.7 对我来说不是一个选项,也不是可能的。
编辑:
这是 -Djavax.net.debug=all 的最后一部分:
*** ClientHello, TLSv1.2
RandomCookie: GMT: 1440778452 bytes = { 133, 30, 185, 72, 50, 27, 253, 188, 73, 244, 59, 197, 169, 24, 142, 134, 78, 66, 122, 216, 60, 62, 232, 121, 107, 245, 32, 53 }
Session ID: {}
Cipher Suites: [TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
Compression Methods: { 0 }
Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA224withECDSA, SHA224withRSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA, MD5withRSA
Extension server_name, server_name: [type=host_name (0), value=my.sqlserver.com]
***
[write] MD5 and SHA1 hashes: len = 130
<HEX DUMP>
main, WRITE: TLSv1.2 Handshake, length = 130
[Raw write]: length = 135
<HEX DUMP>
Run Code Online (Sandbox Code Playgroud)
调用代码是这样的:
Connection connection = DriverManager.getConnection(url, getProps());
private static Properties getProps()
{
Properties properties = new Properties();
properties.setProperty("User", "sa");
properties.setProperty("Password", "password");
properties.setProperty("EncryptionMethod", "SSL");
properties.setProperty("HostNameInCertificate", "my.sqlserver.com");
properties.setProperty("TrustStore", "<Path to trust store");
properties.setProperty("TrustStorePassword", "password");
properties.setProperty("ValidateServerCertificate", "true");
properties.setProperty("CryptoProtocolVersion", "TLSv1.2");
return properties;
}
Run Code Online (Sandbox Code Playgroud)
对我来说,升级到 JDK8(更新 191)在其更严格的允许 (TLS) 加密算法策略上失败。我只是3DES_EDE_CBC
通过修改我的${jdk.home}/jre/lib/security/java.security
文件再次启用:
jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, DH keySize < 1024, \
EC keySize < 224, 3DES_EDE_CBC
Run Code Online (Sandbox Code Playgroud)
到:
jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 768, \
EC keySize < 224
Run Code Online (Sandbox Code Playgroud)
或以编程方式:
java.security.Security.setProperty("jdk.tls.disabledAlgorithms",
"SSLv3, RC4, MD5withRSA, DH keySize < 768, EC keySize < 224");
Run Code Online (Sandbox Code Playgroud)
或在春天:
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="java.security.Security" />
<property name="targetMethod" value="setProperty" />
<property name="arguments">
<list>
<value>jdk.tls.disabledAlgorithms</value>
<value>SSLv3, RC4, MD5withRSA, DH keySize < 1024, EC keySize < 224</value>
</list>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
另请参阅与 SSLv3 相关的此答案
归档时间: |
|
查看次数: |
5634 次 |
最近记录: |