
我想知道是否可以建立帶有前綴的通配符憑證。
我知道這*.example.com
將涵蓋第一級的任何內容(例如one.example.com
,,,等),但不會涵蓋,two.example.com
因為那是兩個級別。three-four.example.com
another.one.example.com
我需要一個可以識別前綴的通配符憑證;事情就是這樣www.*.example.com
。
這意味著 、www.one.example.com
、www.two.example.com
等都www.three.example.com
可以正常運作。
這可能嗎?
答案1
我需要一個可以識別前綴的通配符憑證;事情就是這樣
www.*.example.com
。這意味著 、www.one.example.com
、www.two.example.com
等都www.three.example.com
可以正常運作。
這可能嗎?
不可以。RFC2818和RFC6125只允許使用一個通配符,並且只能出現在最左邊的標籤。這意味著沒有www.*.example.com
也沒有*.*.example.com
。您需要在憑證的主題備用名稱部分中新增所需的所有網域,但您可以有多個條目,並且可以使用通配符,即*.sub1.example.com
等*.sub2.example.com
。
具有多個通配符名稱的此類憑證很常見(請查看 Facebook 的憑證),這表示有憑證提供者提供這些憑證。但他們的成本會比其他人高。
答案2
建立一個.cnf
如下所示的 -file,您可以將其與openssl req -new -out example.com.csr -key example.com.key -config example.com.cnf
.您可以使用建立密鑰文件
openssl genrsa -out example.com.key 4096
文件example.com.cnf
:
[req]
req_extensions = v3_req
distinguished_name = req_distinguished_name
[req_distinguished_name]
commonName = example.com
[v3_req]
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = example.com
DNS.2 = www.example.com
DNS.2 = *.example.com
答案3
也許您需要使用SubjectAltName。