ssl - Dropwizard SSL 服务继续返回错误 - 服务器中止 SSL 握手

标签 ssl jetty dropwizard self-signed

当我尝试远程连接到我的服务器时,出现以下错误。

$ curl -k --verbose https://myserver.com:9010/test
* Adding handle: conn: 0x7f8bfb801a00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f8bfb801a00) send_pipe: 1, recv_pipe: 0
* About to connect() to myserver.com port 9010 (#0)
*   Trying <myserver ip>...
* Connected to myserver.com (myserver ip) port 9010 (#0)
* Server aborted the SSL handshake
* Closing connection 0
curl: (35) Server aborted the SSL handshake

但是,如果我从运行该服务的服务器中运行这个命令,连接就会成功完成。

我使用的是自签名证书。我在 codeproject.com 使用了指南创建我的证书。我的 Dropwizard server 配置是:-

server:
    requestLog:
        timeZone: UTC
        appenders:
        - type: file
          currentLogFilename: logs/requests.log
          archivedLogFilenamePattern: logs/requests-%d.log
          archivedFileCount: 3
          threshold: ALL
    applicationConnectors:
    - type: https
      port: 9010
      keyStorePath: myserver.keystore
      keyStorePassword: password
      certAlias: myserverAlias
      validateCerts: false
      trustStorePath: /etc/pki/java/cacerts
    adminConnectors:
    - type: https
      port: 9011
      keyStorePath: myserver.keystore
      keyStorePassword: password
      certAlias: myserverAlias
      validateCerts: false
      trustStorePath: /etc/pki/java/cacerts

我在日志中也没有看到任何错误。

其他详细信息

服务器内部的成功连接如下所示。

$  curl -k --verbose https://myserver.com:9010/test
*   Trying <myserver ip>...
* Connected to myserver.com (myserver ip) port 9010 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_DSS_WITH_AES_128_CBC_SHA
* Server certificate:
*   subject: CN=myserver.com,OU=TECH,O=AppleGrew,L=HYD,ST=TS,C=IN
*   start date: Apr 05 06:16:32 2015 GMT
*   expire date: Apr 04 06:16:32 2018 GMT
*   common name: myserver.com
*   issuer: CN=myserver.com,OU=TECH,O=AppleGrew,L=HYD,ST=TS,C=IN
> GET /test HTTP/1.1
> User-Agent: curl/7.40.0
> Host: myserver.com:9010
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Mon, 06 Apr 2015 06:01:23 GMT
< Content-Type: application/json
< Vary: Accept-Encoding
< Content-Length: 99
< 
* Connection #0 to host myserver.com left intact
{"status":"OK","message_type":"INFO","message_recipient":"SYSTEM","testMsg":"The service is live!"}

但是,运行服务器端和远程客户端的curl版本是不同的。

服务器端是:

curl 7.40.0 (x86_64-redhat-linux-gnu) libcurl/7.40.0 NSS/3.16.2 Basic ECC zlib/1.2.8 libidn/1.18 libssh2/1.4.2
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets

客户端是:

curl 7.30.0 (x86_64-apple-darwin13.0) libcurl/7.30.0 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz 

更新

我能够从远程 Linux 系统连接到服务器。该系统上的 curl 版本是:-

curl 7.19.7 (i686-pc-linux-gnu) libcurl/7.19.7 NSS/3.12.6.2 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp 
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

最佳答案

只是猜测,因为您的问题缺少必要的详细信息:

  • 您的客户端和服务器上的 curl 版本不同
  • 您的服务器设置会触发您的 curl 版本之间的任何差异,例如:
    • 在新版本中禁用了对 RC4 的支持
    • 在新版本中禁用了对 SSL 3.0 的支持
    • 没有密码重叠
    • ...

要获得更多帮助,您应该提供您正在使用的 curl 的版本和 SSL 堆栈 (curl -V)、服务器端设置以及调试输出 (curl -v >) 用于成功和不成功的连接。

  • Server aborted the SSL handshake

因此,您还应该查看服务器端的日志。甚至可能是防火墙阻止了连接,因此您可能会检查服务器是否完全连接。

关于ssl - Dropwizard SSL 服务继续返回错误 - 服务器中止 SSL 握手,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29462422/

相关文章:

java - 无法建立 WebSocket 连接 - Spark Java Framework

jersey - DropWizard Bootstrap vs 配置 vs 环境

log4j - Dropwizard 中默认记录到文件和控制台是否使用 AsyncAppender?

python - WordPress Api 请求错误 : [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl. c:700)

jetty - 开机时自动运行 Jetty

redirect - NGINX 将旧的 https 域重定向到新的非 https

java - Tomcat或Jetty是否支持 "java:comp/DefaultDataSource"

java - 第一个 Dropwizard 应用程序构建但不执行

ssl - X.509 证书验证过程

node.js - NodeJS supertest - 使用证书测试路由