Skip to content

Commit 6fa204a

Browse files
committed
Add AIA functional tests and fix server lint warnings
Add functional tests for hashed TLSA and stapled AIA flows, Fix lint warnings in server.go Update CI to install xxd and use Google Chrome on Ubuntu instead of snap Chromium (snap introduces some annoying issues)
1 parent 106a3b8 commit 6fa204a

3 files changed

Lines changed: 669 additions & 12 deletions

File tree

.cirrus.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ task:
125125
install_script:
126126
- apt-get update
127127
# bind9-dnsutils contains dig
128-
- apt-get install -y dnssec-trigger bind9-dnsutils xxd
128+
- apt-get install -y dnssec-trigger bind9-dnsutils libnss3-tools xxd
129+
- if [ "$CI_DISTRO" = "ubuntu" ]; then curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && apt-get update && apt-get install -y google-chrome-stable; else apt-get install -y chromium; fi
129130
# Namecoin Core
130131
# Temporarily downgrade Namecoin Core until deterministic salts with descriptor wallets are fixed.
131132
#- BITCOIND_URL=$(curl https://www.namecoin.org/download/ | grep x86_64-linux-gnu.tar.gz | grep -v 0.13.99 | grep --only-matching https://.*.tar.gz)
@@ -162,7 +163,7 @@ task:
162163
- chown encaya:encaya testdata/*.pem
163164
# Curiously, relative paths don't work here, they cause the .pem files to
164165
# not be detected. Maybe file a bug with Hugo?
165-
- encaya -conf "$(pwd)/testdata/encaya.conf"
166+
- encaya -conf "$(pwd)/testdata/encaya.conf" -encaya.namecoinrpcaddress 127.0.0.1:18554 -encaya.namecoinrpcusername doggman -encaya.namecoinrpcpassword donkey
166167
regtest_script:
167168
- sleep 15s
168169
- testdata/regtest.sh

server/server.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,20 +460,20 @@ func (s *Server) lookupDNS(req *http.Request, domain string) (tlsa *dns.TLSA, er
460460
}
461461

462462
dnsResponse := result.ResponseMsg
463-
if dnsResponse.MsgHdr.Rcode != dns.RcodeSuccess && dnsResponse.MsgHdr.Rcode != dns.RcodeNameError {
463+
if dnsResponse.Rcode != dns.RcodeSuccess && dnsResponse.Rcode != dns.RcodeNameError {
464464
// A DNS error occurred (return code wasn't Success or NXDOMAIN).
465465
return nil, fmt.Errorf("qlib error: return code not Success or NXDOMAIN")
466466
}
467467

468-
if dnsResponse.MsgHdr.Rcode == dns.RcodeNameError {
468+
if dnsResponse.Rcode == dns.RcodeNameError {
469469
// Wildcard subdomain doesn't exist.
470470
// That means the domain doesn't use Namecoin-form DANE.
471471
// Return no cert.
472472
log.Debugf("wildcard subdomain doesn't exist: %s", domain)
473473
return nil, nil
474474
}
475475

476-
if !dnsResponse.MsgHdr.AuthenticatedData && !dnsResponse.MsgHdr.Authoritative {
476+
if !dnsResponse.AuthenticatedData && !dnsResponse.Authoritative {
477477
// For security reasons, we only trust records that are
478478
// authenticated (e.g. server is Unbound and has verified
479479
// DNSSEC sigs) or authoritative (e.g. server is ncdns and is
@@ -734,7 +734,7 @@ func (s *Server) aiaHandler(writer http.ResponseWriter, req *http.Request) {
734734
writer.Header().Set("Cache-Control", "max-age="+maxAgeStr)
735735
}
736736

737-
_, err = io.WriteString(writer, string(requestedCert))
737+
_, err = writer.Write(requestedCert)
738738
if err != nil {
739739
log.Debuge(err, "write error")
740740
}

0 commit comments

Comments
 (0)