mirror of
https://github.com/joohoi/acme-dns.git
synced 2025-07-04 07:17:24 +07:00
When appending the SOA for authoritative NXDOMAIN responses, it needs to go in (#151)
the Authoritative section, not the Answer section. This fixes the acme-dns validation for the lego Let's Encrypt client.
This commit is contained in:

committed by
Joona Hoikkala

parent
4f5fad0d32
commit
41a1cff0ae
2
dns.go
2
dns.go
@ -104,7 +104,7 @@ func (d *DNSServer) readQuery(m *dns.Msg) {
|
|||||||
m.MsgHdr.Authoritative = authoritative
|
m.MsgHdr.Authoritative = authoritative
|
||||||
if authoritative {
|
if authoritative {
|
||||||
if m.MsgHdr.Rcode == dns.RcodeNameError {
|
if m.MsgHdr.Rcode == dns.RcodeNameError {
|
||||||
m.Answer = append(m.Answer, d.SOA)
|
m.Ns = append(m.Ns, d.SOA)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,11 +140,11 @@ func TestAuthoritative(t *testing.T) {
|
|||||||
if answer.Rcode != dns.RcodeNameError {
|
if answer.Rcode != dns.RcodeNameError {
|
||||||
t.Errorf("Was expecing NXDOMAIN rcode, but got [%s] instead.", dns.RcodeToString[answer.Rcode])
|
t.Errorf("Was expecing NXDOMAIN rcode, but got [%s] instead.", dns.RcodeToString[answer.Rcode])
|
||||||
}
|
}
|
||||||
if len(answer.Answer) != 1 {
|
if len(answer.Ns) != 1 {
|
||||||
t.Errorf("Was expecting exactly one answer (SOA) for invalid subdomain, but got %d", len(answer.Answer))
|
t.Errorf("Was expecting exactly one answer (SOA) for invalid subdomain, but got %d", len(answer.Ns))
|
||||||
}
|
}
|
||||||
if answer.Answer[0].Header().Rrtype != dns.TypeSOA {
|
if answer.Ns[0].Header().Rrtype != dns.TypeSOA {
|
||||||
t.Errorf("Was expecting SOA record as answer for NXDOMAIN but got [%s]", dns.TypeToString[answer.Answer[0].Header().Rrtype])
|
t.Errorf("Was expecting SOA record as answer for NXDOMAIN but got [%s]", dns.TypeToString[answer.Ns[0].Header().Rrtype])
|
||||||
}
|
}
|
||||||
if !answer.MsgHdr.Authoritative {
|
if !answer.MsgHdr.Authoritative {
|
||||||
t.Errorf("Was expecting authoritative bit to be set")
|
t.Errorf("Was expecting authoritative bit to be set")
|
||||||
|
Reference in New Issue
Block a user