mirror of
https://github.com/acme-dns/acme-dns.git
synced 2026-02-22 01:25:36 -07:00
21 lines
631 B
Go
21 lines
631 B
Go
package nameserver
|
|
|
|
import "github.com/miekg/dns"
|
|
|
|
// SetOwnAuthKey sets the ACME challenge token for completing dns validation for acme-dns server itself
|
|
func (n *Nameserver) SetOwnAuthKey(key string) {
|
|
n.mu.Lock()
|
|
defer n.mu.Unlock()
|
|
n.personalAuthKey = key
|
|
}
|
|
|
|
// answerOwnChallenge answers to ACME challenge for acme-dns own certificate
|
|
func (n *Nameserver) answerOwnChallenge(q dns.Question) ([]dns.RR, error) {
|
|
n.mu.RLock()
|
|
defer n.mu.RUnlock()
|
|
r := new(dns.TXT)
|
|
r.Hdr = dns.RR_Header{Name: q.Name, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: 1}
|
|
r.Txt = append(r.Txt, n.personalAuthKey)
|
|
return []dns.RR{r}, nil
|
|
}
|