2016-07-29 2 views
1

JDK8을 사용하여 TLS를 테스트하기위한 테스트 코드 (HTTPS 아님)를 작성합니다. 테스트 코드를 실행하면, 나는 검사하고 다음과 같은 결과를 얻을 nmap이 도구를 사용변경 소스 코드없이 TLSv1을 어떻게 비활성화 할 수 있습니까?

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 수 있습니다,하지만 난 그것을 사용하지 않으려는.

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

내가 호출

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 

내 테스트 코드에 javax.net.ssl.SSLEngine 클래스의 "할까는, setEnabledProtocols"방법은 TLSv1.0 완벽하게 해제 할 수 있습니다. 변경 코드없이 TLSv1.0을 비활성화하는 방법이 있습니까? 예 : 구성 파일을 통해.
I는 다음과 같은 여러 가지 방법을 시도했지만 아무도 원하는 효과 :(
1 -Djdk.tls.client.protocols = TLSv1.1, TLSv1.2
-Ddeployment.security.TLSv1 = 2를 얻을 수 없다 거짓 여기

는 자바 버전 :

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) 

답변

1

당신은 서버를 작성하는 것으로 나타났습니다, 그리고 jdk.tls.client.protocols는 따라서 이름, 클라이언트에 적용되며 기본 JavaSE '배포'에서 약간 덜 분명이 브라우저 - 의미하지만, 또는 클라이언트의 하위 집합 인 WebStart

TLS (또는 HTTPS) 서버 프로토콜 전용 속성은 없지만 보안 속성 jdk.tls.disabledAlgorithms은 클라이언트와 서버 (및 모든 컨텍스트 유형)에 적용되며 연결된 페이지에 설명 된대로 JRE/lib/security/java.security에 설정할 수 있습니다. 너의 것을 추가하는 동안 기존 제한 (특히 SSLv3 제거, 8u31 이후)을 유지해야합니다.

+0

주의 할의 위험 부담,'-D' 것이다 *'jdk.tls에 대한하지 * 일 .disabledAlgorithms', 당신이 제안한대로'java.security' 파일에 들어가야합니다. – kubanczyk

0

답장을 보내 주셔서 감사합니다. JRE/lib/security/java.security을 수정하면 전체적으로 영향을 미칩니다.

내 해결책은 다음과 같습니다. JRE/lib/security/java.security을 새 파일에 복사하고 TLSv1을 jdk.tls.disabledAlgorithms에 추가하십시오.
다음과 같이 JVM을 시작합니다
자바 -Djava.security.properties=./java.security -jar xxxxx는 여기

JRE/lib/security/java.security에서 요약 한 것입니다

# 
# 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 
관련 문제