Commit Graph

659 Commits

Author SHA1 Message Date
Brian Cunnie
2ad70a028a SOAResource(), MXResource() have unit tests
Sure, they have unit tests, but the methods are so simple I'm not sure
they're worth testing.

I changed the hostmaster to `yoyo@nono.io` because I felt more
comfortable having the email on ProtonMail in lieu of Gmail.
2020-09-27 14:27:02 -07:00
Brian Cunnie
93748f8be2 xip: lookup IPv6 (AAAA) records, too
- Refactored the tests, but they're still hard to follow

Todo:

- break out the case statement to a separate method in `QueryResponse()`
- add NS, MX records
2020-09-23 15:35:35 -07:00
Brian Cunnie
c4e5dfb0ca Use dnsmessage's Parser() and Builder()`
- Change Ginkgo's `To(Not(` to use the shorter `ToNot(`
- did fewer initializations in the `vars` block and moved them to the
  `BeforeEach()` blocks.

The `QueryResponse()` test is too long & convoluted; even I have a hard
time understanding them, and I wrote them! The tests & code should be
re-written, but that's for another day.
2020-09-20 16:39:04 -07:00
Brian Cunnie
67acbb7f47 Golang: use dnsmessage.Builder
- It automatically populates the header for us, which would have been a
  big headache to do manually.
- Switched `ENOTFOUND` to `ErrNotFound`, and updated the error message
  as well. As sad as it was to make this switch, I must acknowledge that
  I'm coding in Go, not C, and I should follow its conventions.
- TWO OF THE TESTS ARE BROKEN. I know, I'll fix them soon. I should have
  fixed the tests first, then the code, but I was overeager.
2020-09-16 20:04:25 -07:00
Brian Cunnie
7b3fdd9c04 🏆 Success! It resolves 1 query
- it resolves `127.0.0.1.sslip.io`
- it ranges through all the questions in query, even though, IIRC, only
  the first one is ever populated.
- ran both `gofmt` and `goimports`
2020-09-06 16:03:33 -07:00
Brian Cunnie
e9ef1536cf SOAResource() provides SOA information
- currently hard-coded. And I didn't think too hard about how I could
  make it more flexible in the future.
- various times stolen from the domain `google.com`, with the exception
  of `minTTL`, which I bumped from 60 to 300.
- I called variable names that are arrays "...Array" because they're so
  rare--slices are much more common.
- fixed a bug in main.go where the error-logic was inverted.
2020-09-04 14:53:41 -07:00
Brian Cunnie
6cb1a1902e 🐞 can't have break when not in a loop 2020-09-04 12:50:22 -07:00
Brian Cunnie
c189897bed Document xip package, functions
Because I love documenting, and the act of documenting clarifies my
thinking.
2020-09-04 12:23:40 -07:00
Brian Cunnie
293cc3c7f2 Handle DNS query's processing in a separate thread
...because I can. And because it gives me a reason to use `go func()`
2020-09-04 12:20:10 -07:00
Brian Cunnie
d672bbff70 ResponseHeader(), a convenience function
Returns the DNS header, pre-populated. So simple probably not worth
testing.
2020-08-29 15:09:26 -07:00
Brian Cunnie
00d27ea093 QueryResponse() returns syntactically correct
It doesn't provide any answers yet, but the response is correctly
formatted.
2020-08-29 14:28:16 -07:00
Brian Cunnie
4bd039bc57 QueryResponse() is the centerpiece of the library
`QueryResponse()` takes a byte array and returns a byte array. It's a
black box that `main.go` can use to input the DNS query and get back the
DNS response. This enables us to have a very lean `main.go`, which means
we can put much of the processing into the library, and which means we
can unit-test the components.

- A better-late-than-never `gofmt -w .` included cosmetic changes.
2020-08-29 11:59:07 -07:00
Brian Cunnie
2bd50a2241 sslip.io: lean main.go
Moved much of the processing of DNS messages into the library. Testing a
library is easier than testing `main`, so I like to keep a lean
`main`.
2020-08-22 16:13:56 -07:00
Brian Cunnie
06daa8ab29 NameToAAAA() converts IPv6 addresses
IPv6 only works on dashes, not dots. Mostly because the double-colon:
`--1` → `::1`. The double-colon, in dot-notation, would be `..`, which
is invalid in DNS.
2020-08-19 11:41:27 -07:00
Brian Cunnie
0badb9238b NameToA() has better coverage
I couldn't resist—every network I used in my examples is special.
2020-08-17 08:51:17 -07:00
Brian Cunnie
5031bd0ca6 Remove deprecated sslip.go, was renamed to xip.go 2020-08-17 07:53:02 -07:00
Brian Cunnie
65bb857041 NameToA() accommodates hyphens ("-") in hostnames 2020-08-16 19:02:02 -07:00
Brian Cunnie
5af7186566 Golang package xip resolves IPv4 addresses
- tested with ginkgo
- The primary method, `NameToA`, returns a resource and an error.
  The error can be one value, "ENOTFOUND". I was not sure about the
  returning the error—maybe I could return nil (not possible) when
  I can't find the IP, or maybe return a 0.0.0.0 IP, but 0.0.0.0 is a
  valid IP, so I use the error as out-of-band signaling.
2020-08-16 18:43:58 -07:00
Brian Cunnie
8bb2953367 Git must ignore JetBrains's dingleberries
`.idea/` should not be checked in.
2020-08-16 18:43:58 -07:00
Brian Cunnie
70aa45585e Nameservers: remove ns-vultr.nono.io, not always up
ns-vultr.nono.io is a bad nameserver because it's shut down for ~8 days
each month (when the unbelievable Singapore hunger for  NTP uses up my
monthly allowance of 3TB)

Besides, three nameservers is enough.
2020-07-25 16:56:36 -07:00
Brian Cunnie
244ad48bb1 Revert "+foundry.fun"
This reverts commit b8a327b128.

PowerDNS's bind backend doesn't appear to handle wildcards consistently
as secondaries, so I'm reverting this change and instead using a pair of
FreeBSD+bind servers (ns-he + ns-digitalocean) to provide the DNS.
2020-07-25 16:45:14 -07:00
Brian Cunnie
b8a327b128 +foundry.fun 2020-07-24 18:48:05 -07:00
Brian Cunnie
44f3a1cf95 🐞 PowerDNS 4.2.2 pdns.conf: no "first", "second"
fixes:
```
Jul 21 01:07:03 Caught an exception instantiating a backend: launch= suffixes are not supported on the bindbackend
```
```
Jul 21 01:08:47 Fatal error: Trying to set unknown parameter 'bind-first-config'
```
```
Jul 21 01:08:57 Fatal error: Trying to set unknown parameter 'pipe-second-command'
```
2020-07-20 18:32:33 -07:00
Brian Cunnie
ce7ae97e1e k8s: sslip.io nginx: deployment
readiness probes, memory limits—the works!
2020-07-05 17:04:12 -07:00
Brian Cunnie
46468f9f2c k8s: sslip.io DNS: add readiness & liveness probes
Also fix memory requirements: it's 32Mi not 32Gi
2020-07-05 16:51:44 -07:00
Brian Cunnie
bcb4536502 ks8: sslip.io DNS: deployment does not include nginx 2020-07-05 16:41:58 -07:00
Brian Cunnie
3565c5ab99 k8s sslip.io DNS: only request 32Mi
...because the 2 current pods only use 15Mi, 9Mi respectively.
2020-07-05 16:39:47 -07:00
Brian Cunnie
4164af4e9c k8s: introduce nginx Dockerfile
We now introduce a second Dockerfile, `Dockerfile-nginx`, to be used for
the web assets for sslip.io.

It does not run TLS; we assume that the load balancer will take care of
that.

We also gussied-up the PowerDNS Dockerfile with minor changes.
2020-07-05 15:49:42 -07:00
Brian Cunnie
ae1012f483 document_root/ is under k8s/
fixes `Forbidden path outside the build context` when building the
forthcoming `Dockerfile-nginx`
2020-07-05 11:32:27 -07:00
Brian Cunnie
3c7a883709 k8s: Distinguish Dockerfile with -pdns
...to differentiate from the nginx Dockerfile, which is forthcoming.
2020-07-05 09:08:58 -07:00
Brian Cunnie
50e17b3d7f k8s: deployment & nodePort service
- nodePort service is merely a proof-of-concept; this won't be the final
  form the service takes. The port needs to be 53, not 32767.
- the deployment doesn't include the nginx webserver, merely the DNS
  server. Also, I had trouble connecting both UDP & TCP to port 53,
  so I chose UDP.
2020-07-05 08:27:53 -07:00
Brian Cunnie
c89ff9cdd8 sslip.io needs ps, nc, lsof, ifconfig
Requires +19MB: 494 MB → 513 MB
2020-06-06 11:20:03 -07:00
Brian Cunnie
720e2a71b1 DNS: secondaries for diarizer.com
We are now secondaries for diarizer.com because it needs to share the
same webserver as *.cf.nono.io, and needs SSL certs, and needs to be
able to participate in the DNS challenge.
2020-05-24 17:47:22 -07:00
Brian Cunnie
23456d6a20 sslip.io: run DNS server in Docker container
- Include BIND secondaries for nono.io/nono.com
  (use this & you'll be unwitting secondaries for my domains)
- Fedora-based. Because IBM/Red Hat hires a lot of the Linux kernel developers.
2020-04-29 21:10:00 -07:00
Brian Cunnie
d79128ae37 Expand the term "Branding" to include "White Label"
I like "White Label" better. I also like the term "Custom Domains".

Thanks [Francisco Ros](https://moss.sh/free-wildcard-dns-services/).
2020-04-12 08:06:24 -07:00
Brian Cunnie
e8c9c0f283 Remove NS server ns-vultr.nono.io
I turn off ns-vultr typically the last week of the month because it
exceeds its 3TB bandwidth because it's one of the few NTP servers in
Singapore. Because it's not consistently up, it should not be a
nameserver, removing.

fixes <https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/check-dns/builds/1874>
```
nameserver ns-vultr.nono.io.'s SOA record match (FAILED - 2)
nameserver ns-vultr.nono.io. resolves 199.147.119.111.sslip.io to 199.147.119.111 (FAILED - 3)
nameserver ns-vultr.nono.io. resolves 28-165-216-73.sslip.io to 28.165.216.73 (FAILED - 4)
nameserver ns-vultr.nono.io. resolves 5fjtv1hr.82-45-16-87.sslip.io to 82.45.16.87 (FAILED - 5)
nameserver ns-vultr.nono.io. resolves 207-60-213-72.9cs26rza to 207.60.213.72 (FAILED - 6)
nameserver ns-vultr.nono.io. resolves api.--.sslip.io' to eq ::)} (FAILED - 7)
nameserver ns-vultr.nono.io. resolves localhost.--1.sslip.io' to eq ::1)} (FAILED - 8)
nameserver ns-vultr.nono.io. resolves 2001-4860-4860--8888.sslip.io' to eq 2001:4860:4860::8888)} (FAILED - 9)
nameserver ns-vultr.nono.io. resolves 2601-646-100-69f0--24.sslip.io' to eq 2601:646:100:69f0::24)} (FAILED - 10)
```
2019-07-31 19:28:47 -07:00
Brian Cunnie
779306c6fa Enhancement: Excluded domains
The PowerDNS pipe backend will return NO RECORDS for domains which are
excluded (`XIP_EXCLUDED_DOMAINS`);

This fixes an error where the pipe backend returns authoritative records
for the domains which I want the bind backend to answer; surprisingly,
this behavior breaks wildcard records:

fixes:
```
TYPE=any RECORD=c.pas.nono.io; dig +short $TYPE $RECORD @ns-aws.nono.io; echo; dig +short $TYPE $RECORD @ns-he.nono.io
ns-aws.nono.io.
ns-azure.nono.io.
ns-gce.nono.io.
ns-vultr.nono.io.
"protonmail-verification=ce0ca3f5010aa7a2cf8bcc693778338ffde73e26"
10 mail.protonmail.ch.
briancunnie.gmail.com. ns-he.nono.io. 2018092000 300 300 300 300

haproxy.pas.nono.io.
```
2018-10-02 18:23:14 -07:00
Brian Cunnie
552353b2a0 Unit tests are run for sslip.io executable 2018-09-24 21:16:02 -07:00
Brian Cunnie
ed2c39e94f Remove redundant "https://"
How embarrassing -- it made the website seem like amateur-hour.
2018-09-24 18:12:47 -07:00
Brian Cunnie
7339e98501 NS records: +ns-vultr.nono.io, -ns-he.nono.io
ns-he.nono.io will be using BIND, not PowerDNS, in the near future.
2018-09-20 09:38:26 -07:00
Brian Cunnie
6fcad9e2b0 sslip.io NS: +ns-vultr.nono.io, -ns-he.nono.io
- I had to remove `ns-he.nono.io`; I'm moving back to BIND on that one.
- `resolve_ns_subdomain` is deprecated; I don't need to resolve
  the IP addresses of the NS records, for they're in a different domain.
- Added `localhost` resolution; it was one of the common queries.
2018-09-20 06:35:11 -07:00
Brian Cunnie
ee8c94a347 sslip.io has an MX record 2018-09-12 16:51:40 -07:00
Brian Cunnie
ec894473ce sslip.io has TXT records for protonmail 2018-09-12 13:48:00 -07:00
Brian Cunnie
a0f1136286 Deprecate serial_groups
Now that we run cellblocks in parallel, we no longer need serial groups,
but we might decide to use resource pools to allow us to chain deploys.
2018-07-11 12:50:35 -07:00
Brian Cunnie
51983abdaa Remove tasks; they're unnecessary for dummy pipeline
- Pull the pipeline configuration from Concourse, but re-add the
comments at the top & the entire `resources` section which has YAML
anchors and is much more brief as a result
2018-07-11 12:32:23 -07:00
Brian Cunnie
af4d259b02 Diego cellblocks are rolled in clumps of 5 2018-07-11 12:22:07 -07:00
Brian Cunnie
a72a840f66 CI job _deploy-pws-diego-cellblock-02_ has fewer restrictions
Previously _deploy-pws-diego-cellblock-02_ waited for
_deploy-pws-pivotal-internal-apps_ to complete before starting, but that
particular job has taken as long as 1:47 (HH:MM) (cf-deployment v2.5.0).

_deploy-pws-diego-cellblock-02_'s other dependency,
_deploy-pws-diego-cellblock-01_, completed in a much more reasonable
timeframe (1:08), and is also a more similar deployment (in other words,
if the deployment to cellblock 01 has succeeded, then we should proceed
with cellblock 02 & not bother to wait for Internal Apps).
2018-07-11 09:38:31 -07:00
Brian Cunnie
d7ce0cc7b6 Concourse pipeline bosh:pws_cf
This is a dummy pipeline to demonstrate visually the changes to
accelerate the deployment to PWS (Pivotal Web Services). We hope to
reduced deployment time from 17 hours to 11 hours while restricting
Diego cell vacating to one az (availability zone) at a time.
2018-07-11 09:34:20 -07:00
Brian Cunnie
a2564c12d3 dig shouldn't bomb-out if forbidden hyphen is used
Yes, according to the RFC it shouldn't begin with a hyphen. And, since
we're on the topic, underscores were supposed to be off the table, too,
but Microsoft used them anyway, and you know what? We're gonna use the
"forbidden hyphen". And we're gonna instruct `dig` to not be so
persnickety.

fixes:
```
dig +short  AAAA api.--.sslip.io
dig: idn2_lookup_ul failed: string start/ends with forbidden hyphen
```

I had to make it work for old-style (e.g. macOS dig) which is version
"DiG 9.8.3-P1" as well as for the new version ("DiG
9.11.3-RedHat-9.11.3-6.fc28") which has this new
[library](https://www.gnu.org/software/libidn/libidn2/reference/libidn2-idn2.html)
which does the following:

> Perform IDNA2008 lookup string conversion on domain name src , as described in section 5 of RFC 5891
2018-05-23 20:03:34 -07:00
Brian Cunnie
d778654c00 Table includes URLs pointing to the website mirrors
Nothing like a good example to drive the point home.

I need to update the AWS and Hetzner content to reflect these changes,
and include the new URL in the Hetzner LetsEncrypt list.
2018-05-21 07:07:04 -07:00