1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Fixing OVH DKIM MODIFY (#1290)

* Treat DKIM as normal TXT record type

* Empty FieldType before to prevent API error for DKIM

* Unsplit DKIM TXT records before diffing the values
This commit is contained in:
Patrik Kernstock
2021-10-16 17:45:06 +01:00
committed by GitHub
parent e94487bd07
commit 0ff44913ae
2 changed files with 23 additions and 11 deletions

View File

@@ -130,6 +130,21 @@ func (c *ovhProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*models.C
models.PostProcessRecords(actual)
txtutil.SplitSingleLongTxt(dc.Records) // Autosplit long TXT records
// OVH handles DKIM keys differently, no matter if sent to API as TXT or DKIM record type. The OVH expects the DKIM
// string to be in one single string. That's why we'll need to un-split the DKIM TXT records. If not, dnscontrol
// will always detect a mismatch between the unsplitted string from API to the splitted one in dnscontrol.
for _, rc := range dc.Records {
if c.isDKIMRecord(rc) {
// When DKIM records are updated, OVH does special logic in their backend, most likely validating the string.
// Splitting the string causes the validation on the API backend to fail with error message:
// "FAILURE! Error 400: "Invalid subfield found in DKIM : \"v=DKIM1""
// Therefore, we merge the text string before we compare or send it to the API.
unsplittedTarget := strings.Join(rc.TxtStrings, "")
rc.SetTarget(unsplittedTarget)
rc.SetTargetTXTString(unsplittedTarget)
}
}
differ := diff.New(dc)
_, create, delete, modify, err := differ.IncrementalDiff(actual)
if err != nil {