Dockerfile for DNS/HTTP wildcard server

This DNS/HTTP server enables the procurement of wildcard certs for
sslip.io subdomains.

Drive-by:

- Removed the apostrophe from the initialized TXT string so that
cutting-and-pasting the string is less difficult (but the backslashes
and double quotes are still a pain).

- The DNS/HTTP server logs output when the TXT record is updated. We log
most actions, and this is perhaps the most important one, so it was an
oversight that we didn't log it.
This commit is contained in:
Brian Cunnie
2021-01-10 06:11:38 -08:00
parent be1803de6d
commit 3f61b73290
3 changed files with 55 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ import (
"golang.org/x/net/dns/dnsmessage"
)
var txt = `Set this TXT record: curl -X POST http://localhost/update -d '{"txt":"Certificate Authority's validation token"}'`
var txt = `Set this TXT record: curl -X POST http://localhost/update -d '{"txt":"Certificate Authority validation token"}'`
// Txt is for parsing the JSON POST to set the DNS TXT record
type Txt struct {
@@ -131,5 +131,6 @@ func updateTxtHandler(w http.ResponseWriter, r *http.Request) {
return
}
// this is the money shot, where we update the DNS TXT record to what was in the POST request
log.Println("Updating TXT record from \"" + txt + "\" → \"" + updateTxt.Txt + "\".")
txt = updateTxt.Txt
}