如何获得Traefik的dnsChallange的"www.*.example.org"证书?



使用下面的配置,颁发的证书适用于www.example.orgabc.example.org,但不适用于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.orgA记录。

是否有可能同时获得适用于www.*.example.org*.example.org的证书?

LetsEncrypt不嵌套通配符。您可以获得*.example.org*.sub.example.org的证书,但*.example.org*的定义中不包括.

此外,DNS本身不支持嵌套或嵌入通配符。

如果您创建www.*.example.com的记录,然后查询www.foo.example.com之类的内容,您可以看到这一点。您将得到一个NXDOMAIN响应。如果您查询www.*.example.com(或将FQDN包装在单引号中以避免shell展开),那么您将获得您创建的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

相关内容

最新更新