V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
hjxx
V2EX  ›  V2EX

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

  •  
  •   hjxx · 2015-10-03 12:17:27 +08:00 · 2642 次点击
    这是一个创建于 3153 天前的主题,其中的信息可能已经有所发展或是发生改变。
    [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
    7 条回复    2015-10-03 21:52:03 +08:00
    Slienc7
        1
    Slienc7  
       2015-10-03 13:22:45 +08:00
    应该是系统问题,直接不检查证书即可
    ryd994
        2
    ryd994  
       2015-10-03 14:21:21 +08:00
    什么版本的 curl ?
    用其他,比如 wget 能复现么?
    HTTPS CDN 一般需要客户端支持 SNI
    hjxx
        3
    hjxx  
    OP
       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
        4
    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
        5
    sparanoid  
    MOD
       2015-10-03 20:03:25 +08:00
    可能是你的 curl 版本过老,还不支持 SNI
    kn007
        6
    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
        7
    adrianzhang  
       2015-10-03 21:52:03 +08:00

    openssl s_client -connect v2ex.com -showcerts
    看看
    如果证书链没问题,那就是你的 OS 不支持 SNI 导致
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3161 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 11:12 · PVG 19:12 · LAX 04:12 · JFK 07:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.