1 回答
TA贡献1773条经验 获得超3个赞
您需要在源头解决问题并生成带有字段的证书 - 然后运行时检查将消失。DNSSANGo
这是可以实现的,但很棘手,因为它需要一个配置文件 - 因为SAN字段选项太宽泛,不适合简单的命令行选项。openssl
一般的要点是,创建一个企业社会责任:
openssl req -new \
-subj "${SUBJ_PREFIX}/CN=${DNS}/emailAddress=${EMAIL}" \
-key "${KEY}" \
-addext "subjectAltName = DNS:${DNS}" \
-out "${CSR}"
,然后用您的 :CSRroot CA
openssl ca \
-create_serial \
-cert "${ROOT_CRT}" \
-keyfile "${ROOT_KEY}" \
-days "${CERT_LIFETIME}" \
-in "${CSR}" \
-batch \
-config "${CA_CONF}" \
-out "${CRT}"
CA_CONF上面引用的内容如下所示:
[ ca ]
default_ca = my_ca
[ my_ca ]
dir = ./db
database = $dir/index.txt
serial = $dir/serial
new_certs_dir = $dir/tmp
x509_extensions = my_cert
name_opt = ca_default
cert_opt = ca_default
default_md = default
policy = policy_match
# 'copy_extensions' will copy over SAN ("X509v3 Subject Alternative Name") from CSR
copy_extensions = copy
[ my_cert ]
basicConstraints = CA:FALSE
nsComment = "generated by https://github.com/me/my-pki"
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
[ policy_match ]
# ensure CSR fields match that of delivered Cert
countryName = match
stateOrProvinceName = match
organizationName = match
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
正在检查生成的服务器证书:
openssl x509 -in server.crt -noout -text
然后应该有一个部分,如:SAN
X509v3 Subject Alternative Name:
DNS:myserver.com
添加回答
举报