zoukankan      html  css  js  c++  java
  • 制作适用于chrome58版本之后的https证书

    Chrome58以后对https的证书认证较为严格,证书里必须带有正确的Common Name,也就是必须有DNS Name=ajax.googleapis.com, IP Address=127.0.0.1这样的信息,浏览器才认为真正安全。

    制作步骤

    (1)安装或者编译一个OpenSSL, 在bin目录里有OpenSSL可执行程序 (Linux, Windows, MacOX 都可以的)
    (2)修改openssl.cnf文件。

    在[ req ]一节下找到req_extensions = v3_req 取消注释(去掉#号)
    在[ v3_req ] 一节 增加 subjectAltName = @alt_names
    在[ v3_req ] 一节 的上方增加一节
    
    [ alt_names ]
    
    DNS.1 = ajax.googleapis.com
    
    DNS.2 = localhost
    
    IP.1 = 127.0.0.1
    
    IP.2 = 192.168.11.70
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    (3)输入制作证书命令

    //想知道这些命令的详细含义,可以在网上搜索资料“用OpenSSL生成Nginx证书”
    
    openssl genrsa -des3 -out googleapis.key 2048
    
    openssl req -new -sha256 -key googleapis.key -out googleapis.csr //这一步会填一些东西,随便填
    
    cp googleapis.key googleapis.key.old
    
    openssl rsa -in googleapis.key.old -out googleapis.key //从秘钥中移除密码
    
    openssl x509 -req -days 3650 -in googleapis.csr -signkey googleapis.key -out googleapis.cer -extensions v3_req -extfile C:/openssl_out/ssl/openssl.cnf    (linux:/usr/ssl/openssl.cnf)
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    (4)安装googleapis.cer到系统中(Windows的是双击,选择“受信任的根证书颁发机构”)
    (5)把googleapis.key和googleapis.cer的路径配置到nginx服务器里或者需要使用的地方

    验证结果

    查看证书 应该包含 基本约束,密钥约束和使用者可选名称这3项, 使用者可选名称里有DNS.1 = ajax.googleapis.com这样的内容,浏览器访问https://ajax.googleapis.com是绿色的锁,如下图:

    这里写图片描述

    转载于
    http://ccimage.cn/2017-11/sign-openssl-x509-certificate-fake-site-chome-58.html

  • 相关阅读:
    【转】Redis和Memcache对比及选择
    Ubuntu下php环境的搭建
    【HTML和CSS】总结
    【python】 The different between ' %r ' and ' %s '
    Learn Python The Hard Way
    Vim 插件配置及快捷键
    sublime-text 插件配置
    mysql-5.7在CentOS-7下的rpm安装
    oracle pdb基本管理
    Oracle 12cR2 Installation On CentOS-7
  • 原文地址:https://www.cnblogs.com/wangsongbai/p/13621592.html
Copyright © 2011-2022 走看看