🐞 _acme-challenge. comparisons are case-insensitive

Our DNS-01 challenges were failing because we weren't prepared for
mixed-case queries. Now we properly recognize them.

```
2021/01/20 20:15:40 3.123.253.205.45368 TypeTXT _ACMe-cHalLeNGE.34-83-219-164.sSlip.Io. ? nil, SOA _ACMe-cHalLeNGE.34-83-219-164.sSlip.Io. briancunnie.gmail.com. 2021011400 900 900 1800 300
```
```
2021/01/20 20:15:40 18.219.85.19.35164 TypeTXT _acMe-chaLlENGe.34-83-219-164.ssliP.Io. ? nil, SOA _acMe-chaLlENGe.34-83-219-164.ssliP.Io. briancunnie.gmail.com. 2021011400 900 900 1800 300
```
```
2021/01/20 20:15:40 66.133.109.36.11107 TypeTXT _aCme-chaLleNGe.34-83-219-164.sSLip.Io. ? nil, SOA _aCme-chaLleNGe.34-83-219-164.sSLip.Io. briancunnie.gmail.com. 2021011400 900 900 1800 300
```
This commit is contained in:
Brian Cunnie
2021-01-20 13:00:42 -08:00
parent a3de35fa45
commit 1a9279ecc1
2 changed files with 9 additions and 1 deletions

View File

@@ -40,7 +40,7 @@ var (
ipv4REDashes = regexp.MustCompile(`(^|[.-])(((25[0-5]|(2[0-4]|1?[0-9])?[0-9])-){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9]))($|[.-])`)
// https://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
ipv6RE = regexp.MustCompile(`(^|[.-])(([0-9a-fA-F]{1,4}-){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}-){1,7}-|([0-9a-fA-F]{1,4}-){1,6}-[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}-){1,5}(-[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}-){1,4}(-[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}-){1,3}(-[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}-){1,2}(-[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}-((-[0-9a-fA-F]{1,4}){1,6})|-((-[0-9a-fA-F]{1,4}){1,7}|-)|fe80-(-[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]+|--(ffff(-0{1,4})?-)?((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])|([0-9a-fA-F]{1,4}-){1,4}-((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9]))($|[.-])`)
dns01ChallengeRE = regexp.MustCompile(`_acme-challenge\.`)
dns01ChallengeRE = regexp.MustCompile(`(?i)_acme-challenge\.`)
nsAws, _ = dnsmessage.NewName("ns-aws.nono.io.")
nsAzure, _ = dnsmessage.NewName("ns-azure.nono.io.")
nsGce, _ = dnsmessage.NewName("ns-gce.nono.io.")

View File

@@ -274,6 +274,14 @@ var _ = Describe("Xip", func() {
randomDomain = "_acme-challenge.fe80--1." + random8ByteString() + ".com."
Expect(xip.IsAcmeChallenge(randomDomain)).To(BeTrue())
})
When("it has random capitalization", func() {
It("returns true", func() {
randomDomain := "_AcMe-ChAlLeNgE.127.0.0.1." + random8ByteString() + ".com."
Expect(xip.IsAcmeChallenge(randomDomain)).To(BeTrue())
randomDomain = "_aCMe-cHAllENge.fe80--1." + random8ByteString() + ".com."
Expect(xip.IsAcmeChallenge(randomDomain)).To(BeTrue())
})
})
})
})
})