certificate - 为什么 NET::ERR_CERT_COMMON_NAME_INVALID 在 admin.localhost 上出现 chrome 错误,SAN 和 CN 设置为 *.localhost
问题描述
我想创建一个 http/2 服务器,并将管理面板附加为子域。
我使用 CN=*.localhost 和 subjectAltName = *.localhost 和 localhost 创建了证书
# server.scr.cnf
[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
[dn]
CN = *.localhost
OU=Random
C=US
ST=RandomState
L=RandomCity
O=RandomOrganization
emailAddress=hello@example.com
# v3.ext
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = *.localhost
DNS.2 = localhost
然后我去了 chrome(在 stable (88.0.4324.146) 和 canary (90.0.4410.2) 版本上测试,没有差异)并看到了这些结果:
- https://localhost:7000 工作正常,没有错误。
- https://admin.localhost:7000不起作用,但我例外的是证书不会给出任何错误(服务器端没有错误,继续 admin.localhost:7000 会给出适当的页面) -
我尝试将 CN 更改为 localhost,尝试添加更多通配符,例如 *.*.localhost (等等),但这些都不起作用。
解决我看到的问题的唯一方法是将 admin.localhost 添加到 alt_names,但这对我来说是一个负担,因为需要将每个子添加到 alt_names,所以我不喜欢这个解决方案,我想了解为什么没有't *.localhost 工作。
解决方案
推荐阅读
- python - 绘制散点图图例不显示图例标题,但每种颜色都有 = 符号
- javascript - lottie-web 中的内存泄漏
- javascript - 如何将我的 BS-CS 和星星放在底部
- maven - maven 包含来自程序集的依赖项
- reactjs - 在 reactjs 中显示 PDF 文件
- angular - 在angular2 google-maps中的circleRedim之后无法获得圆半径
- android-room - 带有协程的房间数据库
- javascript - 在下一个连接中链接中间件失败并出现错误处理程序
- javascript - 解析excel文件(XLSX)时如何获取单元格的日期格式
- postgresql - Quarkus JPA Postgres 存储过程调用 - 使用 CALL 错误