schemacs
V2EX  ›  科技

HTTPS 客户端证书 Web 服务器配置

  •  
  •   schemacs · Dec 5, 2015 · 4909 views
    This topic created in 3856 days ago, the information mentioned may be changed or developed.

    Android 手机访问 https://login.alibaba-inc.com/ 这个页面,会弹出如下请求是否安装证书的对话框,请问这个 Web 服务端怎么设置?参考 1参考 2

    http://i.imgur.com/cRhfDMZ.png

    http://i.imgur.com/VcIIr8d.png

    14 replies    2015-12-05 15:25:24 +08:00
    just1
        1
    just1  
       Dec 5, 2015 via Android
    可以啊
    schemacs
        2
    schemacs  
    OP
       Dec 5, 2015
    @just1 请教下如何配置 Web 服务器哈?
    just1
        3
    just1  
       Dec 5, 2015 via Android
    @schemacs uv,firefox 都可以正常访问, chrome 提示安装证书。 你要配置 Apache 还是 nginx ?
    schemacs
        4
    schemacs  
    OP
       Dec 5, 2015
    @just1 nginx 最好, apache 也行,多谢指教哈。
    just1
        5
    just1  
       Dec 5, 2015 via Android
    @schemacs 你的意思是要出现这个错误提示吗。。
    schemacs
        6
    schemacs  
    OP
       Dec 5, 2015
    @just1 不是哈。我想问怎么配置 Nginx ,让 Android 弹出安装的界面,即第二张图。
    lhbc
        7
    lhbc  
       Dec 5, 2015 via Android
    F12 看下网络请求和代码不就知道了,反正都是 http ,浏览器看得一清二楚。
    schemacs
        8
    schemacs  
    OP
       Dec 5, 2015
    @lhbc 嗯,好办法。我 curl 没看出什么异常,难道 android 上的 chrome 做了特殊处理。
    nbndco
        9
    nbndco  
       Dec 5, 2015
    一般配置文件里加上
    SSLCACertificatePath
    SSLCACertificateFile
    再设置
    SSLVerifyClient require
    验证客户端是不是有由指定 CA 签发的证书。

    具体设置要看你用 nginx 还是 apache 。
    应该不算是 HTTP 的一部分。
    schemacs
        10
    schemacs  
    OP
       Dec 5, 2015
    yeyeye
        11
    yeyeye  
       Dec 5, 2015
    是双向认证吧?请在搜索引擎搜索
    nginx 双向认证
    apache 双向认证
    schemacs
        12
    schemacs  
    OP
       Dec 5, 2015
    @yeyeye 嗯,已经找到了,谢谢。

    可以正常工作的配置如下

    ```
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;
    ssl_certificate /etc/letsencrypt/live/xxx.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/xxx.com/privkey.pem;

    ssl_verify_client on;
    ssl_verify_depth 2;
    ssl_client_certificate /etc/letsencrypt/live/your-ca.pem;
    ```
    schemacs
        13
    schemacs  
    OP
       Dec 5, 2015
    不过新问题是, Android 上的 Chrome 会提示安装客户端证书,但是 Mac 的 Chrome 上什么提示也没有啊,是不是实现不同?后者会查看这个 ca 是否在本机的信任 ca 列表里?

    直接 curl 显示:

    ```
    <html>
    <head><title>400 No required SSL certificate was sent</title></head>
    <body bgcolor="white">
    <center><h1>400 Bad Request</h1></center>
    <center>No required SSL certificate was sent</center>
    <hr><center>nginx</center>
    </body>
    </html>
    ```
    mudkip
        14
    mudkip  
       Dec 5, 2015
    ssl_verify_client / ssl_verify_depth / ssl_client_certificate 这些东西是验证客户端身份用的,除非你只限自己一个人访问,否则不要写。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1106 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 23:48 · PVG 07:48 · LAX 16:48 · JFK 19:48
    ♥ Do have faith in what you're doing.