curl V2EX 的 ssl 站点 会报证书不匹配

2015-10-03 12:17:27 +08:00
 hjxx
[root@c www]# curl https://v2ex.com
curl: (51) SSL: certificate subject name '*.c3edge.com' does not match target host name 'v2ex.com'

从美国的一台vps 访问会报这个错误;
国内的树莓派上访问正常
@livid
2649 次点击
所在节点    V2EX
7 条回复
Slienc7
2015-10-03 13:22:45 +08:00
应该是系统问题,直接不检查证书即可
ryd994
2015-10-03 14:21:21 +08:00
什么版本的 curl ?
用其他,比如 wget 能复现么?
HTTPS CDN 一般需要客户端支持 SNI
hjxx
2015-10-03 15:12:27 +08:00
@ryd994
[root@c ~]# curl -V
curl 7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz



[root@c ~]# wget https://v2ex.com
--2015-10-03 03:13:13-- https://v2ex.com/
Resolving v2ex.com... 23.251.125.131, 23.251.126.133
Connecting to v2ex.com|23.251.125.131|:443... connected.
ERROR: certificate common name `*.c3edge.com' doesn't match requested host name `v2ex.com'.
To connect to v2ex.com insecurely, use `--no-check-certificate'.
Unable to establish SSL connection.
xfspace
2015-10-03 18:12:23 +08:00
你的系统问题。
美帝 Debian 7
root@GF-f:~# wget https://v2ex.com
--2015-10-03 18:10:28-- https://v2ex.com/
Resolving v2ex.com (v2ex.com)... 23.251.125.131, 23.251.126.133
Connecting to v2ex.com (v2ex.com)|23.251.125.131|:443... connected.
HTTP request sent, awaiting response... 502 Bad Gateway
2015-10-03 18:10:31 ERROR 502: Bad Gateway.
---
阿里云 Debian 7
root@GF-Aliyun:~# wget https://v2ex.com
--2015-10-03 18:11:40-- https://v2ex.com/
Resolving v2ex.com (v2ex.com)... 117.34.96.85, 59.173.16.210, 183.60.90.83, ...
Connecting to v2ex.com (v2ex.com)|117.34.96.85|:443... connected.
HTTP request sent, awaiting response... 502 Bad Gateway
2015-10-03 18:11:40 ERROR 502: Bad Gateway.
sparanoid
2015-10-03 20:03:25 +08:00
可能是你的 curl 版本过老,还不支持 SNI
kn007
2015-10-03 20:07:18 +08:00
表示无此问题
Centos 6.7

root@kn007:~
> curl --version
curl 7.43.0 (x86_64-unknown-linux-gnu) libcurl/7.43.0 OpenSSL/1.0.1e zlib/1.2.8 libidn/1.18
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: IDN Largefile NTLM NTLM_WB SSL libz UnixSockets
adrianzhang
2015-10-03 21:52:03 +08:00

openssl s_client -connect v2ex.com -showcerts
看看
如果证书链没问题,那就是你的 OS 不支持 SNI 导致

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/225369

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX