使用下面的配置,颁发的证书适用于www.example.org
,而abc.example.org
.but不适用于www.abc.example.org
。
http:
routers:
web-router:
rule: "Host(`example.org`) ||
Host(`www.example.org`) ||
HostRegexp(`{subdomain:[a-z-]+}.example.org`) ||
HostRegexp(`www.{subdomain:[a-z-]+}.example.org`)"
entryPoints:
- web
middlewares:
- redirect
- csrf
service: django
web-secure-router:
rule: "Host(`example.org`) ||
Host(`www.example.org`) ||
HostRegexp(`{subdomain:[a-z-]+}.example.org`) ||
HostRegexp(`www.{subdomain:[a-z-]+}.example.org`)"
entryPoints:
- web-secure
middlewares:
- csrf
service: django
tls:
certResolver: letsencrypt
domains:
- main: "*.example.org"
sans:
- "example.org"
certificatesResolvers:
letsencrypt:
acme:
email: "email@example.com"
storage: /etc/traefik/acme/acme.json
dnsChallenge:
provider: route53
delayBeforeCheck: 0
在DNS中,我有example.org
和*.example.org
的A
记录。
是否有可能同时获得适用于www.*.example.org
和*.example.org
的证书?
发布于 2021-11-03 04:28:08
LetsEncrypt不支持嵌套的通配符。您可以为*.example.org
或*.sub.example.org
获取证书,但*.example.org
在*
的定义中不包括.
。
此外,DNS本身不支持嵌套或嵌入的通配符。
如果您为www.*.example.com
创建一条记录,然后查询类似www.foo.example.com
的内容,就可以看到这一点。您将得到一个NXDOMAIN响应。如果您查询www.\*.example.com
(或将FQDN括在单引号中以避免外壳扩展),那么您将获得您创建的A记录。当星号不在记录的开头时,它会变成文字字符。
➤ host www.sub.productionwebsite.com 8.8.8.8
Using domain server:
Name: 8.8.8.8
Address: 8.8.8.8#53
Aliases:
Host www.sub.productionwebsite.com not found: 3(NXDOMAIN)
~
➤ host 'www.*.productionwebsite.com' 8.8.8.8
Using domain server:
Name: 8.8.8.8
Address: 8.8.8.8#53
Aliases:
www.*.productionwebsite.com has address 10.68.0.73
https://stackoverflow.com/questions/69729206
复制相似问题