Compare commits

...
2 Commits
Author SHA1 Message Date
Andrew Beveridge ☄️andClaude Opus 5.5 c5a2d55148 fix(ci): bake the latest actions/runner into runner images (v2.336.0 deprecated) (#1277)
## Problem
GitHub deprecated actions/runner **v2.336.0**, which is baked into every
`gha-runner-*` image. Each ephemeral JIT runner boots, logs `Runner
version v2.336.0 is deprecated and cannot receive messages`, and
self-halts. All self-hosted jobs (GPU, Windows GPU) sit `queued`; the
runner manager keeps re-dispatching VMs for 60 min per job. Found while
python-audio-separator#322's GPU integration jobs sat queued for over an
hour. Same failure as the 2026-05-24 incident in
`docs/EPHEMERAL-GHA-RUNNERS.md`.

## Fix
- `runner-image-provision.sh` / `.ps1`: resolve the latest release from
the GitHub API at bake time; fall back to a pinned `2.338.2` (current
latest) if the API is unreachable. The monthly rebuild then keeps images
current, so a stale pin can't recur.
- Legacy `compute/startup_scripts/github_runner*.sh` pins bumped to
2.338.2.
- Doc gotcha updated.

After merge: dispatch `build-runner-images.yml` (`variants=all`; it runs
on GitHub-hosted runners).

No local CodeRabbit review was run (urgent CI-infra fix), so no ignore
line: the bot reviews this.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_012RYLVShET9ok7gmSkzEAna

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Chores**
* Updated the GitHub Actions runner version used by startup scripts to
2.338.2.
* Runner image builds now select the latest GitHub release when
available and use 2.338.2 if the lookup fails or returns an invalid
version.
* **Documentation**
* Clarified how runner versions are selected during image builds,
including the fallback version.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 00:57:47 +00:00
Andrew Beveridge ☄️andClaude Opus 5.5 3c3de4653a infra(cloudflare): harden email auth (DMARC reporting, parked-domain reject, stale sender records) (#1276)
## What

Email-auth hardening for all 5 Nomad zones. The trigger was a phishing
email forged as nomadkaraoke.com that came back as a backscatter bounce
on 2026-11-26. Sender inventory and rollout plan: workspace
`docs/EMAIL-AUTH.md`.

- **Reporting:** every `_dmarc` now sends `rua` to `dmarc@beveridge.uk`
(Andrew's dmarc-monitor, which sends ntfy alerts) and to the zone's own
Cloudflare DMARC Management prefix. DMARC Management was off on every
zone. nomadkaraoke.com's old prefix was probably issued under the
pre-split personal account, which would explain why no reports ever
showed up. karaokehunt.com had no rua at all.
- **Parked domains** (no mail sent): nomadkaroke.com, kjbox.cc and
kjtip.me are now `p=reject` with SPF `-all`.
- **Removed dead senders:** SendGrid u58424611 (0 API requests since May
2026) and SMTP2GO (retired before 2025).
- **Unchanged:** nomadkaraoke.com and karaokehunt.com stay `p=none` /
`~all` until reports show Postmark and Kit passing aligned (review
around 2026-12-08). `support.shop.*` (Fourthwall) is untouched.

## Status

**Already applied** with `pulumi up` (4 created, 4 updated, 11 deleted).
A `pulumi preview --refresh` afterwards showed 128 unchanged. Every
record was checked with `dig @1.1.1.1`. Postmark DKIM and `pm-bounces`
still resolve.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_012RYLVUnVFq721cyJc5YhLW

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Email Authentication**
* Updated DMARC reporting addresses and policies for several domains,
including a stricter reject policy for one domain.
* Added SPF and DMARC policies to two parked domains to reject
unauthorized email.
  * Removed several legacy email-service DNS records.

* **Documentation**
* Updated the DNS inventory and clarified DMARC Management behavior,
setup order, and reporting-address requirements.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 00:00:57 -05:00
7 changed files with 73 additions and 79 deletions

No files matched your search

+5 -2
View File
@@ -494,8 +494,11 @@ Savings realised: ~$220/mo (7×200GB pd-ssd at $32/mo each).
<https://github.com/actions/runner/releases/latest>, then re-run
`build-runner-images.yml` (workflow_dispatch — runs on GitHub-hosted runners, so
it's not blocked by the broken self-hosted ones). The monthly rebuild cron
(`0 2 1 * *`) is too slow vs. GitHub's deprecation pace — consider resolving
"latest" at build time and/or alerting on deprecation 403s.
(`0 2 1 * *`) alone was too slow vs. GitHub's deprecation pace. **Recurred
2026-11-29** (v2.336.0 deprecated; GPU integration jobs queued for hours). Since
then the bake scripts resolve the latest release from the GitHub API at build
time and only fall back to the pinned `RUNNER_VERSION_FALLBACK`, so the monthly
rebuild keeps images current. If it happens again, just re-run the build workflow.
* **Source-bundle replacement doesn't auto-redeploy the Cloud Function** (fixed
forward, but worth knowing). The original code uploaded a new source bundle
via `BucketObject` replace, but the `cloudfunctionsv2.Function` resource
+8 -1
View File
@@ -13,7 +13,7 @@ only app-specific stacks (e.g. karaoke-decide's Cloud Run + its API-proxy Worker
| Module | Resources |
|---|---|
| `zones.py` | The 5 zones (**protected**) and the `ssl` mode of each |
| `dns.py` | 84 DNS records across all zones (exclusions below) |
| `dns.py` | 76 DNS records across all zones (exclusions below), including every zone's SPF/DMARC. Who may send mail as Nomad domains, and the DMARC rollout state, are in the workspace's `docs/EMAIL-AUTH.md` |
| `rulesets.py` | Zone ruleset entrypoints: dynamic redirects (all zones), config settings + origin rules (nomadkaraoke.com: flacfetch), karaokehunt.com's custom WAF rule |
| `email_routing.py` | Gmail destination address; Email Routing enablement (**protected**), catch-all and `google@` rules for nomadkaraoke.com, nomadkaroke.com, karaokehunt.com |
| `tunnels.py` | `nomad-kjbox` (NomadPC: sing, kjbox, kjssh, kjvnc) and `nomad-hf2` (fiverrbot) tunnels (**protected**) + ingress |
@@ -36,6 +36,13 @@ on the next `pulumi up`, and `pulumi preview` always shows that first.
| Tunnel connector tokens / cloudflared processes | NomadPC systemd `cloudflared-nomad`, hf2 `~/nomad-tunnel` compose |
| Registrar, billing, API tokens, account members | Dashboard (admin@nomadkaraoke.com) |
## Email auth (SPF / DMARC) and Cloudflare DMARC Management
`_dmarc` and apex SPF records live in `dns.py`. Cloudflare **DMARC Management** (enabled on every zone,
API only) rewrites a zone's `_dmarc` record when it's turned on. For a new zone, create the `_dmarc`
record here first, then enable it. Keep each zone's CF `rua` prefix in the record, or reports stop.
Sender inventory and the tightening plan: workspace `docs/EMAIL-AUTH.md`.
## kjbox.cc app-link files
`kjbox.cc/.well-known/assetlinks.json` (Android App Links) and `apple-app-site-association` (iOS universal
+34 -70
View File
@@ -9,7 +9,7 @@ import pulumi_cloudflare as cloudflare
from ids import ACCOUNT_ID, ZONE_IDS
dns_karaokehunt_com_dmarc_txt = cloudflare.DnsRecord("dns-karaokehunt-com-dmarc-txt",
content="v=DMARC1; p=none;",
content="\"v=DMARC1; p=none; rua=mailto:dmarc@beveridge.uk,mailto:e19d1e12eb744b67a676aeba3383f58a@dmarc-reports.cloudflare.net\"",
name="_dmarc.karaokehunt.com",
ttl=1,
type="TXT",
@@ -53,12 +53,6 @@ dns_karaokehunt_com_create_a = cloudflare.DnsRecord("dns-karaokehunt-com-create-
ttl=1,
type="A",
zone_id=ZONE_IDS["karaokehunt.com"])
dns_karaokehunt_com_emailreturn_cname = cloudflare.DnsRecord("dns-karaokehunt-com-emailreturn-cname",
content="return.smtp2go.net",
name="emailreturn.karaokehunt.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["karaokehunt.com"])
dns_karaokehunt_com_apex_aaaa = cloudflare.DnsRecord("dns-karaokehunt-com-apex-aaaa",
content="100::",
name="karaokehunt.com",
@@ -84,12 +78,6 @@ dns_karaokehunt_com_apex_txt_3 = cloudflare.DnsRecord("dns-karaokehunt-com-apex-
ttl=3600,
type="TXT",
zone_id=ZONE_IDS["karaokehunt.com"])
dns_karaokehunt_com_link_cname = cloudflare.DnsRecord("dns-karaokehunt-com-link-cname",
content="track.smtp2go.net",
name="link.karaokehunt.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["karaokehunt.com"])
dns_karaokehunt_com_roadmap_cname = cloudflare.DnsRecord("dns-karaokehunt-com-roadmap-cname",
content="karaokehunt.com",
name="roadmap.karaokehunt.com",
@@ -97,12 +85,6 @@ dns_karaokehunt_com_roadmap_cname = cloudflare.DnsRecord("dns-karaokehunt-com-ro
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["karaokehunt.com"])
dns_karaokehunt_com_s680586_domainkey_cname = cloudflare.DnsRecord("dns-karaokehunt-com-s680586-domainkey-cname",
content="dkim.smtp2go.net",
name="s680586._domainkey.karaokehunt.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["karaokehunt.com"])
dns_karaokehunt_com_static_cname = cloudflare.DnsRecord("dns-karaokehunt-com-static-cname",
content="beveradb.com",
name="static.karaokehunt.com",
@@ -168,14 +150,8 @@ dns_nomadkaraoke_com_20260427041918pm_domainkey_txt = cloudflare.DnsRecord("dns-
ttl=1,
type="TXT",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_58424611_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-58424611-cname",
content="sendgrid.net",
name="58424611.nomadkaraoke.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_dmarc_txt = cloudflare.DnsRecord("dns-nomadkaraoke-com-dmarc-txt",
content="\"v=DMARC1; p=none; rua=mailto:71983fc0bec54aafa35bce88a6f426f0@dmarc-reports.cloudflare.net\"",
content="\"v=DMARC1; p=none; rua=mailto:dmarc@beveridge.uk,mailto:367a7b5921e8441aa22a6350cd676825@dmarc-reports.cloudflare.net\"",
name="_dmarc.nomadkaraoke.com",
ttl=1,
type="TXT",
@@ -230,18 +206,6 @@ dns_nomadkaraoke_com_em_fw_support_shop_cname = cloudflare.DnsRecord("dns-nomadk
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_em9596_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-em9596-cname",
content="u58424611.wl112.sendgrid.net",
name="em9596.nomadkaraoke.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_emailreturn_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-emailreturn-cname",
content="return.smtp2go.net",
name="emailreturn.nomadkaraoke.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_fiverrbot_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-fiverrbot-cname",
content="531403b1-bcfa-4f6e-912e-a10bd8e5ebd5.cfargotunnel.com",
name="fiverrbot.nomadkaraoke.com",
@@ -290,12 +254,6 @@ dns_nomadkaraoke_com_kjvnc_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-kj
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_link_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-link-cname",
content="track.smtp2go.net",
name="link.nomadkaraoke.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_list_a = cloudflare.DnsRecord("dns-nomadkaraoke-com-list-a",
content="3.13.222.255",
name="list.nomadkaraoke.com",
@@ -379,36 +337,18 @@ dns_nomadkaraoke_com_requests_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_s1_domainkey_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-s1-domainkey-cname",
content="s1.domainkey.u58424611.wl112.sendgrid.net",
name="s1._domainkey.nomadkaraoke.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_s1_domainkey_support_shop_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-s1-domainkey-support-shop-cname",
content="s1.domainkey.u48267109.wl110.sendgrid.net",
name="s1._domainkey.support.shop.nomadkaraoke.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_s2_domainkey_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-s2-domainkey-cname",
content="s2.domainkey.u58424611.wl112.sendgrid.net",
name="s2._domainkey.nomadkaraoke.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_s2_domainkey_support_shop_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-s2-domainkey-support-shop-cname",
content="s2.domainkey.u48267109.wl110.sendgrid.net",
name="s2._domainkey.support.shop.nomadkaraoke.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_s680586_domainkey_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-s680586-domainkey-cname",
content="dkim.smtp2go.net",
name="s680586._domainkey.nomadkaraoke.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_shop_a = cloudflare.DnsRecord("dns-nomadkaraoke-com-shop-a",
content="34.117.223.165",
name="shop.nomadkaraoke.com",
@@ -448,12 +388,6 @@ dns_nomadkaraoke_com_support_shop_txt = cloudflare.DnsRecord("dns-nomadkaraoke-c
ttl=1,
type="TXT",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_url5625_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-url5625-cname",
content="sendgrid.net",
name="url5625.nomadkaraoke.com",
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaraoke_com_www_shop_cname = cloudflare.DnsRecord("dns-nomadkaraoke-com-www-shop-cname",
content="shop.nomadkaraoke.com",
name="www.shop.nomadkaraoke.com",
@@ -503,7 +437,7 @@ dns_nomadkaraoke_com_zendeskverification_support_shop_txt = cloudflare.DnsRecord
type="TXT",
zone_id=ZONE_IDS["nomadkaraoke.com"])
dns_nomadkaroke_com_dmarc_txt = cloudflare.DnsRecord("dns-nomadkaroke-com-dmarc-txt",
content="\"v=DMARC1; p=none; rua=mailto:e768a3e8bc384309949f21b306f944bf@dmarc-reports.cloudflare.net\"",
content="\"v=DMARC1; p=reject; rua=mailto:dmarc@beveridge.uk,mailto:598ac080e20f478e91fb9ba96368a584@dmarc-reports.cloudflare.net\"",
name="_dmarc.nomadkaroke.com",
ttl=1,
type="TXT",
@@ -516,7 +450,7 @@ dns_nomadkaroke_com_apex_cname = cloudflare.DnsRecord("dns-nomadkaroke-com-apex-
type="CNAME",
zone_id=ZONE_IDS["nomadkaroke.com"])
dns_nomadkaroke_com_apex_txt = cloudflare.DnsRecord("dns-nomadkaroke-com-apex-txt",
content="\"v=spf1 include:_spf.mx.cloudflare.net ~all\"",
content="\"v=spf1 include:_spf.mx.cloudflare.net -all\"",
name="nomadkaroke.com",
ttl=1,
type="TXT",
@@ -540,3 +474,33 @@ dns_nomadkaroke_com_www_cname = cloudflare.DnsRecord("dns-nomadkaroke-com-www-cn
ttl=1,
type="CNAME",
zone_id=ZONE_IDS["nomadkaroke.com"])
# Parked domains: kjbox.cc and kjtip.me send no mail, so publish "nobody sends as us" (2026-11-27).
dns_kjbox_cc_spf_txt = cloudflare.DnsRecord("dns-kjbox-cc-spf-txt",
comment="parked: sends no mail",
content="\"v=spf1 -all\"",
name="kjbox.cc",
ttl=1,
type="TXT",
zone_id=ZONE_IDS["kjbox.cc"])
dns_kjbox_cc_dmarc_txt = cloudflare.DnsRecord("dns-kjbox-cc-dmarc-txt",
comment="parked: sends no mail",
content="\"v=DMARC1; p=reject; rua=mailto:dmarc@beveridge.uk,mailto:c758a037665b43b98a1d10fa8ce1c025@dmarc-reports.cloudflare.net\"",
name="_dmarc.kjbox.cc",
ttl=1,
type="TXT",
zone_id=ZONE_IDS["kjbox.cc"])
dns_kjtip_me_spf_txt = cloudflare.DnsRecord("dns-kjtip-me-spf-txt",
comment="parked: sends no mail",
content="\"v=spf1 -all\"",
name="kjtip.me",
ttl=1,
type="TXT",
zone_id=ZONE_IDS["kjtip.me"])
dns_kjtip_me_dmarc_txt = cloudflare.DnsRecord("dns-kjtip-me-dmarc-txt",
comment="parked: sends no mail",
content="\"v=DMARC1; p=reject; rua=mailto:dmarc@beveridge.uk,mailto:77b3f02ecd2f4ad6bad2b4dd3b1cb9ae@dmarc-reports.cloudflare.net\"",
name="_dmarc.kjtip.me",
ttl=1,
type="TXT",
zone_id=ZONE_IDS["kjtip.me"])
@@ -165,7 +165,7 @@ usermod -aG docker runner
echo "Setting up GitHub Actions Runner..."
# Keep current with actions/runner releases — GitHub deprecates old versions
# (HTTP 403 on broker poll). See runner-image-provision.sh for the full note.
RUNNER_VERSION="2.336.0"
RUNNER_VERSION="2.338.2"
RUNNER_DIR="/home/runner/actions-runner"
mkdir -p $RUNNER_DIR
@@ -231,7 +231,7 @@ useradd -m -s /bin/bash runner 2>/dev/null || true
echo "Setting up GitHub Actions Runner..."
# Keep current with actions/runner releases — GitHub deprecates old versions
# (HTTP 403 on broker poll). See runner-image-provision.sh for the full note.
RUNNER_VERSION="2.336.0"
RUNNER_VERSION="2.338.2"
RUNNER_DIR="/home/runner/actions-runner"
mkdir -p $RUNNER_DIR
@@ -28,7 +28,17 @@ $ProgressPreference = "SilentlyContinue"
$VARIANT = "gpu-windows"
$PYTHON_VERSION = "3.12.10"
$GIT_VERSION = "2.45.2"
$RUNNER_VERSION = "2.336.0" # keep in sync with runner-image-provision.sh
# Resolve the latest actions/runner release at bake time: GitHub deprecates old
# runner versions and JIT runners can't self-update, so a stale pin silently
# breaks every ephemeral runner. The pin is only a fallback.
$RUNNER_VERSION_FALLBACK = "2.338.2" # keep in sync with runner-image-provision.sh
try {
$RUNNER_VERSION = (Invoke-RestMethod -UseBasicParsing -TimeoutSec 30 -Uri "https://api.github.com/repos/actions/runner/releases/latest").tag_name.TrimStart("v")
if ($RUNNER_VERSION -notmatch '^\d+\.\d+\.\d+$') { throw "unexpected tag '$RUNNER_VERSION'" }
} catch {
Write-Output "WARNING: could not resolve latest actions/runner release ($_); using fallback v$RUNNER_VERSION_FALLBACK"
$RUNNER_VERSION = $RUNNER_VERSION_FALLBACK
}
$MARKER_DIR = "C:\provision-markers"
$READY_FILE = "C:\runner-image-ready"
@@ -230,7 +240,7 @@ try {
# ================= GitHub Actions runner ==============================
if (-not (Phase-Done "runner")) {
Ck "phase: actions runner v$RUNNER_VERSION"
$zip = "$WORK\actions-runner.zip"
$zip = "$WORK\actions-runner-$RUNNER_VERSION.zip"
Download "https://github.com/actions/runner/releases/download/v$RUNNER_VERSION/actions-runner-win-x64-$RUNNER_VERSION.zip" $zip
New-Item -ItemType Directory -Force -Path "C:\actions-runner" | Out-Null
Expand-Archive -Path $zip -DestinationPath "C:\actions-runner" -Force
@@ -389,9 +389,19 @@ visudo -cf /etc/sudoers.d/runner
# the broker poll — and ephemeral/JIT runners run with disableUpdate, so they
# CANNOT self-update. A stale pin silently breaks every ephemeral runner: it
# registers, gets rejected, and self-halts, leaving CI jobs queued forever.
# When bumping, check https://github.com/actions/runner/releases/latest.
# So the bake resolves the latest release at build time (the monthly rebuild
# then keeps images current); the pin below is only a fallback if the GitHub
# API is unreachable. When bumping it, check
# https://github.com/actions/runner/releases/latest.
ck "phase: github actions runner binary"
RUNNER_VERSION="2.336.0"
RUNNER_VERSION_FALLBACK="2.338.2" # keep in sync with runner-image-provision.ps1
RUNNER_VERSION="$(curl -fsSL --connect-timeout 10 --max-time 30 --retry 3 https://api.github.com/repos/actions/runner/releases/latest \
| grep -m1 '"tag_name"' | sed -E 's/.*"v?([0-9]+\.[0-9]+\.[0-9]+)".*/\1/' || true)"
if [[ ! "$RUNNER_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "WARNING: could not resolve latest actions/runner release; using fallback v$RUNNER_VERSION_FALLBACK"
RUNNER_VERSION="$RUNNER_VERSION_FALLBACK"
fi
echo "Using actions/runner v$RUNNER_VERSION"
RUNNER_DIR="/home/runner/actions-runner"
mkdir -p "$RUNNER_DIR"