Skip to content

Commit de756c8

Browse files
committed
tls/acme: Add support for DNS-01 domain delegation
See #588.
1 parent 6d5cd3b commit de756c8

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

docs/reference/tls-acme.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ smtp tcp://127.0.0.1:25 {
2020
You can also use a global `tls` directive to use automatically
2121
obtained certificates for all endpoints:
2222
```
23-
tls &local_tls
23+
tls {
24+
loader acme {
25+
26+
agreed
27+
challenge dns-01
28+
}
29+
}
2430
```
2531

2632
Currently the only supported challenge is dns-01 one therefore
@@ -87,6 +93,15 @@ back to the one configured via 'ca' option.
8793

8894
This avoids rate limit issues with production CA.
8995

96+
**Syntax:** override\_domain _domain_ <br>
97+
**Default:** not set
98+
99+
Override the domain to set the TXT record on for DNS-01 challenge.
100+
This is to delegate the challenge to a different domain.
101+
102+
See https://www.eff.org/deeplinks/2018/02/technical-deep-dive-securing-automation-acme-dns-challenge-validation
103+
for explanation why this might be useful.
104+
90105
**Syntax:** email _str_ <br>
91106
**Default:** not set
92107

internal/tls/acme/acme.go

+14-10
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,16 @@ func New(_, instName string, _, inlineArgs []string) (module.Module, error) {
3939

4040
func (l *Loader) Init(cfg *config.Map) error {
4141
var (
42-
hostname string
43-
extraNames []string
44-
storePath string
45-
caPath string
46-
testCAPath string
47-
email string
48-
agreed bool
49-
challenge string
50-
provider certmagic.ACMEDNSProvider
42+
hostname string
43+
extraNames []string
44+
storePath string
45+
caPath string
46+
testCAPath string
47+
email string
48+
agreed bool
49+
challenge string
50+
overrideDomain string
51+
provider certmagic.ACMEDNSProvider
5152
)
5253
cfg.Bool("debug", true, false, &l.log.Debug)
5354
cfg.String("hostname", true, true, "", &hostname)
@@ -60,6 +61,8 @@ func (l *Loader) Init(cfg *config.Map) error {
6061
certmagic.LetsEncryptStagingCA, &testCAPath)
6162
cfg.String("email", false, false,
6263
"", &email)
64+
cfg.String("override_domain", false, false,
65+
"", &overrideDomain)
6366
cfg.Bool("agreed", false, false, &agreed)
6467
cfg.Enum("challenge", false, true,
6568
[]string{"dns-01"}, "dns-01", &challenge)
@@ -107,7 +110,8 @@ func (l *Loader) Init(cfg *config.Map) error {
107110
return fmt.Errorf("tls.loader.acme: dns-01 challenge requires a configured DNS provider")
108111
}
109112
mngr.DNS01Solver = &certmagic.DNS01Solver{
110-
DNSProvider: provider,
113+
DNSProvider: provider,
114+
OverrideDomain: overrideDomain,
111115
}
112116
default:
113117
return fmt.Errorf("tls.loader.acme: challenge not supported")

0 commit comments

Comments
 (0)