Skip to content

Commit 1bd6638

Browse files
authored
infomaniak: fix subzone support (#1497)
1 parent 17f62b8 commit 1bd6638

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

docs/content/dns/zz_gen_infomaniak.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ More information [here](/lego/dns/#configuration-and-credentials).
5555

5656
Access token can be created at the url https://manager.infomaniak.com/v3/infomaniak-api.
5757
You will need domain scope.
58-
```
5958

6059

6160

providers/dns/infomaniak/infomaniak.go

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"errors"
66
"fmt"
77
"net/http"
8-
"strings"
98
"sync"
109
"time"
1110

@@ -113,11 +112,6 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
113112
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
114113
fqdn, value := dns01.GetRecord(domain, keyAuth)
115114

116-
authZone, err := getZone(fqdn)
117-
if err != nil {
118-
return fmt.Errorf("infomaniak: %w", err)
119-
}
120-
121115
ikDomain, err := d.client.GetDomainByName(domain)
122116
if err != nil {
123117
return fmt.Errorf("infomaniak: could not get domain %q: %w", domain, err)
@@ -128,7 +122,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
128122
d.domainIDsMu.Unlock()
129123

130124
record := internal.Record{
131-
Source: extractRecordName(fqdn, authZone),
125+
Source: extractRecordName(fqdn, ikDomain.CustomerName),
132126
Target: value,
133127
Type: "TXT",
134128
TTL: d.config.TTL,
@@ -190,19 +184,8 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
190184
return d.config.PropagationTimeout, d.config.PollingInterval
191185
}
192186

193-
func getZone(fqdn string) (string, error) {
194-
authZone, err := dns01.FindZoneByFqdn(fqdn)
195-
if err != nil {
196-
return "", err
197-
}
198-
199-
return dns01.UnFqdn(authZone), nil
200-
}
201-
202-
func extractRecordName(fqdn, zone string) string {
187+
func extractRecordName(fqdn, domain string) string {
203188
name := dns01.UnFqdn(fqdn)
204-
if idx := strings.Index(name, "."+zone); idx != -1 {
205-
return name[:idx]
206-
}
207-
return name
189+
190+
return name[:len(name)-len(domain)-1]
208191
}

providers/dns/infomaniak/infomaniak.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Additional = '''
1414
1515
Access token can be created at the url https://manager.infomaniak.com/v3/infomaniak-api.
1616
You will need domain scope.
17-
```
1817
'''
1918

2019
[Configuration]

0 commit comments

Comments
 (0)