美文网首页
java.net.SocketException: Connec

java.net.SocketException: Connec

作者: ArthurIsUsed | 来源:发表于2020-11-17 13:49 被阅读0次

    迁移服务器的过程中,遇到一个报错, 如下:

    严重: java.net.SocketException: Connection reset
    java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:168)
        at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:422)
        at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:460)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:863)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1188)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1215)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1199)
    

    开始一直以为是Nginx长短连接的问题,全都改成长连接依然如此。由此,便把注意到SSL,是否服务器升级了版本导致SSL的版本出问题呢?

    Google一篇文章,该小哥的报错跟这个一模一样,The server only supports SSLv3, and Java start at v2,可能是Windows Server 2012只支持V3。 Blog连接地址:https://www.it1352.com/213968.html

    按照教程准备禁用V3时,发现注册表并没有相关信息,注册表路径如下,regedit即可打开

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel\Protocols\SSL 3.0\Server]
    "Enabled"=dword:00000000
    

    无他,找工具测试Windows Server2012支持哪几个版本吧。
    nmap小工具即可,操作连接。一直下一步,最后启动nmap即可。命令如下:

    C:\Users\Administrator>nmap -p 36689 --script ssl-enum-ciphers 10.6.9.240
    Starting Nmap 7.91 ( https://nmap.org ) at 2020-11-17 11:14 
    Nmap scan report for 10.6.9.240
    Host is up (0.00s latency).
    
    PORT      STATE SERVICE
    36689/tcp open  unknown
    | ssl-enum-ciphers:
    |   TLSv1.0:
    |     ciphers:
    |       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
    |       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
    |       TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 1024) - A
    |       TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 1024) - A
    |       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
    |       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
    |       TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
    |       TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C
    |       TLS_RSA_WITH_RC4_128_MD5 (rsa 2048) - C
    |     compressors:
    |       NULL
    |     cipher preference: server
    |     warnings:
    |       64-bit block cipher 3DES vulnerable to SWEET32 attack
    |       Broken cipher RC4 is deprecated by RFC 7465
    |       Ciphersuite uses MD5 for message integrity
    |       Key exchange (dh 1024) of lower strength than certificate key
    |   TLSv1.1:
    |     ciphers:
    |       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
    |       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
    |       TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 1024) - A
    |       TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 1024) - A
    |       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
    |       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
    |       TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
    |       TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C
    |       TLS_RSA_WITH_RC4_128_MD5 (rsa 2048) - C
    |     compressors:
    |       NULL
    |     cipher preference: server
    |     warnings:
    |       64-bit block cipher 3DES vulnerable to SWEET32 attack
    |       Broken cipher RC4 is deprecated by RFC 7465
    |       Ciphersuite uses MD5 for message integrity
    |       Key exchange (dh 1024) of lower strength than certificate key
    |   TLSv1.2:
    |     ciphers:
    |       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (secp256r1) - A
    |       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (secp256r1) - A
    |       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
    |       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
    |       TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (dh 1024) - A
    |       TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (dh 1024) - A
    |       TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 1024) - A
    |       TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 1024) - A
    |       TLS_RSA_WITH_AES_256_GCM_SHA384 (rsa 2048) - A
    |       TLS_RSA_WITH_AES_128_GCM_SHA256 (rsa 2048) - A
    |       TLS_RSA_WITH_AES_256_CBC_SHA256 (rsa 2048) - A
    |       TLS_RSA_WITH_AES_128_CBC_SHA256 (rsa 2048) - A
    |       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
    |       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
    |       TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
    |       TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C
    |       TLS_RSA_WITH_RC4_128_MD5 (rsa 2048) - C
    |     compressors:
    |       NULL
    |     cipher preference: server
    |     warnings:
    |       64-bit block cipher 3DES vulnerable to SWEET32 attack
    |       Broken cipher RC4 is deprecated by RFC 7465
    |       Ciphersuite uses MD5 for message integrity
    |       Key exchange (dh 1024) of lower strength than certificate key
    |_  least strength: C
    
    Nmap done: 1 IP address (1 host up) scanned in 0.70 seconds
    

    以上结果说明只使用了TLSv1.0、TLSv1.1、TLSv1.2,V2与V3都未是用。
    去线上服务器做一个对比测试,线上只启用了TLSv1.0。 自闭ing~~~

    C:\Users\Administrator>nmap -p 3389 --script ssl-enum-ciphers 172.20.16.2
    Starting Nmap 7.91 ( https://nmap.org ) at 2020-11-17 11:26 ?
    Nmap scan report for 172.20.16.2
    Host is up (0.0010s latency).
    
    PORT     STATE SERVICE
    3389/tcp open  ms-wbt-server
    | ssl-enum-ciphers:
    |   TLSv1.0:
    |     ciphers:
    |       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
    |       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
    |       TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C
    |       TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C
    |       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
    |       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
    |       TLS_RSA_WITH_RC4_128_MD5 (rsa 2048) - C
    |     compressors:
    |       NULL
    |     cipher preference: server
    |     warnings:
    |       64-bit block cipher 3DES vulnerable to SWEET32 attack
    |       Broken cipher RC4 is deprecated by RFC 7465
    |       Ciphersuite uses MD5 for message integrity
    |       Weak certificate signature: SHA1
    |_  least strength: C
    
    Nmap done: 1 IP address (1 host up) scanned in 1.38 seconds
    

    在IE浏览器中禁用1.1、1.2,重启服务器,依旧报这个错,最后只能交给开发去查看了。

    默哀~~~

    相关文章

      网友评论

          本文标题:java.net.SocketException: Connec

          本文链接:https://www.haomeiwen.com/subject/cskxiktx.html