Commit Graph

674 Commits

Author SHA1 Message Date
Brian Cunnie
c4d415887e etcd: instructions to configure on ns-aws 2021-12-31 16:20:29 -08:00
Brian Cunnie
af6c0f8326 etcd cluster configuration for ns-aws.sslip.io
- patterned after the [k8s
  configuration](https://github.com/cunnie/docs/blob/main/kubernetes.md#bootstrapping-the-etcd-cluster)
- I'm ridiculously psyched that the certificates are elliptic-curve
- clients communicate no TLS loopback only
- peers require TLS over public IPs
2021-12-31 15:58:38 -08:00
Brian Cunnie
71ca8e1732 etcd: generate certs for cluster communication 2021-12-31 14:51:04 -08:00
Brian Cunnie
916b501bff Bump Ginkgo v1.16.5 → v2.0.0
Ginkgo v2.0.0 is hot off the press, released yesterday. Let's upgrade!

- `extensions/table` no longer needs to be separately imported
- `BeforeSuite()` must be outermost

fixes:
```
It looks like you are trying to add a [BeforeSuite] node within a container
```
```
imported and not used: "github.com/onsi/ginkgo/v2/extensions/table"
```
```
Entry redeclared during import "github.com/onsi/ginkgo/extensions/table"
```
2021-12-31 11:19:34 -08:00
Brian Cunnie
0f3e790b15 🐞 CI unit tests require etcd
Previously `etcd` wasn't running, causing the integration tests to fail
because they require `etcd`.

We now run `etcd`.

In the future I plan to add the ability to not require `etcd`, to use a
local table of key-value pairs, but I don't plan to test that option in
CI. It'll be for the very few users who use the sslip.io code but not
the  service.

fixes <https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/unit/builds/23>:
```
{"level":"warn","ts":"2021-12-31T01:34:28.089Z","logger":"etcd-client","caller":"v3@v3.5.1/retry_interceptor.go:62","msg":"retrying of unary invoker failed","target":"etcd-endpoints://0xc0001ef340/localhost:2379","attempt":0,"error":"rpc error: code = DeadlineExceeded desc = latest balancer error: last connection error: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\""}

2021/12/31 01:34:28 couldn't GET "dmy-key": context deadline exceeded
```
2021-12-31 11:07:30 -08:00
Brian Cunnie
4a5032997a 🐞 Don't include invisible "d" in k-v.io error msg
We include an invisible "d" in our keys, but we don't want to leak them
to the user (it'll only serve to confuse), so we fix our error messages
to not display them. This code doesn't have coverage, but we don't feel
it's worth the contortions to cover it.

fixes
<https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/unit/builds/23>
(should have been "my-key" not "dmy-key":
```
2021/12/31 17:36:27 couldn't GET "dmy-key": context deadline exceeded
```
2021-12-31 09:48:35 -08:00
Brian Cunnie
a6bf837a49 etcd: include vanilla configuration file
...that we can customize for each of our three DNS servers.

Drive-bys:

- Bumped SOA serial 2021080200 → 2021123100. There's something poetic
  about it being the last day of the year
- Deleted the old PowerDNS configuration. It's so stale there's no point
  in having it. Or mentioning it in the README.
2021-12-30 17:32:38 -08:00
Brian Cunnie
5065229a03 Key-value store domain: kv.sslip.io → k-v.io
I didn't want a really long domain for the key-value store; I wanted a
short, easy-to-remember domain. And it cost $400 for ten years.

Many good domains (e.g. keyvalue.store, kv.io)
were taken, and some weren't easily registered (e.g. the Albanian
domain, keyv.al).

Browsing these domains that were never put into use is like strolling
along the Boulevard of Broken Dreams: high hopes dashed against the hard
rocks of reality.
2021-12-29 19:56:52 -08:00
Brian Cunnie
3066a22f57 Get, Put, and Delete integrated with etcd
Previously we maintained a local table of key-value pairs
(`TxtKvCustomizations`), but this had two drawbacks:

- no persistence: when the server is restarted, all key-value pairs are
  wipe.
- no consistency: the key-value pairs on one server are completely
  orthogonal to the key-value pairs on another.

By using `etcd` to store our KV pairs, we fix both those problems.
2021-12-29 18:40:41 -08:00
Brian Cunnie
ca52c317f0 Bring in etcd support for key-value store
The addition of etcd was enough to inspire me to make a struct (`Xip`)
to hold the important information (source addr, etcd client). That way I
don't have to plumb that information through the hierarchy of function
calls.

Drive-by: fixed a bug in the random-IPv6-address-generator that would,
once in a great while, generate an IPv4 address.
2021-12-27 16:47:51 -08:00
Brian Cunnie
f76218660e TXT records have a 3-minute TTL
When we implement the key-value store, we want new values to propagate
in a reasonable amount of time. Based on no scientific evidence
whatsoever, based solely on "gut feel", I came up with three minutes
(180 seconds).

The previous value was one week. I can't imagine anyone in their right
mind waiting a full week for their key-value to propagate.
2021-12-27 16:47:51 -08:00
Brian Cunnie
33e90546d2 Bump Go dependencies
```shell
rm go.mod go.sum
go mod init xip
go mod tidy
```
2021-12-24 09:56:34 -08:00
Brian Cunnie
d43990ed50 Don't pass pointers
I was uneasy: functions were returning values and mutating arguments
(specifically `response &Response`)--I was mixing meat with dairy, and
the result wasn't kosher.

Now I only return values, and don't mutate.

According to canonical [Go Code Review
Comments](https://github.com/golang/go/wiki/CodeReviewComments#pass-values):

> Don't pass pointers as function arguments just to save a few bytes. If
a function refers to its argument x only as *x throughout, then the
argument shouldn't be a pointer. Common instances of this include
passing a pointer to a string (*string) or a pointer to an interface
value (*io.Reader). In both cases the value itself is a fixed size and
can be passed directly. This advice does not apply to large structs, or
even small structs that might grow.
2021-12-24 09:49:24 -08:00
Brian Cunnie
dd4eb3b426 pipeline: test the servers twice, not ten times
...because I don't want the test to run for an hour when a server is
down, like ns-azure.
2021-12-23 19:37:09 -08:00
Brian Cunnie
30141f1d90 CI: Test key-value store regularly 2021-12-04 10:31:12 -08:00
Brian Cunnie
25ec87feb5 🐞 sslip.io: fix key-value store for GCE
We set the number of replicas to 1 so that when you create a key-value
on `ns-gce.sslip.io`, you're sure of retrieving that value later from
`ns-gce.sslip.io`.

Previously it could hit the other replica, which would have a different
key-value store, which would make the value "disappear".
2021-12-04 10:26:40 -08:00
Brian Cunnie
bd63421c3f BOSH release: 2.3.0: kv.sslip.io key-value store 2.3.0 2021-12-04 08:16:53 -08:00
Brian Cunnie
78722b6887 kv.sslip.io: (key-value) read/write/delete TXTs
We enable special behavior under the `kv.sslip.io` subdomain: it can be
treated as a key-value store, the sub-subdomain being the key, and the
TXT record being the value.

For example, to write ("put") the value "12.0.1" to the key
"macos-version" on the `ns-gce.sslip.io.` nameserver, you'd use the
following `dig` command:

```shell
dig @ns-gce.sslip.io. txt put.12.0.1.macos-version.kv.sslip.io.
```

To read ("get") the value back, you'd write the following `dig` command:

```shell
dig @ns-gce.sslip.io. txt get.macos-version.kv.sslip.io.
```

Since "get" is the default behavior, you don't need to include it in the
domain name:

```shell
dig @ns-gce.sslip.io. txt macos-version.kv.sslip.io.
```

Finally, when you're done with the key-value, you can "delete" it:

```shell
dig @ns-gce.sslip.io. txt delete.macos-version.kv.sslip.io.
```

Notes:

- Keys are case-insensitive (to accommodate DNS convention). In other
  words, `KEY.kv.sslip.io` and `key.kv.sslip.io` return the same TXT
  record.
- Values are case-sensitive. `put.CamelCase.style.kv.sslip.io` sets the
  TXT record to "CamelCase".
- `put` requests will return the TXT record being put; i.e.
  `put.hello.world.kv.sslip.io` returns one TXT record of one string,
  `hello`.
- `delete` requests will return the TXT record being deleted; i.e.
  `delete.world.kv.sslip.io` returns one TXT record of one string,
  `hello`. If the TXT record does not exist, no TXT records will be
  returned.
- Values are limited to 63 bytes to mitigate using the sslip.io servers
  in a [DNS amplification
  attack](https://us-cert.cisa.gov/ncas/alerts/TA13-088A).
- Values are not persistent: if the server is restarted, all values
  disappear. Poof.
- Values are not consistent. If a value is set in `ns-aws.sslip.io`, it
  does not propagate to `ns-gce.sslip.io` nor `ns-azure.sslip.io`.
2021-12-04 07:59:57 -08:00
Brian Cunnie
4ba3516834 DNS server testing: randomize case of domain names
We randomize the case of domain names (previously they were always
lowercase). We hope to surface any case-related errors, but didn't find
any.
2021-11-29 08:51:18 -08:00
Brian Cunnie
b8b4786387 Update ns-aws.sslip.io's HTML assets
i.e.: <https://52-0-56-137.sslip.io/>

Previously I didn't update `index.html` properly because it wasn't
documented, and the content had become stale.
2021-11-28 20:08:52 -08:00
Brian Cunnie
e256241394 Delete pipeline-simple.yml; it's old
This pipeline's only purpose was an asset in a blog post that I wrote a
couple of years ago, and is no longer necessary.

Also, and this sounds petty, but I didn't like the RED on my CI--I'd
like to see as much green as possible. Now my CI is green (with the
exception of the many-colored "badges" pipeline).
2021-11-28 19:50:29 -08:00
Brian Cunnie
2599def6b6 Upgrading (Developer) notes: manually trigger job
Because it's a manual job currently because if it was automatic it'd
trigger & fail because the required executable isn't yet downloadable.
2021-11-28 19:45:14 -08:00
Brian Cunnie
90b94baa29 BOSH release: 2.2.4: Deprecate nono.io nameservers 2.2.4 2021-11-28 13:08:49 -08:00
Brian Cunnie
4c8e7741f1 Use @ns.sslip.io to determine your IP lookup
It makes for simpler instructions than listing the three nameservers &
which ones have IPv6.
2021-11-27 19:03:40 -08:00
Brian Cunnie
61f0ae2ae8 Remove *.nono.io nameservers
They have been replaced by the sslip.io nameservers. I had been meaning
to do this a long time, and nothing like a Thanksgiving weekend to get
long-lingering tasks done.
2021-11-27 18:52:03 -08:00
Brian Cunnie
7ed2107f36 Web page: use sslip.io servers, not nono.io 2021-11-27 18:23:02 -08:00
Brian Cunnie
690e0ad618 New Release Documentation: no more manual Docker images
The Docker images are now created automatically with our pipeline.
That's right: with 80 hours of work we saved 30 seconds of work! We are
nothing if not efficient.
2021-11-27 15:53:44 -08:00
Brian Cunnie
56191a2ef7 HTML: remove the "new software" warning
It's not new after a year. I also updated the version numbers returned
because, well, it makes the website more "fresh".
2021-11-27 12:29:58 -08:00
Brian Cunnie
4e22123114 BOSH release: 2.2.3: Include sslip.io nameservers 2.2.3 2021-11-27 11:35:01 -08:00
Brian Cunnie
fda3baeaaa Add NS servers in sslip.io domain
We currently use three nameservers in the `nono.io` domain, but that's
confusing--why not have the nameservers in the `sslip.io` domain?

This commit starts the ball rolling to convert to the sslip.io. We'll
have a brief period where we have _both_ `nono.io` and `sslip.io`
nameservers.

At which point we'll add the `sslip.io` nameservers to our registrar,
Namecheap.com.

Once they've been added to our registrar, we'll wait a day or two to
propagate, and then we'll delete references to the `nono.io`
nameservers.
2021-11-27 10:50:04 -08:00
Brian Cunnie
992458f67c simple pipeline: use default branch, not master
...especially since I recently switched from `master` to `main` on
sslip.io's repo.

Also I got rid of the Concourse groups, which I don't like at all. And I
added some pretty icons to the resources.
2021-11-26 20:46:37 -08:00
Brian Cunnie
2c4a60e315 sslip.io pipeline: use default branch, not master
...especially since I recently switched from `master` to `main` on
sslip.io's repo.

Also I got rid of the Concourse groups, which I don't like at all. And I
added some pretty icons to the resources.
2021-11-26 20:41:39 -08:00
Brian Cunnie
ab33ada856 🐞 Simple Pipeline: don't try to run YAML booleans
fixes:
```
error: error unmarshaling JSON: while decoding JSON: malformed task step: json: cannot unmarshal bool into Go struct field TaskRunConfig.config.run.path of type string
```
2021-11-24 09:13:20 -08:00
Brian Cunnie
854d8e8c1b Spec: test ip.sslip.io
Also, change the order of `dig` arguments so that the server being
queried is first (e.g. `@#{whois_nameserver}`) and the arguments (e.g.
`+short`), is last.
2021-11-05 08:10:39 -07:00
Brian Cunnie
1d4e1af656 Production test: all servers run same version 2021-11-02 05:02:46 -07:00
Brian Cunnie
9dd1a78447 Dockerfile cunnie/sslip.io-dns-server: bump 2.2.1 → 2.2.2
Also, remove redundant "attach binaries", and change the order in which
the Dockerfile is updated.
2021-11-01 07:53:50 -07:00
Brian Cunnie
eed67fdf4d BOSH release: 2.2.2: ip.sslip.io TXT returns IP
Our documentation was wrong; our homepage said to get the origin IP
address by querying the TXT record of the root, i.e. `dig
@ns-aws.nono.io txt . +short`; however, our code worked differently: it
returned the origin IP when the `.ip` TLD was queried.

The new behavior is that it returns the origin IP when `ip.sslip.io.` is
queried, and the documentation now reflects that behavior.

Also, that behavior is marked "experimental" to give us leeway to
change.

[fixes #11]
2.2.2
2021-11-01 07:24:54 -07:00
Brian Cunnie
e133149beb New release instructions include updating k8s 2021-10-06 10:52:42 -07:00
Brian Cunnie
0be7d1c628 Dockerfile cunnie/sslip.io-dns-server: bump 2.2.0 → 2.2.1 2021-10-06 10:40:59 -07:00
Brian Cunnie
d778192ec8 Bump BOSH Release vendored Golang 2021-10-06 10:28:32 -07:00
Brian Cunnie
259da8bfb8 Docs: tweak new release instructions 2021-10-06 10:27:54 -07:00
Brian Cunnie
8ce23653bb BOSH release: 2.2.1: version.sslip.io TXT
- Returns version information for DNS server
- Contains 3 strings:
  - Semantic version, e.g. "2.2.1"
  - Date of compilation
  - Latest git hash

Note: the BOSH Release will have a different compilation date &
different git hash than the released executables; the semantic version
will be the same.
2.2.1
2021-10-06 05:16:46 -07:00
Brian Cunnie
f1f66a0f3b dig txt version.sslip.io returns version
I needed a way of determining the version that a server was running. I
orginally considered a command-line argument, but then I thought, "Why
not create a DNS record for it? That way I can query running servers
without needing to ssh onto the machine."

The TXT record consists of three distinct strings: version, compile
date, and git hash.

```bash
dig txt version.sslip.io +short
    "2.2.1"
    "2021/10/03-15:08:54+0100"
    "6a928eb"
```
2021-10-03 15:34:52 +01:00
Brian Cunnie
c74792b588 🐞 Integration tests work properly on slow machines
The integration tests were failing on my laptop.

As a side note, it's interesting that a 2013 desktop is almost three times
faster than a 2020 laptop. Sic transit gloria mundi.

Drive-by: I removed a `JustBeforeEach()` clause that wasn't being used,
and removed a comment that no longer applied (we no longer need to stop
`systemd-resolved`)
2021-10-03 13:46:20 +01:00
Brian Cunnie
502a6901cc Website: grammar fix, clarification 2021-09-15 11:04:07 -07:00
Brian Cunnie
90926d3bdf VMware employees can't get the wildcard
The wildcard is expiring, and I'm loath to spend something renewing
something I don't use, so I'll let it lapse.

(I use Let's Encrypt).
2021-09-15 10:57:13 -07:00
Brian Cunnie
11c6d7d95f 🐞 return source IP for TXT when "ip." or "xx.ip."
...instead of say, ".pip."

drive-by: cleaned up the English
2021-08-03 16:49:24 -07:00
Brian Cunnie
d5d8bb4f12 DNS: "ip." TXT queries return source IP
...and also prints an SOA log message if there is no TXT customization.

drive-bys:

- bump the SOA's serial
2021-08-03 16:06:25 -07:00
Brian Cunnie
ebbcb744c6 🐞 Skip IPv6 test when IPv4-only, REALLY
This time it's fixed for sure.

I should have tested the previous commit before I pushed it. Or I could
have re-written the git history to make a complete commit, but as an
exercise in humility I decided to allow my mistakes to be seen.

fixes: <https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/unit/builds/6>
```
dig: couldn't get address for '::1': address family not supported
```
2021-07-27 11:44:04 -04:00
Brian Cunnie
cdeb5a8768 🐞 Skip IPv6 test when IPv4-only
Our unit tests have been failing on our IPv4-only containers because one
of the tests forces a lookup from the (non-existent) IPv6 loopback
interface.

Now we first test to make sure such an interface exists by using
`ping6`. Corner-case: In the event that `ping6` is not on the machine
where the tests are run, but that machine has an IPv6 loopback
interface, that test will be mistakenly skipped. Big deal.

fixes: <https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/unit/builds/4>
```
dig: couldn't get address for '::1': address family not supported
```
2021-07-27 06:25:29 -04:00