<分区>
如何为多域生成 CSR。
我发现为单个域生成 CSR 如下:
openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr
但是我如何生成 CSR 多域
<分区>
如何为多域生成 CSR。
我发现为单个域生成 CSR 如下:
openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr
但是我如何生成 CSR 多域
最佳答案
对于支持多个域的 X.509 证书,它必须使用多个主题备用名称 DNS 条目,根据 RFC 2818 (HTTP over TLS) (或 RFC 6125):
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.
Matching is performed using the matching rules specified by [RFC2459]. If more than one identity of a given type is present in the certificate (e.g., more than one dNSName name, a match in any one of the set is considered acceptable.)
如 this document 中所述(除了我也会对 genrsa
命令使用 -des3
来保护私钥):
openssl.cnf
文件(原始文件可能位于 Linux 上的 /etc
下)。[ req ]
部分添加 req_extensions = v3_req
。subjectAltName=DNS:www.example.com,DNS:www.other-example.com
(一个 DNS:
您需要的主机名条目) 在 [ v3_req ]
部分。OPENSSL_CONF=/path/to/your/openssl.cnf openssl req ...
话虽这么说,但我不会太担心在 CSR 中设置任何扩展名。任何好的 CA 都应该忽略您在 CSR 中设置的任何内容,并且只设置他们在颁发实际证书时实际验证过的内容。他们会很乐意替换您的主题 DN 中的任何 RDN(例如国家/地区、组织...)以及任何扩展名(SAN 或 key 用法)。首先,如果他们允许申请人在 CSR 中要求的任何延期,这将是一个安全风险,因为一些申请人真的可以得到任何东西。其次,这就是他们赚取额外收入的方式,通过向您收取一些设置费用(例如代码签名扩展):他们将确保您只得到您在证书中支付的费用。不过,我知道您可能希望将您请求的所有名称都放在您的 CSR 中,以确保万无一失。
关于apache - 为多域生成 CSR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9158245/