我需要为多个域设置 https xxxx.com xxxx.net(使用单个通用证书)
我们购买证书的 CA 要求创建证书签名请求 (CSR),但是当我使用 openssl 生成它时 - 它只要求一个名称
如何为多个域制作一个 CSR?
最佳答案
避免使用具有多个 CN 的证书(如评论中所建议的),这不是规范(RFC 2818 和 RFC 6125)所说的它应该工作的方式,尽管它可能在某些客户端应用程序中工作,但通常会失败。来自 RFC 2818 :
If a subjectAltName extension of type dNSName is present, that MUST be used as the identity. Otherwise, the (most specific) Common Name field in the Subject field of the certificate MUST be used. Although the use of the Common Name is existing practice, it is deprecated and Certification Authorities are encouraged to use the dNSName instead.
相反,生成具有多个主题备用名称 (SAN) 的证书(或 CSR)。
如果您使用的是 OpenSSL,请编辑您的 openssl.cnf
(或编辑副本)并在相关部分([req]
和 [ v3_req ]
):
[req]
req_extensions = v3_req
[v3_req]
subjectAltName=DNS:www.example1.com,DNS:www.example2.com,DNS:www.example3.com
这里还有一个使用环境变量的好技巧(而不是在配置文件中修复它):http://www.crsr.net/Notes/SSL.html
您可能还希望在 CN 中拥有其中之一(任何)。
(您可能还对 this answer 感兴趣。)
关于ssl - 为多个域设置 httpS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8517183/