ssl - 为多个域设置 httpS

标签 ssl https openssl csr

我需要为多个域设置 https xxxx.com xxxx.net(使用单个通用证书)

我们购买证书的 CA 要求创建证书签名请求 (CSR),但是当我使用 openssl 生成它时 - 它只要求一个名称

如何为多个域制作一个 CSR?

最佳答案

避免使用具有多个 CN 的证书(如评论中所建议的),这不是规范(RFC 2818RFC 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/

相关文章:

django - 带有 django 和 mod_wsgi 的基于 SSL 的虚拟主机

c - 如何使用 aes key 创建 .pem 文件

amazon-web-services - 为 AWS 负载均衡器启用 mod_ssl

php - 通过 HTTPS 从远程服务器复制图像

ssl - Glassfish 管理控制台在更改 keystore.jks 后停止

php - Apache 使用 https 全部重定向到 index.php

c - 手动 HMACSHA1 计算与 openssl 结果不同

c++ - OpenSSL:我使用存储在外部文件中的 RSA key 对文件进行加密和解密,但有时我的程序会崩溃

networking - 是否可以通过 telnet 执行 SSL 握手?

java - 如何在 ftp4j 库中使用 SSL