我正在尝试生成一个自签名SSL证书来保护example.com和*.example.com 。 看这个和这个问题的答案,似乎有同样数量的人同意和不同意这是否可以完成。 然而,authentication机构的网站似乎暗示可以这样做。
目前,这些是添加到我的opensslconfiguration文件中的更改:
[req] req_extensions = v3_req [req_distinguished_name] commonName = example.com [v3_req] subjectAltName = @alt_names [alt_names] DNS.1 = example.com DNS.2 = *.example.com
我尝试了上面的configuration并生成了一个证书。 导航到https://example.com ,会产生通常的警告:证书是“自签名的”。 接受后,我导航到https://abc.example.com并产生一个额外的警告,说这个证书只对example.com有效。
证书详细信息只在证书层次结构中列出example.com ,没有任何通配符子域存在的迹象。
我不确定这是由于configuration错误引起的,还是普通名称应该有通配符,或者这是不能做到的。
进一步更新:
这是通过使用openssl查看证书请求所得到的结果:
# openssl req -text -noout -in eg.csr Certificate Request: Data: Version: 0 (0x0) Subject: C=xx, L=Location, O=Example Pte Ltd, CN=example.com/[email protected] Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (1024 bit) Modulus: 00:c1:c7:0d:7e:b7:48:d3:b8:9a:5a:88:db:c2:91: ... Exponent: 65537 (0x10001) Attributes: Requested Extensions: X509v3 Basic Constraints: CA:FALSE X509v3 Key Usage: Digital Signature, Non Repudiation, Key Encipherment X509v3 Subject Alternative Name: DNS:example.com, DNS:*.example.com Signature Algorithm: sha1WithRSAEncryption 4d:4a:8a:d9:32:e2:31:c5:6c:8c:6a:2a:a6:c3:17:63:dd:a4: ...
这是我通过查看证书得到的:
# openssl x509 -in eg.crt -noout -text Certificate: Data: Version: 1 (0x0) Serial Number: d0:9e:b3:d5:83:b5:a1:0d Signature Algorithm: sha1WithRSAEncryption Issuer: C=xx, L=Location, O=Example Pte Ltd, CN=example.com/[email protected] Validity Not Before: Sep 30 10:16:34 2012 GMT Not After : Sep 30 10:16:34 2013 GMT Subject: C=xx, L=Location, O=Example Pte Ltd, CN=example.com/[email protected] Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (1024 bit) Modulus: 00:c1:c7:0d:7e:b7:48:d3:b8:9a:5a:88:db:c2:91: ... Exponent: 65537 (0x10001) Signature Algorithm: sha1WithRSAEncryption 3d:98:0d:f1:1b:06:27:63:09:14:4d:41:37:49:eb:70:15:1c: ...
当通过浏览器查看时,证书字段应该包含主题替代名称的扩展名。 但它不在那里。 如果确实可以实现的话,我认为在生成证书时可能会出现一些问题。
是的,它工作得很好。 您通常会将通配符看作通配符作为证书的主体,由公共证书颁发机构颁发,并将基本域作为主题备用名称,但我相信相反的安排也适用。
看看你已经生成的证书 – alt_names是否正确地合并到证书中?