我在 Debian 6 上运行的生产服务器出现问题(apt-get update;apt-get upgrade 成功完成)。
当我调用 HTTPS (StartSSL) 服务器时,我在 Debian 6 上收到一条错误消息:
#> curl --version
curl 7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
Protocols: dict file ftp ftps http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
#> curl https://mydomain.com/api/
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html
Run Code Online (Sandbox Code Playgroud)
但是当我在 Debian 7 上调用相同的地址时(服务器也是最新的),一切正常:
#> curl --version
curl 7.26.0 (x86_64-pc-linux-gnu) libcurl/7.26.0 OpenSSL/1.0.1e zlib/1.2.7 libidn/1.25 libssh2/1.4.2 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: Debug GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
#> curl https://mydomain.com/api/
{'code':'ko', 'message':'ERR_AUTH_BASIC_NEEDED'}
Run Code Online (Sandbox Code Playgroud)
您知道为什么 HTTPS 在 Curl Debian 6 上失败并适用于 Debian 7 curl 吗?
过时的不是 curl,而是系统使用的根 CA 证书包。有效证书可能会随着 CA 的启动、停业或其证书过期或被吊销或续订而随时间变化。
在Debian中,这些都是该ca-certificates包。对于squeeze,这似乎已经好几年没有更新了。只有喘息和更新似乎接近当前。发行版应该在发行版的整个支持生命周期内更新这些,但 Debian 似乎没有这样做。
您应该能够使用源包自行向后移植它(不要尝试使用二进制包;它们的依赖项也会更新,并且会出现损坏)。