carlos / platform Public

plan: PDFs need an egress allow before nesting; #990 not needed first

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 06362f8ed674a6a65832c7237327211931acb6c7 parent fe57f58
1 file changed, +7 −5
  • docs/superpowers/plans/2026-11-13-tito-nesting-and-self-serve-moves.md +7 −5

Intent

Human

<task-notification> <task-id>a79023b7f58a2d79d</task-id> <tool-use-id>toolu_0152Z1DD6Ffa9GAx9GKqy4Sf</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/96a09f74-e398-48ed-a97f-140bd1f7e255/tasks/a79023b7f58a2d79d.output</output-file> <status>completed</status> <summary>Agent "Read-only: titogo own-box calls, PDFs" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**Verdict: #990 does not have to land before carlos-tito-ie is nested, but an egress allow for Gotenberg does.** PDFs are the one thing that breaks without it. I read origin/main of each repo: titogo `a047187a30` (the newest worktree is 1,683 commits behind, so I used the repo at `/home/paulca/github.com/tito/titogo`), Tito infra `github/main` `01d11fe` in `/home/paulca/amadan.net/tito/carlos-infrastructure`, and platform `4c641678`. Paths below are relative to those three repos. ## Q1. Outbound calls from a titogo instance | Call | Evidence | Transport | Same-box public address? | |---|---|---|---| | Relay (Stripe, PayPal, Yapily, SES, Google Wallet, fx rates, billing, ops reports, workflow egress) | `internal/instance/serve.go:1353`, `connect.go:1127` and `:1149` (`unixdial` to `TITO_RELAY_SOCKET`), `email_sender.go:509-519`, `http://relay/__internal/...` in about 20 files | Unix socket `/run/titogo/connect.go.tito.io.sock`, mode 0660, group `carlos` (`internal/relay/relay.go:807-853`, staging `RUNBOOK-bringup.md` T8) | No, it never uses IP | | Can a nested instance see that socket? | `carlos-instance@.service`: hides only `/run/carlos` (:86) and `/etc/carlos`, `/run/carlos-control` (:108). `/run/titogo` stays visible, read-only under `ProtectSystem=strict` (:84). The instance runs as uid/gid `carlos` | — | Probably yes: a read-only mount should not block connecting to a socket. I could not test this | | Edge cache purge | `serve.go:1396`, `purge.go:674-679` | Unix socket `CARLOS_CONTROL_SOCKET`, which is the instance socket plus `.control`, inside the bound `/run/carlos/instances/%I` (platform `backend_exec.go:2522,2775`) | No | | Root domain, `connect.go.tito.io`, its own or another instance's hostname | None found. `RootDomain` is only used to build links (`api_docs.go:127`, `docs_help.go:70`, `notify_email.go:84`, `venue.go:384`). Theme preview calls the handler in the same process (`admin_theme_preview.go:270-300`). The watchdog dials the instance's own listener, and only under `NOTIFY_SOCKET` (`watchdog.go:62-104`) | — | No | | Organizer-configured URLs (webhooks, workflow HTTP, font copies) | `webhooks_deliver.go:152`, `workflow_http.go`, `font_copies.go:441-452`, all through `netguard` | HTTPS by hostname | Only if an organizer points one at a `*.go.tito.io` host. That resolves to the EIP, which is not denied (see the verdict) | ## Q2. PDFs in production | Item | Evidence | |---|---| | Setting | `TITO_GOTENBERG_URL` (basic-auth credentials in the URL) plus `TITO_GOTENBERG_INSECURE_TLS=1`. Read at `internal/instance/serve.go:1381-1382`, client at `internal/gotenberg/gotenberg.go:35-55` | | Target | `svc-pdf`, a separate t4g.small. Caddy serves it at `${PRIVATE_IP}:443` with a self-signed certificate (`svc-pdf-init.sh:46`). Only the IE host's security group may connect (`svc-pdf.tf:6-14`). `outputs.tf:13` exposes `svc_pdf_private_ip`. It has no public hostname, and the platform PDF service exists only on staging (`staging/pdf.tf`) | | Infra already says nesting breaks it | `scripts/bootstrap-box.sh:62-68`: "PDFs too, since Gotenberg is on a private address" (PRO-5614 / PRO-5460) | | What the nested deny covers | `carlos-instance@.service:162`: `IPAddressDeny=` includes `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `100.64.0.0/10` and `169.254.169.254`. The note you remembered is correct: RFC 1918 is blocked, on top of the box's own addresses from #367 | | Fix | `carlos apps set titogo --egress-allow &lt;svc_pdf_private_ip&gt;`. The allow rules (`internal/egressaddr/egressaddr.go:58-59` and `Allowed` at :110) accept a single RFC 1918 address. Tito already does this for staging's Rails apps (`apps/README.md:83`). It needs no platform change | | Exact production value | Unknown, because it lives in the console's app config. To check on IE: `grep -h '^TITO_GOTENBERG_URL' /data/*.config.env \| sed 's#//[^@]*@#//***@#' \| sort -u` | ## Q3. Other private or local addresses | Call | Evidence | Blocked once nested? | |---|---|---| | SMTP | `serve.go:1329-1336`, `internal/mail/mail.go:377`. The host is SES (`email-smtp.eu-west-1.amazonaws.com`) | No, it is public. The production value is unknown | | S3 uploads | `serve.go:1340-1348`: static keys, the public endpoint, never IMDS | No | | IMDS | `s3.NewFromInstanceRole` is only used by the router, auth store and ops (`router.go:3732`, `auth/select.go:106`, `ops/replicarm.go:204`) | Not used by instances | | DNS | The VPC resolver is reopened by `allowResolvers` (`internal/instancectl/hardening.go`) | No | | Redis, MySQL, Postgres | None in titogo instances | — | ## Why #990 isn't needed on this box carlos-tito-ie is an EC2 box with an EIP and no IPv6 (I found no IPv6 in the infra). The EIP is never on an interface, so `localPrefixes` (`internal/instancectl/localaddrs.go:36-39`, read from fib_trie LOCAL routes) never puts it in `denyLocalAddrs`. #367 says so itself: "On EC2 without IPv6 the interface address is private and already denied." #990's edge fence would also switch itself off there (`edgefence.go:55,96`, "no public address on this box"). It is merged to main as `ddd234a6` but in no release tag yet. On top of that, titogo instances make no HTTPS call to the root domain, `connect.go.tito.io` or any instance hostname. Everything internal goes over Unix sockets. ## What breaks, and what to do before nesting 1. **PDFs (blocking):** they break because svc-pdf's private 10.x address is under the template's RFC 1918 deny. Grant `--egress-allow &lt;svc_pdf_private_ip&gt;` before nesting, and allow the roughly 15 minutes `apps/README.md` says a new address takes to reach the box. 2. **The relay socket (needs a check):** I expect a nested instance can reach it, but haven't proved it. Test after `layout migrate` on staging by opening a nested instance's Integrations page, which logs the dial errno. 3. **IPv6 (needs a check):** run `ip -6 addr show scope global` on IE. #990 would start to matter only if IE gains a global IPv6 address or titogo moves to a box with a public IP on its interface.</result> <usage><subagent_tokens>144410</subagent_tokens><tool_uses>52</tool_uses><duration_ms>567967</duration_ms></usage> </task-notification>

Attributed to this commit: 10.9 g CO₂e (1,344,713 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on plan-tito-nesting-moves, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/plans/2026-11-13-tito-nesting-and-self-serve-moves.md b/docs/superpowers/plans/2026-11-13-tito-nesting-and-self-serve-moves.md
index 8723ecf53..bc72cde07 100644
--- a/docs/superpowers/plans/2026-11-13-tito-nesting-and-self-serve-moves.md
+++ b/docs/superpowers/plans/2026-11-13-tito-nesting-and-self-serve-moves.md
@@ -62,8 +62,8 @@ Run from `staging/` in Tito's carlos-infrastructure. `dorothy-sailing` (IE) runs
- [ ] Relay socket from inside a nested instance: connect Stripe on acme-2 (T14's steps).
- [ ] Webhooks: a paid test order on acme-1 and acme-2; Stripe's sandbox shows each Connect delivery 2xx.
- [ ] A webhook across the stop (Review Focus 1): an order placed in the minute before acme-1's stop ends up paid. A retry in Stripe's log is fine, a final failure is not.
-- [ ] PDFs: a ticket PDF downloads. unknown: whether production's PDFs still reach Gotenberg on a private address (staging left it out, bringup line 82): check production's app config names. If so, staging cannot prove this and W6 goes ahead of W1b.
-- [ ] Own-box calls (#990): sign in, send an invite, push a team change, mint an agent token; the instance's log shows no refused dial. unknown: which titogo calls go by hostname to its own box: get the list from the Tito session and try each.
+- [ ] PDFs: a ticket PDF downloads. Production's titogo reaches Gotenberg (`TITO_GOTENBERG_URL`) on svc-pdf's private 10.x address (Tito infra `svc-pdf.tf`, `svc-pdf-init.sh:46`), and the nested unit denies RFC 1918 (`carlos-instance@.service:162`). So production needs `carlos apps set titogo --egress-allow <svc_pdf_private_ip>` before W1b (no platform change; about 15 minutes to reach the box). To prove it here, give staging the same shape (a private Gotenberg plus the allow) or accept the allow as proven by staging's Rails apps (`apps/README.md:83`).
+- [ ] Own-box calls (#990): checked read-only on 2026-11-13 (titogo a047187a): instances make no HTTPS call to the root domain, `connect.go.tito.io` or any instance hostname; the relay and purge are Unix sockets (`internal/instance/connect.go:1127,1149`, `serve.go:1396`). Exit check: open a nested instance's Integrations page (it logs the relay dial's errno) and confirm the relay socket `/run/titogo/connect.go.tito.io.sock` is reachable from the nested unit (`/run/titogo` stays visible read-only, untested).
- [ ] acme-2's custom domain or alias answers 2xx.
- [ ] The controld account answers 2xx and its unit is untouched.
- [ ] Rollback rehearsed: `carlos system layout revert --force --box dorothy-sailing`, every row `flat`, time logged (five took 200 s on 10-09); then migrate again and leave staging nested.
@@ -72,7 +72,9 @@ Run from `staging/` in Tito's carlos-infrastructure. `dorothy-sailing` (IE) runs
### W1b. Production window on betty-fossicking (IE; formerly carlos-tito-ie)
- [ ] **Paul's go (D3):** a window in Tito's quietest hour, and the notice sent.
-- [ ] Read-only pre-checks: release equals staging's; probe ready; `free -m` logged; platform-placed rows counted (`carlos status --layout`; 34 on 10-08).
+- [ ] **Paul's go:** `carlos apps set titogo --account bae --egress-allow <svc_pdf_private_ip> --console https://carlos.tito.io`, at least 15 minutes before the migrate; then a PDF from a still-flat instance is unchanged.
+- [ ] Read-only: `ip -6 addr show scope global` on the IE box prints nothing (with no global IPv6 and the EIP off the interface, #990's deny never names a reachable public address).
+- [ ] Read-only pre-checks: release equals staging's; probe ready; `free -m` logged; platform-placed rows counted (`carlos status --layout`; 74 flat on 2026-11-13, Appendix B).
- [ ] **Paul's go:** `carlos system layout migrate --box <IE label>`.
- [ ] Within 15 minutes, run the exit list on one of Tito's own accounts that nested asleep. Asleep instances move first, so they are the canary. On a failure, `carlos system layout revert --force --box <IE label>` before the hour is up; no account in use was touched.
- [ ] From the 1-hour mark, watch box memory, the edge's 502 and 503 rate and the router journal until every platform-placed row is `nested`. The mixed-box warning stays until W2 ends (controld rows are `external`).
@@ -169,7 +171,7 @@ Authorities: the self-serve spec (rev 16) for intent and Paul's rulings; the off
## W6. Same-box calls between apps (#990)
-- [ ] Decide after W1a: if the rehearsal shows titogo needs calls to its own box's addresses (or production's PDFs still reach a private address), #990 moves ahead of W1b, since nesting is what switches the deny on. Otherwise it stays queued after W3 (it also blocks the hub pattern in docs/site/one-instance-per-customer.md).
+- [x] Decided read-only on 2026-11-13: **#990 is not needed before W1b.** The IE box is EC2 with an EIP and no IPv6 found in Tito's infra; the EIP is never on an interface, so `denyLocalAddrs` never names it (`internal/instancectl/localaddrs.go:36-39`), and titogo instances call nothing on their own box by hostname. What nesting does break is PDFs (RFC 1918 deny), handled by the egress allow in W1b. #990's edge fence is on main (ddd234a6), unreleased; it stays queued for the hub pattern (docs/site/one-instance-per-customer.md).
## Parked, with reasons
@@ -182,7 +184,7 @@ Authorities: the self-serve spec (rev 16) for intent and Paul's rulings; the off
|---|---|---|---|
| now | W0 D1-D4 asks; W4 #413 and #339 branches; W5 design | none | Paul (D1-D4) |
| weekend 11-14/15 | W1a staging rehearsal only | Paul's go for staging; staging rolled to production's release | Paul |
-| after W1a passes | W1b production window (IE, then the other regions) | D3, exit list green, W6 decided | Paul |
+| after W1a passes | W1b production window (IE, then the other regions) | D3, exit list green, PDF egress allow in place | Paul |
| after IE nested | W2 staging canary, production canary, then batches | D1 settled, titogo half merged, one box in IE, floor published | Paul per batch |
| after W4 merged | W3 slices 1 to 3 (platform work, in parallel with W2) | D2 | Paul |
| after W2 and W3 slice 2 | Tito switches self-serve moves on | #202 verified, `TITO_REMOTE_PLACEMENT=on` | Paul and Tito |