Commit Graph

580 Commits

Author SHA1 Message Date
Brian Cunnie
b9130c130a Leave a TODO breadcrumb for IDNA2008
If I ever want to make sure the results are IDNA2008-compliant, I'll
know which test to start with.

One of the things that held me back was that I couldn't find a spec for
what constitutes IDNA2008 compliance.

[#30]
2023-08-12 13:44:30 -07:00
Brian Cunnie
fd1665120e Update GKE node public IP addrs (etcd.pem) 2023-08-12 12:33:00 -07:00
Brian Cunnie
431cac2692 Fuzz-test the IPv6 PTR integration tests
This commit introduces fuzz-testing for the PTR lookups' integration
test.

This commit does NOT successfully surface the following error condition.
In that sense, this commit is a failure:
```
/usr/bin/dig @ns.sslip.io -x ::11b7:bf0a:0:0:d410 +short
  /usr/bin/dig: '--11b7-bf0a-0-0-d410.sslip.io.' is not a legal IDNA2008 name (string start/ends with forbidden hyphen), use +noidnout
```

- moves helper functions for test into a separate package,
  `xip/testhelper`.
- uses `dig`'s `-x` flag to make PTR lookup tests more readable, e.g.
  `dig -x ::1`

This IDN complaint has at least one related commit
([06f1556](06f1556699)).

[#30]
2023-07-12 11:45:57 -04:00
Brian Cunnie
2f9c75891d Bump dependencies go get -u -t; go mod tidy 2023-07-12 07:06:21 -04:00
Brian Cunnie
549d6713b8 Update GKE node public IP addrs (etcd.pem) 2023-07-10 06:21:38 -04:00
Brian Cunnie
92531f9460 Update GKE node public IP addrs (etcd.pem) 2023-06-02 08:14:30 -07:00
Brian Cunnie
55fc17559f Concourse: docker-image → registry-image
This allows our Concourse CI to pull the new multi-platform OCI Docker
images instead of pulling very stale, old Docker images.

Fixes, from <https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/unit/builds/97>:
```
Ginkgo detected a version mismatch between the Ginkgo CLI and the version of Ginkgo imported by your packages:
  Ginkgo CLI Version:
    2.5.0
  Mismatched package versions found:
    2.8.4 used by sslip.io-dns-server, xip
```
2023-04-18 08:56:31 -07:00
Brian Cunnie
2356dbb451 Remove key-value from sslip.io home page
We've removed the key-value feature, so there's no need to describe them
on the home page. I also updated the examples.
2023-03-15 13:58:35 -07:00
Brian Cunnie
fb755b89a1 Update SOA to the Ides of March (3/15)
"Beware the ides of March."

William Shakespeare, _Julius Caesar_, Act 1, Scene 2

I should have bumped the SOA _before_ I cut release 2.7.0.
2023-03-15 13:53:50 -07:00
Brian Cunnie
463071ff90 Pipeline: DNS servers are tested against HEAD
...instead of latest release. This happens, for example, if I didn't fix
the specs before rolling out a new release. I may change this back in
the future.
2023-03-14 10:56:53 -04:00
Brian Cunnie
3e688e61de dns-servers test: remove key-value tests
We are no longer doing key-value-over-DNS.

Fixes <https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/dns-servers/builds/1097>
```
rspec './spec/check-dns_spec.rb[1:17:1]' # sslip.io k-v.io tested on the ns-aws.sslip.io. nameserver sets a value, 1678804743, on the key sslipio-spec.k-v.io
rspec './spec/check-dns_spec.rb[1:17:2]' # sslip.io k-v.io tested on the ns-aws.sslip.io. nameserver gets the newly-set value, 1678804743, from the key, sslipio-spec.k-v.io
rspec './spec/check-dns_spec.rb[1:33:1]' # sslip.io k-v.io tested on the ns-azure.sslip.io. nameserver sets a value, 1678804743, on the key sslipio-spec.k-v.io
rspec './spec/check-dns_spec.rb[1:33:2]' # sslip.io k-v.io tested on the ns-azure.sslip.io. nameserver gets the newly-set value, 1678804743, from the key, sslipio-spec.k-v.io
rspec './spec/check-dns_spec.rb[1:49:1]' # sslip.io k-v.io tested on the ns-gce.sslip.io. nameserver sets a value, 1678804743, on the key sslipio-spec.k-v.io
rspec './spec/check-dns_spec.rb[1:49:2]' # sslip.io k-v.io tested on the ns-gce.sslip.io. nameserver gets the newly-set value, 1678804743, from the key, sslipio-spec.k-v.io
```
2023-03-14 10:40:04 -04:00
Brian Cunnie
1cf277c706 🐞 Tweak
Fixes, `fly trigger-job ...`:
```
error: resource not found
```
Fixes, `kubectl logs ...`:
```
flag provided but not defined: -etcdHost
Usage of /usr/sbin/sslip.io-dns-server:
```
2023-03-13 19:56:56 -04:00
Brian Cunnie
451ad0ef5f 2.7.0: remove key-value store 2.7.0 2023-03-13 16:46:20 -04:00
Brian Cunnie
a62a797fe5 Disable DNS-backed key-value store
I'm disabling the key-value store because no one was using it.

There are other reasons, too:

- The removal of the `etcd` library dropped the executable size by over
  half from 17MB to 7MB
- I didn't want users who've deployed it internally to be "surprised" by
  unexpected key-value features
- Key-value-over-DNS has a seamy side to it: "data exfiltration". I know
  there are legitimate uses for it, but I've come to believe that a
  Key-value-over-HTTP solution is preferable because it's not only more
  legitimate but also because it eliminates the DNS caching problem.
2023-03-13 16:44:30 -04:00
Brian Cunnie
326b717eb7 Bump dependencies go get -u -t 2023-02-28 17:41:38 -08:00
Brian Cunnie
e858c69248 Google Analytics: switch from UA to GA4
From
<https://support.google.com/analytics/answer/10759417>:

> Google Analytics 4 is replacing Universal Analytics. On July 1, 2023
all standard Universal Analytics properties will stop processing new
hits.

I wonder if Google Analytics is worth the trouble.
2023-02-05 17:52:56 -08:00
Brian Cunnie
7fa7a51453 Better etcd instructions when GKE re-IPs 2023-01-27 06:47:38 -08:00
Brian Cunnie
1ac38b2544 etcd.pem has updated GKE node public IP addrs
Fixes:
```
Jan 26 21:17:42 ns-aws etcd[508]: rejected connection from "34.121.219.144:39244" (error "tls: \"34.121.219.144\" does not match any of DNSNames [\"ns-aws.sslip.io\" \"ns-azure.sslip.io\" \"ns-gce.sslip.io\" \"ns-aws\" \"ns-azure\" \"ns-gce\"] (lookup ns-gce: Temporary failure in name resolution)", ServerName "ns-aws.sslip.io", IPAddresses ["127.0.0.1" "52.0.56.137" "52.187.42.158" "104.155.144.4" "34.71.136.235" "104.198.25.221" "35.223.15.132" "::1" "2600:1f18:aaf:6900::a"], DNSNames ["ns-aws.sslip.io" "ns-azure.sslip.io" "ns-gce.sslip.io" "ns-aws" "ns-azure" "ns-gce"])
```
2023-01-27 05:58:16 -08:00
Brian Cunnie
81dde02fdc Bump dependencies go get -u -t
Fixes:
```
Ginkgo detected a version mismatch between the Ginkgo CLI and the version of Ginkgo imported by your packages:
```
2023-01-11 14:12:19 -08:00
Brian Cunnie
a6defe5d33 Log executable path, version when starting 2023-01-11 14:04:21 -08:00
Brian Cunnie
94e0bb7abd 🐞 k8s deployment: flag is -quiet not quiet
This one cost me, in Google Cloud, $21.63. Sigh.
2023-01-02 13:58:08 -08:00
Brian Cunnie
0623523a6d Wildcard certs: show people an easier way 2022-12-11 18:21:17 -08:00
Brian Cunnie
0fdb9f27bc Dockerfile: deprecate custom registry-image
Now that we're on Concourse 7.9, we no longer need the custom Concourse
registry-image resource, so we use the stock resource instead.
2022-12-11 18:00:16 -08:00
Stefan Sundin
c2f4b9c80c Update module path. 2022-12-07 06:34:46 -08:00
Stefan Sundin
29a8ba0777 Fix broken links. 2022-12-07 06:34:46 -08:00
Brian Cunnie
2422c73a1b 🐞 k8s: DNS server args are args, not command
Fixes, when `kubectl describe pod sslip.io-xxx-yy`:

> Warning  Failed     72s (x4 over 113s)  kubelet            Error:
failed to create containerd task: failed to create shim task: OCI
runtime create failed: runc create failed: unable to start container
process: exec: "-etcdHost": executable file not found in $PATH: unknown
2022-11-27 06:53:39 -08:00
Brian Cunnie
37e4ab7537 🐞 GKE deployment saves $$ by not logging so much
Also, it uses the new ENTRYPOINT instead of the old CMD.
2022-11-26 18:42:16 -08:00
Brian Cunnie
8052a84428 🐞 Docker build fails when curl fails
Our CI sometimes builds "broken" docker images because it fails
downloading the proper executable (because I haven't populated the
GitHub release yet).

I'd like it to fail rather than publish broken images.

Fixes, during `docker run -it --rm cunnie/sslip.io-dns-server`:
```
exec /usr/sbin/sslip.io-dns-server: exec format error
```
2022-11-26 18:39:30 -08:00
Brian Cunnie
036b7a0c3a Instructions for fixing GKE's etcd's certs
...because they're so volatile. It's super annoying.
2022-11-26 17:18:23 -08:00
Brian Cunnie
513ef81acb etcd.pem has updated GKE node public IP addrs
Fixes:
```
Nov 26 16:50:36 ns-aws etcd[508]: rejected connection from "35.223.15.132:56234" (error "tls: \"35.223.15.132\" does not match any of DNSNames [\"ns-aws.sslip.io\" \"ns-azure.sslip.io\" \"ns-gce.sslip.io\" \"ns-aws\" \"ns-azure\" \"ns-gce\"] (lookup ns-gce: Temporary failure in name resolution)", ServerName "ns-aws.sslip.io", IPAddresses ["127.0.0.1" "52.0.56.137" "52.187.42.158" "104.155.144.4" "34.123.7.26" "34.121.225.254" "34.70.136.153" "::1" "2600:1f18:aaf:6900::a"], DNSNames ["ns-aws.sslip.io" "ns-azure.sslip.io" "ns-gce.sslip.io" "ns-aws" "ns-azure" "ns-gce"])
```
2022-11-26 16:50:15 -08:00
Brian Cunnie
776fe532ce 2.6.2: -quiet suppresses logs for each query 2.6.2 2022-11-26 13:55:38 -08:00
Brian Cunnie
e997cd9ec9 Remove testing tool "counterfeiter"
In spite of good intentions, I never used Max Brunsfeld's Counterfeiter;
Counterfeiter is good for unit tests, but I've pivoted to using mostly
integration tests.

I took the opportunity to update `go.mod`:

```bash
rm go.mod go.sum
go mod init xip
go mod tidy
```
2022-11-26 13:29:38 -08:00
Brian Cunnie
faefad2413 Bump serial 2022110900 → 2022112600
...as a prelude to cutting a new release.
2022-11-26 13:19:49 -08:00
Brian Cunnie
c3335aae28 DNS server Dockerfile: CMD → ENTRYPOINT
`ENTRYPOINT` [is more appropriate](https://codewithyury.com/docker-run-vs-cmd-vs-entrypoint/):

> ENTRYPOINT configures a container that will run as an executable

Which is exactly how I think the container should work for new people.
Yes, I'm screwing over the existing users. Sorry.
2022-11-26 11:38:56 -08:00
Brian Cunnie
0a95fe872f -quiet suppreses logging
Google Cloud Plaatform (GCP) charged me $17.69 last month for "Cloud
Logging" which consumed 84.74 GiB.

At an average of 51.2 queries/second, and each log line
averaging 192 bytes, and 60*60*24*30 seconds/month, this works out to
25,480,396,800 bytes (23.73 GiB), which works out to a monthly savings of
$4.95 if I use the `-quiet` flag.

However, it seems that my saving would be even more because when I
visually browse the logs, at least ⅔ are from sslip.io logging.

I have *no* idea where all the other logs are coming from.
2022-11-25 18:58:06 -08:00
Brian Cunnie
9681b6a4f0 README's IPv6 address has :0100: instead of 💯
...because it's super-annoying to have an IPv6 address with a "💯" in
the middle of it.

Also did some minor tweaks to the README.
2022-11-13 17:44:05 -08:00
Brian Cunnie
cfb83cb301 README tweaks
- Move "Directory Structure" lower down--it's not terribly useful,
  certainly less useful than the "DNS Server" section.
- Remove the "tidy" turd at the bottom of the page. It adds no value,
  and I'm not sure how it got there in the first place.
- A specific sections for flags such as `-nameservers`
- Add a section about running official Docker containers.
- get rid of the old, deprecated "faq" and "about" pages

[#21]
2022-11-12 17:51:19 -08:00
Brian Cunnie
cf650f3824 Dockerfile pipeline: build using HEAD, not tag
This change allows me to build new versions of the Docker images without
forcing me to create a gratuitous release merely for that purpose.

In this specific case, I had neglected to have `curl` follow redirects
(`-L`), thus the Docker images created were missing the sslip.io DNS
server.

On the downside, it's possible that the *nginx* Docker containers are
built with content/features that haven't been released yet, but I'm
willing to run that risk.
2022-11-11 14:35:50 -08:00
Brian Cunnie
c14d08c2fd 🐞 Dockerfile: download DNS server properly
I had neglected to account for the 302 redirect.

Fixes, during `docker run -it --rm cunnie/sslip.io-dns-server`:
```
exec /usr/sbin/sslip.io-dns-server: exec format error
```

Drive-by: removed a Dockerfile left over from testing the creation of
multi-platform (x86_64, ARM64) Docker images.
2022-11-11 14:27:53 -08:00
Brian Cunnie
262a1e0ea1 2.6.1: -addresses flag enables custom addresses 2.6.1 2022-11-11 10:48:37 -08:00
Brian Cunnie
2ad8ef059a 🐞 Eliminate flaky test failures
Integration tests would fail approximately 11% of the time (4/35) when
run in parallel (on my 8-core MacBook Air). The fix was to lengthen the
amount of time (1ms → 2ms) a port was held to make sure it was really,
truly free. After change, the tests ran 32 times without a failure.

Fixes, during `ginkgo -r -p --until-it-fails .`
```
I couldn't bind to any IPs on port 1974, so I'm exiting
...
  Waiting for:
      Ready to answer queries
  In [JustBeforeEach] at: /Volumes/workspace/sslip.io/src/sslip.io-dns-server/integration_flags_test.go:28 @ 11/11/22 10:38:02.045
```
2022-11-11 10:48:37 -08:00
Brian Cunnie
dace3a8491 🐞 Reliably bind to individual IP addresses
Previously, when binding to individual IP addrs, the last address bound
is a failure. In that case, it exposes a bug in the code which attempts
to read from a non-functional *UDPConn.

This commit fixes that by only attempting to read after a successful
bind.

Fixes, during start-up:
```
2022/11/11 07:32:44 I couldn't bind to "0.0.0.0:53" (INADDR_ANY, all interfaces), so I'll try to bind to each address individually.
2022/11/11 07:32:44 I bound to the following IPs: "127.0.0.1:53", "[::1]:53", "10.11.0.4:53", "[fc00:11::4]:53"
2022/11/11 07:32:44 I couldn't bind to the following IPs: "fe80::20d:3aff:fec7:4a3"
2022/11/11 07:32:44 Ready to answer queries
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x52e1bd]

goroutine 1 [running]:
net.(*UDPConn).readFromUDP(0x104a880?, {0xc000364800?, 0x0?, 0x4eff80?}, 0xc000080050?)
	/opt/homebrew/Cellar/go/1.19.3/libexec/src/net/udpsock.go:146 +0x1d
net.(*UDPConn).ReadFromUDP(...)
	/opt/homebrew/Cellar/go/1.19.3/libexec/src/net/udpsock.go:141
main.readFrom(0x0, 0x17?, 0xc00023c200)
	/Users/cunnie/workspace/sslip.io/src/sslip.io-dns-server/main.go:94 +0x9f
main.main()
	/Users/cunnie/workspace/sslip.io/src/sslip.io-dns-server/main.go:86 +0x645
```
2022-11-11 10:48:37 -08:00
Brian Cunnie
9403e8ebb9 Bump serial 2022071400 → 2022110900
...as a prelude to cutting a new release.
2022-11-09 14:56:38 -08:00
Brian Cunnie
b68bac4dbe Documentation for the new -addresses flag 2022-11-09 14:46:46 -08:00
Brian Cunnie
121103ae03 New flag: -addresses allows customizing IP records
Previously if you wanted to customize the IP addresses, you had to
modify the code. This commit allows you to pass the IP addresses on the
command line, comma-separated, "host=ip", e.g.

```
go run main.go -addresses ns-aws.sslip.io.=52.0.56.137,ns-aws.sslip.io.=2600:1f18:aaf:6900::a,ns-gce.sslip.io.=104.155.144.4
```

This works well in conjunction with the `-nameservers` flag. Indeed, you
could say that this is a pre-requisite of the `-nameservers` flag, for
what is the point of setting a nameserver if you can't set its IP
address?

- The default values for `-addresses` are the originally-hardcoded
  values (e.g. sslip.io, ns-aws.sslip.io, k-v.io, etc.)
- Both IPv4 & IPv6 addresses work
- This is mostly tested through integration tests rather than unit
  tests; I prefer integration tests in general. They are very assuring.
- A few of the unit tests depended on the hard-coded addresses; I have
  removed/modified the tests to accommodate the new behavior
- Today I learned that IPv4 addresses are in the last 4 bytes, not the
  first four. Also that IPv4 addresses qualify as IPv6 addresses, so
  adjust your code accordingly.
2022-11-09 13:55:12 -08:00
Brian Cunnie
4d49a211f5 🐞 Ginkgo mismatch doesn't sabotage unit tests
- bump dependencies
- finer-grained testing:
  - unit tests are always run against main branch's HEAD
  - Docker files, DNS server test are run against the latest tagged
    release (which is what's deployed on the production servers)

```shell
go get -u -t
```

Helps address
<https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/unit/builds/39>:

```
Ginkgo detected a version mismatch between the Ginkgo CLI and the version of Ginkgo imported by your packages:
  Ginkgo CLI Version:
    2.4.0
  Mismatched package versions found:
    2.1.4 used by sslip.io-dns-server, xip
...
Output from proc 1:
  flag provided but not defined: -ginkgo.grace-period
```
2022-11-09 08:41:03 -08:00
Brian Cunnie
6b6549b70a Build sslip.io Dockerfiles for both ARM64 & AMD64
...because, hey, I have a Mac, and native is about 10x faster than amd64
emulation. Also because it's cool.

I had to compile my own version of Concourse's
[`registry-image`](https://github.com/concourse/registry-image-resource)
container image because the one shipped with Concourse 7.8.3 is old and
doesn't have the multi-platform feature:

```
docker build --build-arg base_image=ubuntu -t cunnie/registry-image -f dockerfiles/ubuntu/Dockerfile
```

Switch Alpine → Fedora to address weird connection issue:

```
 > [linux/arm64 3/3] RUN wget https://github.com/cunnie/sslip.io/releases/download/2.6.0/sslip.io-dns-server-linux-arm64     -O /usr/sbin/sslip.io-dns-server;   chmod 755 /usr/sbin/sslip.io-dns-server:
Connecting to github.com (192.30.255.113:443)
wget: error getting response: Connection reset by peer
```

[#21]
2022-11-08 06:07:40 -08:00
Brian Cunnie
97246b869f Dockerfiles are built with _tagged_ commits
If the commit is tagged, then the release is solid, and we can build our
Dockerfiles.

Previously the Dockerfiles were built with every change. Now that I'm
making Dockerfiles first-class citizens ("Official Docker Images"), we
need discipline when building them.

[#21]
2022-10-14 17:30:50 -07:00
Brian Cunnie
b8c46a98ab Bump dependencies go get -u -t
Drive-by: use HTTPS instead of SSH when cloning because not everyone
will have an ssh agent.
2022-10-12 17:10:42 -07:00
Brian Cunnie
bf9904fed0 Dockerfile pipelines are in this repo
...not in the "deployments" repo. It makes more sense to have them here.

[#21]
2022-09-06 20:33:43 -07:00