Commit Graph

226 Commits

Author SHA1 Message Date
Brian Cunnie
19b8e07c10 Website: provide link to open report problems
When we released our new Golang-based DNS server, we had a banner that
said to let us know if anything breaks, but we neglected to tell them
_how_ to let us know. Now we include a link that opens a GitHub issue.
2020-12-17 08:00:42 -08:00
Brian Cunnie
1251afa774 DNS server: allow returning _multiple_ AAAA records
Previously the DNS server only returned the first AAAA record of a
customized domain; now it will return all the AAAA records.
2020-12-17 07:54:08 -08:00
Brian Cunnie
ef868f7fdb BOSH release: 1.2.2: TXT records, this time without bugs 1.2.2 2020-12-16 09:28:00 -08:00
Brian Cunnie
dc20d97adf 🐞 TXT Records: only ONE string per record
Previously we were returning one TXT record with multiple strings for
_sslip.io_. That did not work for ProtonMail's domain verification.

It seems a convention that each TXT record has one string. _google.com_,
for example, has a separate TXT record for each string.

It turns out I had misunderstood the
[StackExchange](https://serverfault.com/questions/815841/multiple-txt-fields-for-same-subdomain)
thread.

fixes (from ProtonMail domain verification):

> Verification did not succeed, please try again in an hour.
2020-12-16 09:15:14 -08:00
Brian Cunnie
8da410c029 BOSH release: 1.2.1 TXT records
The compelling reason was to to enable Protonmail for sslip.io email;
they require specific TXT records.
1.2.1
2020-12-16 08:06:53 -08:00
Brian Cunnie
b0b88720a3 Record not found? call noAnswersOnlyAuthorities()
The same code was repeated in three different locations, and now it's
been refactored to one method.
2020-12-16 07:42:54 -08:00
Brian Cunnie
47406ca3a8 TXTResource returns custom TXT resources
In order to restore email service for the sslip.io domain, we need to
return custom TXT records.

The custom records are in the `xip.Customizations` variable. This lays
the groundwork for ACMEv2 wildcard DNS, which, IIRC, works via TXT
records.

Drive-by: removed an unused constant, `MxHost`. That information is
either in the `Customization` struct or generated on-the-fly.

fixes:

> Dear valued customer, We have disabled your domain sslip.io and all of its addresses. No emails will be received or sent for it.

[#6]
2020-12-16 07:15:35 -08:00
Brian Cunnie
59b016414c Docs: How to update a BOSH release, part II
Include deploying the servers, which is the most important part. And
updating the webserver's HTML, too.
2020-12-13 16:56:41 -08:00
Brian Cunnie
5cdbf36dd2 Docs: How to update a BOSH release
This would probably be better automated, but I don't plan on producing
many more BOSH releases of sslip.io.
2020-12-13 16:40:07 -08:00
Brian Cunnie
b8b54a40f4 🐞 Fix the broken badges on the website
I renamed the Concourse CI job "check-dns" → "dns-servers", but never
updated the URL of the badge.
2020-12-13 16:36:50 -08:00
Brian Cunnie
c1db16dd17 Website: link to the latest (1.2.0) release 2020-12-13 16:24:24 -08:00
Brian Cunnie
8dcb3447b0 BOSH release: 1.2.0: bugfixes
- 🐞 fix IPv6 resolution:
    2601-41d0-2-e01e--56dB-3598.sSLIP.io. → 2601:41d0:2:e01e::56db      (wrong)
                                          → 2601:41d0:2:e01e::56db:3598 (right)
- 🐞 fix IPv4 resolution:
    minio-01.192-168-1-100.sslip.io → 1.192.168.1   (wrong)
                                    → 192.168.1.100 (right)
- MX records are customized
  - sslip.io's records point to protonmail
  - everyone else's point to themselves (whatever FQDN they queried)
- License switched to Apache because GNU is too burdensome
  (trust me, I've been on the receiving end)
- include notes for myself to create BOSH releases
  (DEVELOPER.md)
1.2.0
2020-12-13 07:44:00 -08:00
Brian Cunnie
e19af13adb Fuzz testing: we randomly test 1k IPv6 addresses
To avoid being caught with our pants down & having certain IPv6
addresses not resolve correctly, we introduce fuzz testing to catch any
errors. Each run tests 1k IPv6 addresses.

We haven't found any errors yet.
2020-12-12 16:07:00 -08:00
Brian Cunnie
f1b3f652f9 🐞 IPv6 addresses with :: in the middle work properly
IPv6 resolution was truncated if there was more than one section after
the double-dash (`--`):

2601-41d0-2-e01e--56dB-3598.sSLIP.io. → 2601:41d0:2:e01e::56db      (wrong)
                                      → 2601:41d0:2:e01e::56db:3598 (right)

The fix was to use `regexp.Longest()`

`git diff` makes it appear that I modified the IPv6 RE. I didn't. This
is merely a whitespace change caused by having forgotten to run `gofmt`
before committing the previous commit.

fixes (from the logs):
```
TypeAAAA 2601-41d0-2-e01e--56dB-3598.sSLIP.io. ? 2601:41d0:2:e01e::56db
```
2020-12-12 10:21:01 -08:00
Brian Cunnie
94c55db57b DNS Server: IPv4: no mixing of dots and dashes
Long-ago behavior (PowerDNS):

minio-01.192-168-1-100.sslip.io → 192.168.1.100

More-recent behavior (Golang):

minio-01.192-168-1-100.sslip.io → 1.192.168.1

This behavior is counter-intuitive & wrong. We now restore the long-ago
behavior by being much more strict--no more mixing of dots and dashes!

Thanks @pandaxin!

[fixes #9]
2020-12-12 09:23:57 -08:00
Brian Cunnie
b4e3005d84 CI: test the Golang DNS server's unit tests
...and not the deprecated PowerDNS pipe backend shell script, which we
no longer use.

README now has the badge for the unit tests, and the placeholder is
gone.

fixes:
```
resources.6h: '6h' is not a valid identifier: must start with a lowercase letter^
```
2020-12-12 06:50:05 -08:00
Brian Cunnie
7ac03d022b Go Modules: bump gomega 2020-12-12 06:14:15 -08:00
Brian Cunnie
95975e5ea6 README: Promote Golang DNS Server
The Golang DNS server is no longer experimental; the sslip.io
nameservers run the Golang DNS server.

- Include a placeholder for the `ginkgo` tests to run in CI.
- Include `src/` and `bosh-release/` in the list of directories.
- Mark the PowerDNS-related assets as deprecated; we no longer use
  PowerDNS.
2020-12-11 09:17:00 -08:00
Brian Cunnie
f351fab1d3 Refactor: squash if statements
Previously I had nested `if` statements to test if a key existed and if
there were any records under that key. I squashed it so that it was no
longer nested.

Some may complain it's now harder to read, but for me it's easier to
read, and more logical, too, for the `if` statement says, "if there's an
override, then return the override."
2020-12-11 08:26:33 -08:00
Brian Cunnie
e99916484f DNS: sslip.io's MXes are protonmail's servers
...and everyone else's are themselves, e.g. `127.0.0.1.sslip.io`'s MX
record is `127.0.0.1.sslip.io` with a preference of 0. This allows me to
get email for sslip.io without worrying about email for every sslip.io
subdomain.

- Refactor: the global variable `NameServers` no longer holds the IP
  addresses of the nameservers, merely their names. The addresses are now
  held in the `Customizations` variable, the more appropriate place. We
  only want one source of truth wherever possible.

- 🐞 The original Go Playground for creating `dnsmessage.Name`s was
  wrong: it said to NOT put a dot at the end. You need the dot at the end.
  The MX records for `sslip.io` now have dots at the end.

- The above bug caused `processQuestion()` to return an unexpected
  error, but without the underlying error message. Now, when
  `processQuestion()` errors in an unexpected manner, it logs the
  underlying error message, which makes debugging much easier.

- Richer logging for MX queries: we now return the servers and
  preferences rather than the terse `MX`.

- We use specific `fqdnString` rather than the generic `domain`
  as a variable for consistency, which is the hobgoblin of small minds.
2020-12-11 07:54:52 -08:00
Brian Cunnie
e695c120b3 HTML: Related services: nip.io, localtls 2020-12-10 08:01:31 -08:00
Brian Cunnie
d7df7b4175 Allow custom DNS records for specific domains
I wanted to add SPF and DKIM records (TXT records) to sslip.io, but I
couldn't because I'd have to add those records to _every_ query, and I
didn't want that.

This refactor now allows overrides for specific records for specific
domains. It's a more elegant solution.

sslip.io has the following custom records:
- A (which points to the Hetzner server)
- AAAA (same Hetzner server, but via IPv6)
- MX records (protonmail)
2020-12-10 07:21:54 -08:00
Brian Cunnie
9b3f8a789a README: we have three name servers, not four 2020-12-03 06:43:45 -08:00
Brian Cunnie
779520cca2 Website has instructions for running custom server
We describe how to run our pre-built executable within a docker
container. They can figure out the rest from there.

If they don't understand those instructions, they shouldn't be running
their own DNS server.
2020-12-01 16:39:01 -08:00
Brian Cunnie
3578d96970 make_all: generate executables for all GOOSes
...well, maybe not _all_ GOOSes, but at least the important ones.

And git should ignore the executables so that we don't accidentally
check them in.
2020-12-01 16:08:44 -08:00
Brian Cunnie
62a95f04b7 README: tell users that we have a new backend 2020-12-01 12:49:05 -08:00
Brian Cunnie
ec76a6cdcf License: GNU Affero → Apache 2.0
Now that I've worked on the other side of LGPL licensing, and the pain
of providing build instructions for a binary we download from Maven, I'm
a big fan of Apache 2.0 licensing.
2020-12-01 12:09:50 -08:00
Brian Cunnie
0c09717a1b BOSH release: 1.1.2: make website great again
Now we have A & AAAA records for sslip.io.
1.1.2
2020-12-01 12:03:10 -08:00
Brian Cunnie
4d05abd1b0 🐞 make sslip.io's website accessible again
The new webserver didn't have A and AAAA records for `sslip.io`, which
meant there was no website. We need a website. This commit fixes that.

The code is somewhat inflexible in that it assumes that there's exactly
oneA record and exactly one AAAA record.

I took the opportunity to bump SOA's serial and set the Hostmaster email
address to my primary email (brian.cunnie@gmail.com).

fixes:
```
curl: (6) Could not resolve host: sslip.io
```
2020-12-01 11:55:17 -08:00
Brian Cunnie
a37bbc150c CI: check sslip.io's A & AAAA records, and website
- The impetus? I deployed a custom webserver but forgot to add the
  A & AAAA records for sslip.io, so the website disappeared.
- I now check for the A & AAAA records (to be present, but not of any
  particular value because that gives me the latitude to migrate to
  other machines).
- I also check that the website is responsive.
- drive by: removed hard-coding of `sslip.io` in many tests; instead we
  now query the domain that the env var `DOMAIN` is set to.
2020-12-01 10:01:08 -08:00
Brian Cunnie
09249be0a0 CI: don't double-count the nameservers
On macOS, `whois` returns _two_ results for the domain `sslip.io` from
two different whois servers:

- whois.nic.io
- whois.namecheap.com

This means that every nameservers is double-counted. To fix, we remove
the duplicates.

fixes:
```
     Failure/Error: expect(dig_nameservers.sort).to eq(whois_nameservers.sort)

       expected: ["ns-aws.nono.io.", "ns-aws.nono.io.", "ns-azure.nono.io.", "ns-azure.nono.io.", "ns-gce.nono.io.", "ns-gce.nono.io."]
            got: ["ns-aws.nono.io.", "ns-azure.nono.io.", "ns-gce.nono.io."]

       (compared using ==)
     # ./spec/check-dns_spec.rb:44:in `block (3 levels) in <top (required)>'
```
2020-12-01 09:22:24 -08:00
Brian Cunnie
06f1556699 Revert "dig shouldn't bomb-out if forbidden hyphen is used"
DiG 9.10.6 no longer has the `+noidn` option, and `dig` will error if we
try to use it.

fixes:
```
dig +short +noidnin ns sslip.io @ns-azure.nono.io.
Invalid option: +noidnin
```

And this previously-invalid dig query now works, so we don't need the
option anyway:
```
dig +short AAAA api.--.sslip.io
::
```

This reverts commit a2564c12d3.
2020-12-01 09:17:08 -08:00
Brian Cunnie
0ac9e1895d HTML: tidy 5.6.0 the HTML assets
It makes it easier for editing.
2020-12-01 08:40:00 -08:00
Brian Cunnie
459a86dab3 🐞 sslip.io SOA conforms to the Golang server's
- Modified SOA:
  - We're setting the SOA serial _backwards_; yes, even though there's no
    impact, it feels gross. But the alternative, modifying the Golang code
    and re-releasing, was too much work.
  - I changed the SOA's refresh/retry/expire to match google.com's.
  - I changed the mname (primary master) from `ns-he.nono.io` to
    `sslip.io`. The change is cosmetic; those are the same machine.
- We emptied out the `pdns_named_conf`; we're not using the bind backend
  anymore, so the bind configuration can be empty.

fixes <https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/check-dns/builds/3813>:
```
       expected: "ns-he.nono.io. briancunnie.gmail.com. 2020112800 300 300 300 300\n"
            got: "sslip.io. yoyo.nono.io. 2020090400 900 900 1800 300\n"
```
2020-11-30 17:24:06 -08:00
Brian Cunnie
3c36f85b6d BOSH release: 1.1.1: compilation bugfix 1.1.1 2020-11-30 14:06:50 -08:00
Brian Cunnie
d072448c2f 🐞 BOSH Release compiles properly
fixes:
```
+ go build -o /var/vcap/packages/sslip.io-dns-server/bin/sslip.io-dns-server
main.go:7:2: package xip/xip is not in GOROOT (/var/vcap/data/packages/golang-1-linux/da1e0a99a1246edab92d9ffd0c4a2e7c3d5df83a/src/xip/xip)
```
2020-11-30 14:03:04 -08:00
Brian Cunnie
c1e7908f57 BOSH release: 1.1.0: A records for nameservers 1.1.0 2020-11-30 13:37:31 -08:00
Brian Cunnie
8571723582 Golang-based DNS server: return A records for nameservers
Some clients query us for the A records of our nameservers even though
our nameservers aren't in our domain; the nameservers are in the
`nono.io` domain, not in the `sslip.io` domain.

Our new code returns the A records of our nameservers:

previously:
```
2020/11/28 21:57:38 190.113.222.130.55236 TypeA ns-aws.nono.io. ? nil, SOA
2020/11/28 21:57:38 190.113.222.130.49919 TypeA ns-azure.nono.io. ? nil, SOA
2020/11/28 21:57:38 190.113.222.130.8090 TypeA ns-gce.nono.io. ? nil, SOA
```
now:
```
2020/11/30 13:20:10 127.0.0.1.58410 TypeA ns-aws.nono.io. ? 52.0.56.137
2020/11/30 13:20:20 127.0.0.1.54717 TypeA ns-azure.nono.io. ? 52.187.42.158
2020/11/30 13:20:28 127.0.0.1.62487 TypeA ns-gce.nono.io. ? 104.155.144.4
```

I learned about Golang maps while implementing this feature.
2020-11-30 13:12:28 -08:00
Brian Cunnie
e7674992c6 .gitignore: ignore JetBrains's ./idea 2020-11-30 10:37:02 -08:00
Brian Cunnie
d9c8291f51 🐞 Import module xip correctly
Don't use the GitHub path; use the local directory.

See
<https://github.com/golang/go/wiki/Modules#do-modules-work-with-relative-imports-like-import-subdir>
for more information. tldr:

```golang
import "xip/xip"
```

The first `xip` is the module name, and the second `xip` is the
subdirectory. They happen to be the same in this case.
2020-11-28 15:11:55 -08:00
Brian Cunnie
f3d4f70ecf sslip.io nameservers no longer use bind backend
The nameservers only use the pipe backend because they are no longer
acting as secondaries for the "regular" domains.

They are now exclusively serving sslip.io domain (and whitelabels).
2020-11-28 13:38:52 -08:00
Brian Cunnie
ef3a0bfd13 🐞 SOA and hostmaster are no longer swapped
I had accidentally swapped the SOA & hostmaster. This didn't break
anything, but it's very embarrassing.

fixes <http://www.webdnstools.com/dnstools/domain_check>:

> Checking DNS contact email address is valid. ns-he@nono.io is not valid. Mail server returned 'no such user'.

> Your SOA record lists briancunnie.gmail.com as the Primary nameserver. This server is not listed as a valid nameserver at the parent servers.
2020-11-28 12:33:24 -08:00
Brian Cunnie
206069be7d BOSH Release README is now 1.0.1
...instead of pointing to the old, broken-logging 1.0.0
2020-11-27 18:07:46 -08:00
Brian Cunnie
b4a58b982e BOSH release: 1.0.1 fixes logging 1.0.1 2020-11-27 17:42:59 -08:00
Brian Cunnie
c452cbb71a BOSH Release has a README
To describe how to deploy, etc.
2020-11-27 17:40:41 -08:00
Brian Cunnie
1040783f64 🐞 BOSH Release: job generates logs
Previously logs weren't being generated because I wasn't redirecting the
output because I accidentally deleted a trailing backslash.
2020-11-27 17:26:24 -08:00
Brian Cunnie
3e8d3d263a splash page: deprecate ns-vultr
It isn't reliable; It's off the last week of the month.
2020-11-27 16:01:37 -08:00
Brian Cunnie
5269ed5ecb BOSH release: 1.0.0 includes sslip.io package 1.0.0 2020-11-26 16:37:21 -08:00
Brian Cunnie
4714e9f2ba BOSH Release: vendored-Golang is in the final builds
Not worthy of its own commit; it should have been part of the commit
where I vendored Golang.
2020-11-26 16:35:13 -08:00
Brian Cunnie
bfa7221973 BOSH release: package sslip.io-dns-server
The packaging script is a bit of a hack: we create the `src/` directory
and move our source into it. 🤮

The source should have been in the proper directory to begin with, but
I'm too tired to fight with directory structures right now.
2020-11-26 16:31:36 -08:00