当前位置: 首页 > 知识库问答 >
问题:

如何在不更改源代码的情况下禁用TLSv1?

古棋
2023-03-14

我编写了一个测试代码(不是HTTPS)来使用JDK8测试TLS。当测试代码运行时,我使用nmap工具进行扫描,得到如下结果:

D:\softwares\nmap-7.12>nmap -p xxxx --script=ssl* x.x.x.x --unprivileged


Starting Nmap 7.12 ( https://nmap.org ) at 2016-07-26 15:33 °?′óà????÷2?±ê×?ê±??
Nmap scan report for x.x.x.x
Host is up (1.0s latency).
PORT     STATE  SERVICE
xxxx/tcp open unknown
| ssl-enum-ciphers:
|  TLSv1.0:
|    ciphers:
|      TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) -A
|    compressors:
|      NULL
|    cipher preference: indeterminate
|    cipher preference error: Too few ciphers supported
|  TLSv1.1:
|    ciphers:
|      TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) -A
|    compressors:
|      NULL
|    cipher preference: indeterminate
|    cipher preference error: Too few ciphers supported
|  TLSv1.2:
|    ciphers:
|      TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) -A
|    compressors:
|      NULL
|    cipher preference: indeterminate
|    cipher preference error: Too few ciphers supported
|_ least strength: A
MAC Address: xx:xx:xx:xx:xx:xx


Nmap done: 1 IP address (1 host up) scanned in 3.88 seconds


D:\softwares\nmap-7.12>

JDK8默认启用TLSv1.0,但我想禁用它。

Protocols
The SunJSSE provider supports the following protocol parameters:
Protocol    Enabled by Default for Client   Enabled by Default for Server
SSLv3       No(Unavailable Footnote 2)      No(Unavailable Footnote 2)
TLSv1       Yes                             Yes
TLSv1.1     Yes                             Yes
TLSv1.2     Yes                             Yes

https://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html#SunJSSE_Protocols

我调用javax的“setEnabledProtocols”方法。网ssl。我的测试代码TLSv1上的SSLEngine类。可以完全禁用0。有没有办法禁用TLSv1。0没有更改代码?例如,通过配置文件
我尝试了以下几种方法,但没有人能达到预期效果:(
1.-Djdk.tls.client.protocols=TLSv1.1,TLSv1.2
2.-Ddeployment.security.TLSv1=false

这里是java版本:

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

共有2个答案

燕璞
2023-03-14

首先感谢您的回复。如果修改JRE/lib/security/java。安全性,将产生全球影响。

这是我的解决方案:复制JRE/lib/security/java。安全性添加到新文件,并将TLSv1添加jdk。tls。禁用所有算法
然后,像这样启动JVM:
java-Djava。安全属性=/JAVA安全性-jar xxxxx

以下是来自JRE/lib/security/java的摘要。安全性

#
# This is the "master security properties file".
#
# An alternate java.security properties file may be specified
# from the command line via the system property
#
#    -Djava.security.properties=<URL>
#
# This properties file appends to the master security properties file.
# If both properties files specify values for the same key, the value
# from the command-line properties file is selected, as it is the last
# one loaded.
#
# Also, if you specify
#
#    -Djava.security.properties==<URL> (2 equals),
#

#
# Determines whether this properties file can be appended to
# or overridden on the command line via -Djava.security.properties
#
security.overridePropertiesFile=true
逄征
2023-03-14

您似乎正在编写一个服务器,jdk。tls。客户协议适用于客户端,因此得名;虽然不太明显,但在基本JavaSE中,“部署”是指浏览器或WebStart,它是客户端的一个子集。

没有专门针对TLS(或HTTPS)服务器协议的属性,但是安全属性jdk.tls.disabled算法适用于客户端和服务器(以及所有上下文类型),并且可以在JRE/lib/Security/<--plhd--中设置1/>如您链接的页面中所述。在添加您的限制时,请务必保留现有的限制(特别是删除SSLv3,因为8u31)。

 类似资料:
  • 问题内容: 我尝试的第一件事是创建一个静态库,但后来我发现尚不支持该库。Apple Xcode Beta 4发行说明: Xcode不支持构建包含Swift代码的静态库。(17181019) 我希望Apple能够在下一个Beta版本或GA版本中添加它,但我在他们的博客上阅读了以下内容: 在确保应用程序的运行时兼容性的同时,Swift语言本身将继续发展,并且二进制接口也将发生变化。为了安全起见,应使用

  • 我有一堆CSV文件,它们是作为数据流读取的。对于每个dataframe,我希望更改一些列名,如果某个dataframe中存在特定列: column_name_update_map={'aa':'xx';'bb':'yy'}

  • 问题内容: 我正在尝试使用seaborn,因为它具有distplot功能。但是我更喜欢默认的matplotlib设置。导入seaborn时,它会自动更改图形的外观。 如何在不改变地块外观的情况下使用seaborn函数? 问题答案: 0.8版(2017年7月)更改了此行为。来自https://seaborn.pydata.org/whatsnew.html#v0-8-0-july-2017: 导入s

  • 我正在尝试从组件更新(添加,删除)查询参数。在angularJS中,由于: 我有一个应用程序,其中包含用户可以过滤,排序等列表,我想在url的查询参数中设置所有激活的过滤器,以便他可以复制/粘贴URL或与其他人共享。

  • 问题内容: 我想在字体为时使用光标。 那可能吗? 问题答案: 您可以定制一个。

  • 我试图将文本字段“Colorbox0”的背景色更改为“Value0”,但它去掉了边框。 以下是我代码的简化版本: 非常感谢您的帮助 谢谢

  • 我是UI自动测试的新手,当只有.apk文件时,我无法弄清楚如何设置UI测试。 在线教程和其他示例没有显示如何使用我的3P. apk文件。我知道在Appium中,只需将文件/目录和名称添加到所需的功能,服务器就会安装它。

  • 我有一个带有视频播放器窗口的react js应用程序。我有一个管理面板,可以更改显示的视频的url。 我想当管理员改变显示的视频时,显示的视频在用户的另一边,改变而不刷新页面。 我怎么能那样做?