Skip to content

Commit

Permalink
RFC2136 Set zone to root if no set
Browse files Browse the repository at this point in the history
  • Loading branch information
CRASH-Tech committed Oct 16, 2023
1 parent 98e9716 commit 714078d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion provider/rfc2136/rfc2136.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ func NewRfc2136Provider(host string, port int, zoneNames []string, insecure bool
return nil, errors.Errorf("%s is not supported TSIG algorithm", secretAlg)
}

// Set zone to root if no set
if len(zoneNames) == 0 {
zoneNames = append(zoneNames, ".")
}

// Sort zones
sort.Slice(zoneNames, func(i, j int) bool {
return len(strings.Split(zoneNames[i], ".")) > len(strings.Split(zoneNames[j], "."))
Expand Down Expand Up @@ -456,7 +461,7 @@ func findMsgZone(ep *endpoint.Endpoint, m *dns.Msg, r *rfc2136Provider) {
}
}

log.Debugf("No available zone found for %s, set it to 'root'", ep.DNSName)
log.Warnf("No available zone found for %s, set it to 'root'", ep.DNSName)
r.krb5Realm = dns.Fqdn(".")
m.SetUpdate(dns.Fqdn("."))
}

0 comments on commit 714078d

Please sign in to comment.