1

在我的 ubuntu 14.04 LTS-server SSLv2 和 SSLv3 被禁用。我在服务器上运行不同的应用程序。一个应用程序需要使用 curl 来连接托管在同一台机器上的另一个应用程序。

问题是,该连接在我的 ubuntu 14.04 TLS-KDE 客户端上有效,但在我的服务器本身上无效。

在服务器和客户端上,相同的 curl 和 openssl 版本都在运行:

$ curl --version
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

$ openssl version
OpenSSL 1.0.1f 6 Jan 2014

在我得到的客户端上

$ sudo curl -X HEAD -D - https://server.foobar.net:443/owncloud/remote.php/carddav/addressbooks/foobar/kontakte/
HTTP/1.1 401 Unauthorized
Date: Wed, 09 Sep 2015 04:46:55 GMT
Server: Apache
Set-Cookie: oc6c79ce288a=hcv4snboaf31v9a4nnse5g8ts3; path=/owncloud; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: Sameorigin
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src *; img-src *; font-src 'self' data:; media-src *; connect-src *
X-Robots-Tag: none
WWW-Authenticate: Basic realm="ownCloud"
Content-Type: application/xml; charset=utf-8

在我得到的服务器上

$ sudo curl -X HEAD -D - https://server.foobar.net:443/owncloud/remote.php/carddav/addressbooks/foobar/kontakte/
curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

请指出正确的方向。

4

2 回答 2

0

我通过https://www.ssllabs.com/ssltest/检查了服务器,ist 说证书有效并且服务器支持 TLS 1.2、1.1 和 1.0。

您也可以尝试在 curl-request 中添加 --no-check-certificate。

我还尝试了 curl 的 -k 选项(我认为 --no-check-certificate 不能与 curl 一起使用,但与 wget 一起使用),结果相同。在 apache 日志中我什么也看不到;我认为是因为连接试图通过 SSL 进入。

我得到openssl s_client -debug server.foobar.net:443/owncloud/remote.php/carddav/addressbooks/foobar/kontakte/了这个:

140093535233696:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 295 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE

编辑:现在我明白了!在我的服务器的 /etc/hosts 中有错误的配置。

于 2015-09-18T11:44:34.927 回答
0

如果客户端不支持 TLS 1.2,就会发生这种情况。您可以使用 TLS 1.1 和 TLS 1.0 作为后备选项。要检查您的 SSL 配置是否有效,请使用 SSL Labs ( https://www.ssllabs.com/ssltest/ )。这可以帮助找到任何错误的配置。

您也可以尝试--no-check-certificate在 curl-request 中添加。

在另一篇文章中,您可以阅读以下内容:

一个简单的测试是使用 wget(或浏览器)请求 http://example.com:443(注意 http://,不是 https://);如果有效,则 SSL 未在端口 443 上启用。要进一步调试,请使用带有 -debug 选项的 openssl s_client,在错误消息转储 OpenSSL 无法解析的服务器响应的前几个字节之前。这可能有助于识别问题,特别是如果服务器没有使用 ServerHello 消息进行应答。要查看 OpenSSL 的确切预期,请查看源代码:在 ssl/s23_clnt.c 中查找 SSL_R_UNKNOWN_PROTOCOL。

无论如何,查看 apache 错误日志也可以提供一些见解。

希望这可以帮助。

于 2015-09-14T12:54:40.107 回答