diff --git a/docs/server-setup.md b/docs/server-setup.md index fb335a3..8f34dc9 100644 --- a/docs/server-setup.md +++ b/docs/server-setup.md @@ -39,18 +39,34 @@ Check propagation (repeat until it prints the server IP): local$ dig +short git.vienalatina.com ``` -### 1.1 A second domain that leads here +### 1.1 The other two domains -`vielac.at` is where the WordPress site this project replaced used to live, and -it redirects: everything that arrives goes to the same path on vienalatina.com, -where the 301s for old WordPress paths catch it. Pointing it here is also what -takes the last traffic off the old box. Two A records in that domain's **zone -editor**, both at the server: +`vielac.at` is where the WordPress site this project replaced used to live; +`vienalatina.net` is the .com's sibling. Both redirect: everything that arrives +goes to the same path on vienalatina.com, where the 301s for old WordPress paths +catch it. Pointing them here is also what takes the last traffic off the old box. -| Name | Type | Value | TTL | +In **each** of those two zones, four rows change and **nothing else**: + +| Name | Type | Was | Becomes | |---|---|---|---| -| `@` | A | `` | 300 | -| `www` | A | `` | 300 | +| `@` | A | the old box | ``, TTL 300 | +| `www` | A | the old box | ``, TTL 300 | +| `@` | AAAA | the old box's IPv6 | **deleted** | +| `www` | AAAA | the old box's IPv6 | **deleted** | + +**The AAAA rows are the trap.** A browser with IPv6 prefers it to IPv4, so +leaving them behind means the A records change, the old site keeps appearing, +and nothing on screen explains why. Delete them unless this server has an IPv6 +address of its own (`ip -6 addr show scope global`), in which case use that. + +**Leave the mail rows exactly as they are** — `MX`, the four `SRV`s, `CNAME +autoconfig`, the SPF `TXT`, and the DKIM `TXT` that vienalatina.net carries. +They point at Hetzner's mail server and have nothing to do with which machine +serves the website. **And never copy** `NS` or `SOA` between zones (every zone +has its own), nor the `ci` and `git` A rows, which are vienalatina.com +subdomains with their own site blocks: a `git.vielac.at` would resolve here, +find no block, and fail the TLS handshake. **Not the nameserver page.** On Hetzner's Konsole H those fields hand the whole zone to another provider's DNS, which is a different thing entirely and turns @@ -78,13 +94,17 @@ sudo systemctl reload caddy between a typo in that file and vienalatina.com going down with it. ```sh -curl -sI https://vielac.at/ | head -3 # 301 → vienalatina.com -curl -sI https://www.vielac.at/page/agenda/ | grep -i location # the path survives -curl -sI https://vienalatina.com/ | head -1 # 200, unchanged +dig +short vielac.at A vienalatina.net A # both: this server +dig +short vielac.at AAAA vienalatina.net AAAA # nothing at all +curl -sI https://vielac.at/ | head -3 # 301 → vienalatina.com +curl -sI https://www.vienalatina.net/page/agenda/ | grep -i location # the path survives +curl -sI https://vienalatina.com/ | head -1 # 200, unchanged +dig +short vienalatina.com MX # mail, still answering ``` -The third is the one that matters. A Caddyfile edit that breaks the site it was -meant to leave alone is the failure this ordering exists to prevent. +The last two are the ones that matter. A Caddyfile edit that breaks the site it +was meant to leave alone, or a DNS session across three zones that takes the +mailbox with it, are the two failures this ordering exists to prevent. ## 2. First login + basic hardening diff --git a/infra/caddy/Caddyfile b/infra/caddy/Caddyfile index aaf422a..9de4491 100644 --- a/infra/caddy/Caddyfile +++ b/infra/caddy/Caddyfile @@ -21,23 +21,25 @@ www.vienalatina.com { redir https://vienalatina.com{uri} 301 } -# The old site's own domain. vielac.at is where the WordPress install this -# project replaced used to live — it is the address in every link shared before -# the cutover, in every search result that has not been recrawled, and in the -# bookmarks of everybody who read it. +# The other names the association answers to. vielac.at is where the WordPress +# install this project replaced used to live — it is the address in every link +# shared before the cutover, in every search result not yet recrawled, and in +# the bookmarks of everybody who read it. vienalatina.net is the .com's sibling. # -# Both spellings in one block, and 301 rather than 302: a permanent redirect is -# what makes a search engine fold the two names into one site instead of -# indexing them as duplicates of each other, and what makes a browser stop -# asking after the first visit. `{uri}` carries the path, so a link somebody -# shared to vielac.at/page/agenda/ lands on the agenda rather than on the home -# page — and an old WordPress path arrives at vienalatina.com and is caught by -# the 301s further down, which is one set of rules rather than two. +# All four spellings in one block, and 301 rather than 302: a permanent redirect +# is what makes a search engine fold them into one site instead of indexing four +# copies of each other, and what makes a browser stop asking after the first +# visit. `{uri}` carries the path, so a link somebody shared to +# vielac.at/page/agenda/ lands on the agenda rather than on the home page — and +# an old WordPress path arrives at vienalatina.com and is caught by the 301s +# further down, which is one set of rules rather than three. # -# Caddy asks Let's Encrypt for this certificate the first time the name -# resolves to this server, so the A records go in before this file is reloaded. -# Until they do, the block is harmless: nothing reaches it. -vielac.at, www.vielac.at { +# Caddy asks Let's Encrypt for each certificate the first time that name +# resolves to this server, so this block can be deployed while the names still +# point elsewhere: nothing reaches it until they move, and when they do the +# certificate is fetched on the first request rather than after a second trip +# to the server. +vielac.at, www.vielac.at, vienalatina.net, www.vienalatina.net { redir https://vienalatina.com{uri} 301 }