forked from TrueCloudLab/lego
stackpath: fix subdomain support. (#1204)
This commit is contained in:
parent
f3ca2c668b
commit
deb0ffc5d9
1 changed files with 11 additions and 4 deletions
|
@ -119,10 +119,9 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
fqdn, value := dns01.GetRecord(domain, keyAuth)
|
fqdn, value := dns01.GetRecord(domain, keyAuth)
|
||||||
parts := strings.Split(fqdn, ".")
|
|
||||||
|
|
||||||
record := Record{
|
record := Record{
|
||||||
Name: parts[0],
|
Name: extractRecordName(fqdn, zone.Domain),
|
||||||
Type: "TXT",
|
Type: "TXT",
|
||||||
TTL: d.config.TTL,
|
TTL: d.config.TTL,
|
||||||
Data: value,
|
Data: value,
|
||||||
|
@ -139,9 +138,9 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
fqdn, _ := dns01.GetRecord(domain, keyAuth)
|
fqdn, _ := dns01.GetRecord(domain, keyAuth)
|
||||||
parts := strings.Split(fqdn, ".")
|
recordName := extractRecordName(fqdn, zone.Domain)
|
||||||
|
|
||||||
records, err := d.getZoneRecords(parts[0], zone)
|
records, err := d.getZoneRecords(recordName, zone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -161,3 +160,11 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||||
func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
|
func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
|
||||||
return d.config.PropagationTimeout, d.config.PollingInterval
|
return d.config.PropagationTimeout, d.config.PollingInterval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func extractRecordName(fqdn, zone string) string {
|
||||||
|
name := dns01.UnFqdn(fqdn)
|
||||||
|
if idx := strings.Index(name, "."+zone); idx != -1 {
|
||||||
|
return name[:idx]
|
||||||
|
}
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue