升级使用 golang 1.15.0-rc.1 的系统 (kubernetes) 后,我被困在此错误消息上:
"x509: certificate relies on legacy Common Name field, use SANs or temporarily enable Common Name matching with GODEBUG=x509ignoreCN=0".
Run Code Online (Sandbox Code Playgroud)
我使用通用名称(我知道的)的唯一地方是我为我的服务生成私钥时openssl req -new -key certs/foo-bar.pem -subj "/CN=foobar.mydomain.svc" -out certs/foo-bar.csr -config certs/foo-bar_config.txt。
如何将此命令转换为使用 SAN?
425*_*esp 10
你可能需要这个-addext标志。
例如:
openssl req -new -key certs/foo-bar.pem \
-subj "/CN=foobar.mydomain.svc" \
-addext "subjectAltName = DNS:foobar.mydomain.svc" \
-out certs/foo-bar.csr \
-config certs/foo-bar_config.txt
Run Code Online (Sandbox Code Playgroud)
从这里得到答案:https : //security.stackexchange.com/questions/74345/provide-subjectaltname-to-openssl-directly-on-the-command-line
解决方案
我完全解释了。
该解决方案适用于我。首先你必须有一个 CA,然后由 CA 签署你的服务器证书。我创建了一个 CA 和服务器证书,最后通过下面的命令签署服务器证书。(改变你想要的 -subj 和 CN)
在您的情况下,您应该在下面的最新命令行中签署服务器证书时传递 subjectAltName。
openssl genrsa -out ca.key 2048
openssl req -new -x509 -days 365 -key ca.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=Acme Root CA" -out ca.crt
openssl req -newkey rsa:2048 -nodes -keyout server.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=*.example.com" -out server.csr
openssl x509 -req -extfile <(printf "subjectAltName=DNS:example.com,DNS:www.example.com") -days 365 -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt
Run Code Online (Sandbox Code Playgroud)
运行此命令后,您可以在 kubernetes secret 中使用证书(server.crt,servert.key)作为入口。
| 归档时间: |
|
| 查看次数: |
14260 次 |
| 最近记录: |