letsencrypt / challtestsrv

Small TEST-ONLY server for mock DNS & responding to HTTP-01, DNS-01, and TLS-ALPN-01 ACME challenges.
Mozilla Public License 2.0
19 stars 21 forks source link

fix: don't panic with unknown DNS question type. #4

Closed ldez closed 5 years ago

ldez commented 5 years ago

Currently when a question type is not supported challtestsrc panics.

My fix is a possibility but it's also possible:

Tell me what you prefer.

dig @localhost -p 8053 SOA foobar.com
# or
drill foobar.com SOA @localhost -p 8053
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6d0967]

goroutine 40 [running]:
github.com/letsencrypt/pebble/vendor/github.com/letsencrypt/challtestsrv.(*ChallSrv).dnsHandler(0xc0000a4be0, 0x7ee6c0, 0xc0001f8080, 0xc00023e000)
    /home/ldez/sources/go/src/github.com/letsencrypt/pebble/vendor/github.com/letsencrypt/challtestsrv/dns.go:159 +0x1f7
github.com/letsencrypt/pebble/vendor/github.com/letsencrypt/challtestsrv.(*ChallSrv).dnsHandler-fm(0x7ee6c0, 0xc0001f8080, 0xc00023e000)
    /home/ldez/sources/go/src/github.com/letsencrypt/pebble/vendor/github.com/letsencrypt/challtestsrv/challenge-servers.go:160 +0x48
github.com/letsencrypt/pebble/vendor/github.com/miekg/dns.HandlerFunc.ServeDNS(0xc0000a3180, 0x7ee6c0, 0xc0001f8080, 0xc00023e000)
    /home/ldez/sources/go/src/github.com/letsencrypt/pebble/vendor/github.com/miekg/dns/server.go:52 +0x44
github.com/letsencrypt/pebble/vendor/github.com/miekg/dns.(*ServeMux).ServeDNS(0xc0000c0320, 0x7ee6c0, 0xc0001f8080, 0xc00023e000)
    /home/ldez/sources/go/src/github.com/letsencrypt/pebble/vendor/github.com/miekg/dns/serve_mux.go:128 +0x5d
github.com/letsencrypt/pebble/vendor/github.com/miekg/dns.(*Server).serveDNS(0xc00016e000, 0xc0001f8080)
    /home/ldez/sources/go/src/github.com/letsencrypt/pebble/vendor/github.com/miekg/dns/server.go:688 +0x2c1
github.com/letsencrypt/pebble/vendor/github.com/miekg/dns.(*Server).serve(0xc00016e000, 0xc0001f8080)
    /home/ldez/sources/go/src/github.com/letsencrypt/pebble/vendor/github.com/miekg/dns/server.go:573 +0x2d8
github.com/letsencrypt/pebble/vendor/github.com/miekg/dns.(*Server).worker(0xc00016e000, 0xc0001f8080)
    /home/ldez/sources/go/src/github.com/letsencrypt/pebble/vendor/github.com/miekg/dns/server.go:244 +0x4d
created by github.com/letsencrypt/pebble/vendor/github.com/miekg/dns.(*Server).spawnWorker
    /home/ldez/sources/go/src/github.com/letsencrypt/pebble/vendor/github.com/miekg/dns/server.go:284 +0x86