Skip to content

fix(template): serve the nginx 443 vhost over HTTP/1.1 only - #447

Merged
KishiTheMechanic merged 1 commit into
mainfrom
claude/nginx-vhost-http1-only
Nov 19, 2026
Merged

KishiTheMechanic merged 1 commit into
mainfrom
claude/nginx-vhost-http1-only

Conversation

@KishiTheMechanic

Copy link
Copy Markdown
Contributor

What changed

  • ansible/cmn/software/install-nginx.yaml: the 443 server block now uses listen 443 ssl; and listen [::]:443 ssl; (HTTP/2 removed). The same change is applied to the three template directories that carry the playbook (2026.10.18.1610, 2026.10.19.0750, 2026.10.19.1053), which end byte-identical.
  • Comments in the playbook rewritten to describe what the tasks do: the caller-supplied (origin_cert_b64 / origin_key_b64) or self-signed origin cert, the two variables added to the header list, and the self-signed fallback, which keys on origin_cert_b64.
  • New test template/2026.10.19.1053/tests/rpc_geyser/test_install_nginx.py, picked up by the existing rpc_geyser step of the template tests workflow.

No task was renamed and no non-comment line changed other than the two listen 443 lines.

Why

The 443 vhost is a reverse proxy to a loopback service and does not need HTTP/2. Removing it removes the HTTP/2 attack surface.

How it was verified

The listen lines carry no Jinja, so the YAML literal is what ansible renders; no ansible run was needed.

Test, run against the playbook before the change (fails on the http2 token):

$ python3 -m unittest discover -s template/latest/tests/rpc_geyser -p 'test_install_nginx.py' -v
test_443_vhost_is_http1_only (test_install_nginx.InstallNginxVhostTest.test_443_vhost_is_http1_only) ... FAIL

======================================================================
FAIL: test_443_vhost_is_http1_only (test_install_nginx.InstallNginxVhostTest.test_443_vhost_is_http1_only)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "<repo>/template/latest/tests/rpc_geyser/test_install_nginx.py", line 46, in test_443_vhost_is_http1_only
    self.assertNotIn(H2, tokens, f"443 listen line enables HTTP/2: {line}")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'http2' unexpectedly found in ['listen', '443', 'ssl', 'http2'] : 443 listen line enables HTTP/2: listen 443 ssl http2;

----------------------------------------------------------------------
Ran 1 test in 0.011s

FAILED (failures=1)
rc=1

Same command after the change:

test_443_vhost_is_http1_only (test_install_nginx.InstallNginxVhostTest.test_443_vhost_is_http1_only) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.010s

OK
rc=0

Syntax check after the change:

$ ansible-playbook --syntax-check -i localhost, -e fqdn=x.example.test template/2026.10.19.1053/ansible/cmn/software/install-nginx.yaml

playbook: template/2026.10.19.1053/ansible/cmn/software/install-nginx.yaml
rc=0

actor: seat=backend-l3-pokemon-wanriky · model=claude-sonnet-5-5 · host=mac.home · session=3fe1844d · agent=a42714c4076ab3e65
🤖 Generated with Claude Code

The 443 server block rendered by install-nginx.yaml is a reverse proxy to a loopback service and does not need HTTP/2. Drop http2 from both 443 listen lines to remove the HTTP/2 attack surface. Apply the same change to the three template directories that carry the playbook.

Rewrite the playbook comments so they describe what the tasks do: the caller-supplied or self-signed origin cert, the origin_cert_b64 / origin_key_b64 variables, and the self-signed fallback that keys on the cert variable. Add a test that fails while the 443 listen lines enable HTTP/2.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@KishiTheMechanic

Copy link
Copy Markdown
Contributor Author

Taking the cyan (final) review seat for this PR, round 1. Reading the diff against the base and the three template versions now; the verdict will follow as a formal review on the target commit.

actor: seat=cyan · model=claude-opus-5-5 · host=mac.home · session=3fe1844d · agent=a9f45e317024bb023
cyan gate claim / round 1 / 対象 cf16008 / cyan-slv447-r1-798d114e

@KishiTheMechanic

Copy link
Copy Markdown
Contributor Author

Infrastructure gate (auron) is starting the round 1 review of this PR at the head below. The review reads the diff and the playbooks in the three template version directories, and takes build and test results from the CI check runs on this head.

actor: seat=auron · model=claude-opus-5-5 · host=mac.home · session=3fe1844d · agent=a083526e469aea74e
auron gate claim / round 1 / 対象 cf16008 / auron-slv447-r1-92c5c99e

@KishiTheMechanic KishiTheMechanic left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cyan review, round 1 (final seat; R2 with the infrastructure seat in parallel)

PASS on cf16008b4576cfe80d42fd9ff4b057830fcfef58 (base 8d6a5f04e2b860912ad78e045bc0a6ed0a29b8d8). No blocking findings.

Scope read

  • The diff from base to Target touches 4 files: the three copies of ansible/cmn/software/install-nginx.yaml (under template/2026.10.18.1610, template/2026.10.19.0750 and template/2026.10.19.1053) and the new template/2026.10.19.1053/tests/rpc_geyser/test_install_nginx.py. Nothing outside those files changed: no version bump and no workflow change.
  • I also read the whole playbook at Target, its CLI caller cli/src/install/nginxFlow.ts, the task-name pin in cli/test/unit/template_w0_guards.test.ts, and .github/workflows/slv-template-tests.yml.

Requirements

  1. HTTP/2 is removed from the 443 vhost.
    • In task Render vhost file, listen 443 ssl http2; and listen [::]:443 ssl http2; became listen 443 ssl; and listen [::]:443 ssl;. The "Legacy listen ... http2 form" comment block is gone.
    • Probe git grep -I -c -E 'listen[^;]*http2|http2[[:space:]]+on' <sha> -- . found 0 hits at Target (rc=1). The positive control on base found 4 hits in each of the 3 playbook copies.
    • git grep -I -n grpc_pass <Target> -- . found 0 hits.
    • No other nginx config in the tree enables HTTP/2.
  2. The three copies stay identical.
    • git rev-parse <Target>:template/<v>/ansible/cmn/software/install-nginx.yaml returns the same blob 82069c0bdcc091cbf5297fd2b048330df397a37c for all three version dirs.
    • At base the three copies were also identical: git diff --stat between the copies is empty at both commits.
    • git ls-tree -r --name-only <Target> | grep -c install-nginx.yaml returns 3, so no copy was missed.
  3. The comments now match the tasks. I checked each rewritten sentence against its task:
    • "Each is written verbatim when its own variable is non-empty" matches when: origin_cert_b64 | length > 0 on Write caller-supplied origin certificate and when: origin_key_b64 | length > 0 on Write caller-supplied origin private key.
    • "The self-signed fallback keys on the cert variable alone ... and it also generates the key" matches Generate self-signed origin cert (fallback), which has when: origin_cert_b64 | length == 0, creates: /etc/nginx/ssl/{{ fqdn }}.crt and -keyout /etc/nginx/ssl/{{ fqdn }}.key.
    • The removed text "When either is empty, we fall back ..." was wrong when the cert is supplied and the key is empty. The new text is right for that case.
    • "one on 443 with the cert written above (caller-supplied or self-signed)" matches the 443 block: its ssl_certificate and ssl_certificate_key paths are the files both branches write.
    • The new header entries for origin_cert_b64 and origin_key_b64 match the vars: defaults ('').
  4. Test coverage
    • Reach. In SLV Template Tests, the step rpc_geyser (RPC init, update and gateway playbooks) runs python3 -m unittest discover -s template/latest/tests/rpc_geyser -p 'test_*.py' -v. It fails the step on a skip or on Ran 0 tests. At Target, template/latest is a symlink to 2026.10.19.1053, and the install step installs python3-yaml, so the new file is discovered and its imports resolve. Path(__file__).resolve().parents[2] is the version dir, so the test reads the 2026.10.19.1053 playbook.
    • Firing (derived by reading; this seat did not run it). At base, the Render vhost file literal contains listen 443 ssl http2;. Once split and stripped of ;, its tokens contain http2, so assertNotIn fails.
    • No vacuous pass. The test requires at least one 443 listen directive (assertTrue(listen_443, ...)) and raises if the task is missing.

Non-regression

  • In the 443 block only the two listen lines and a comment changed. ssl_*, the proxy headers, the timeouts and proxy_pass are unchanged, and the port 80 block is byte-identical.
  • The upstream leg is already HTTP/1.1 (proxy_http_version 1.1 to proxy_pass http://127.0.0.1:{{ upstream_port }}), and the tree has no grpc_pass. Nothing behind this vhost depends on HTTP/2 from the client.
  • listen 443 ssl; is valid on both nginx 1.24 and 1.25+. The removed comment existed only to explain the inline http2 parameter.
  • No task name changed, so the pin 'ansible/cmn/software/install-nginx.yaml: Write caller-supplied origin private key' in cli/test/unit/template_w0_guards.test.ts still matches.
  • The edited Render vhost file content adds none of the strings that test's key-writer regex matches (private key|origin_key|wg_private_key_value|PrivateKey), so the test's found list is unchanged.
  • The CLI caller passes the same variables, and its note "the playbook's self-signed fallback kicks in when they're empty" still holds.
  • Added lines contain no line-number references. The only :<digits> hits are the IPv6 [::]:443 listen literals.

Other findings

  • pre-existing, not blocking (base behaves the same). The playbook header says vhosts from a run with a different fqdn "are NOT cleaned up automatically", and no task removes their sites-enabled link. An older vhost that still has listen 443 ssl http2; therefore stays loaded beside the new one. nginx applies listen parameters per address:port, so that older vhost would keep HTTP/2 on :443 until it is removed or re-rendered. This is reasoned from nginx's listen semantics; this seat did not run it.

wording

(none)

CI on Target

  • gh api repos/ValidatorsDAO/slv/commits/<Target>/check-runs --paginate returned 37 rows, which equals total_count (37). Every row is completed, and every conclusion is success or skipped (none failed).
    • success: resolve, test, source-materials, package, runtime-qualification, qualification-inputs, build-aarch64-apple-darwin, build-aarch64-unknown-linux-gnu, build-x86_64-unknown-linux-gnu, build-x86_64-apple-darwin, Template tests (ansible-core 2.16), Render matrix, nft -c and netns verdicts, Listen model (Python 3.10), Listen model (Python 3.12).
    • skipped: the remaining 22 rows (publish, attest, the validation-smoke and source-* matrix jobs, and similar).
  • The Template tests (ansible-core 2.16) job log (job 135530540185) contains test_443_vhost_is_http1_only (test_install_nginx.InstallNginxVhostTest.test_443_vhost_is_http1_only) ... ok, followed by Ran 168 tests ... / OK for the rpc_geyser step. This confirms the new test reaches CI on the Target.
  • The CI wait returned code 0 with state green, 37 checks, no failing and none pending. Its copy field was {"judge":"origin/main","commit":"8ddd7d1867eb7072dc38e4cfa72d86299c8405c0","handedOver":false}.

Unverified

  • This seat ran no ansible, nginx, Python or Deno, so ansible-playbook --syntax-check was not run here either. Test results are CI's conclusions on the Target.
  • Nobody has observed nginx serving HTTP/1.1 only on :443 after a real install from this template (for example, an ALPN probe against a rendered host).
  • The per-address:port http2 behaviour behind the pre-existing note above was not run.

actor: seat=cyan · model=claude-opus-5-5 · host=mac.home · session=3fe1844d · agent=a9f45e317024bb023
Gate: cyan
Round: 1
Target: cf16008
Verdict: PASS
Claim: cyan-slv447-r1-798d114e
Effort: xhigh
Wording: 0

@KishiTheMechanic KishiTheMechanic left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auron (infrastructure) / round 1 / target cf16008

Verdict: PASS — no blocking findings.

Scope read: the diff from base 8d6a5f04e2b860912ad78e045bc0a6ed0a29b8d8 to the target (4 files: install-nginx.yaml in the three template version directories, plus the new template/2026.10.19.1053/tests/rpc_geyser/test_install_nginx.py), the whole playbook at the target, its callers, the template packaging path, and the template tests workflow. I read git objects only. Build and test results come from the CI check runs on this head.

Requirement fulfilment

  • HTTP/2 is gone from the 443 server block in all three copies. git grep -I -E 'listen[^#]*http2|http2 on' <target> returns 0 lines; the same command at base returns 12 (two listen lines and two comment lines per copy). git grep -E 'listen[[:space:]].*443' returns 6 lines at both base and target: at base all six are ssl http2, at the target all six are plain ssl.
  • The three copies are byte-identical at the target. git rev-parse <target>:template/<dir>/ansible/cmn/software/install-nginx.yaml gives blob 82069c0b… for all three dirs; base gives bb414537… for all three.
  • I checked each rewritten comment against the task it describes, and each one matches.
    • "Write caller-supplied origin certificate" runs when: origin_cert_b64 | length > 0. "Write caller-supplied origin private key" runs when: origin_key_b64 | length > 0.
    • "Generate self-signed origin cert (fallback)" runs when: origin_cert_b64 | length == 0 and creates: the crt file. Its openssl req writes both -keyout and -out.
    • The removed "Flexible SSL mode … plain HTTP on port 80" paragraph contradicted the 443 block and the certificate tasks, which are still there.
  • New test:
    • Reach: slv-template-tests.yml runs on pull_request for template/**. Its step "rpc_geyser (RPC init, update and gateway playbooks)" runs unittest discover -s template/latest/tests/rpc_geyser -p 'test_*.py'. template/latest resolves to 2026.10.19.1053, and the job installs python3-yaml. The job log of "Template tests (ansible-core 2.16)" on this head shows test_443_vhost_is_http1_only (test_install_nginx.InstallNginxVhostTest.test_443_vhost_is_http1_only) ... ok, followed by Ran 168 tests and OK for that step, so CI runs the new test.
    • Firing: I derived this and did not re-run it. The base literal listen 443 ssl http2; splits into tokens that contain http2, so assertNotIn(H2, tokens, …) fails on base. The before/after output in the PR body is the author's.

Non-regression

  • In each playbook, the only change outside comment lines is the two listen lines. The 13 - name: task names are identical at base and target. The vars, the port 80 block, Validate nginx config (nginx -t) before Reload nginx, and diff: false on "Write caller-supplied origin private key" are all unchanged.
  • Upstream protocol: both server blocks use proxy_pass http://127.0.0.1:{{ upstream_port }} with proxy_http_version 1.1 at both base and target, so the hop to the loopback service was HTTP/1.1 before and after. git grep -l -E 'grpc_pass|sites-(available|enabled)|proxy_pass' <target> finds no other nginx renderer in the tree, so no HTTP/2-to-upstream path existed for this change to break. The WebSocket Upgrade / Connection "upgrade" headers are unchanged.
  • The Deno guard "no_log: every copy that writes a private key from its content returns no diff" still names this playbook's key task, and the test check is green on this head.

Blast radius and rollback

  • Callers. git grep 'install-nginx' <target> (stem, repo-wide) finds one runtime caller, cli/src/install/nginxFlow.ts (${templateRoot}/ansible/cmn/software/install-nginx.yaml), plus one Deno test reference and the new Python test. runNginxFlow is called from slv install nginx (cli/src/install/index.ts) and twice from the onboard flow (cli/src/ai/onboard/onboardAction.ts).
  • Hosts reached. The runner cli/lib/runAnsibleLocal.ts invokes ansible-playbook -i localhost, --connection=local, so hosts: all resolves to the single machine the CLI runs on. Each invocation reaches exactly one host, and no --limit assumption is involved.
  • Shipping path. The template ships as template.tar.gz of the current version dir only (deno.json create:template: tar -czf dist/template.tar.gz ./template/2026.10.19.1053). The CLI reads ${configRoot}/template/${denoJson.version} (cli/lib/getTemplatePath.ts). The edits to the two older dirs therefore have no shipping path at this target; they keep the tree consistent for future version bumps.
  • Merge reach. scripts/release/workflow.ts (resolve) returns release_required: false when the version at before equals the version at after. This diff does not touch the version, so merging publishes nothing. The change reaches a machine only when a later release ships the template and someone runs slv install nginx or the onboard HTTPS step.
  • Rollback. Re-running a template that still has the old listen lines restores them. The task chain is copy, link, nginx -t, then reload, with no deletion and no restart, and it is safe to re-run.

Other checks

  • Secrets: no task that handles key material changed, and nothing is echoed or logged.
  • Workflows: no .github/workflows/** diff and no generator or manifest diff. No new workflow, job or gate.
  • Line-number locators: I probed the added lines for :<digits>, line <n> and L<n>. The only match is the address:port [::]:443. The stem grep shows that nothing else in the tree refers into this playbook by line.

Non-blocking

  • Pre-existing: the playbook header says vhosts rendered for an earlier fqdn are not cleaned up, and Enable vhost only adds links. A vhost file that an earlier run rendered for a different fqdn therefore stays enabled and keeps listen 443 ssl http2;. This diff cannot reach that file and base behaves the same, so it is not blocking here. Fixing it would mean a new deletion task, which has its own blast radius.

CI (check runs on the target)

gh api repos/ValidatorsDAO/slv/commits/<target>/check-runs --paginate: I copied 37 rows, matching total_count 37. All are completed: 15 success and 22 skipped, with no failure, cancellation or pending run.

resolve                              success
test                                 success
source-materials                     success
qualification-inputs                 success
runtime-qualification                success
build-x86_64-unknown-linux-gnu       success
build-aarch64-unknown-linux-gnu      success
build-x86_64-apple-darwin            success
build-aarch64-apple-darwin           success
package                              success
Template tests (ansible-core 2.16)   success
Render matrix                        success
nft -c and netns verdicts            success
Listen model (Python 3.10)           success
Listen model (Python 3.12)           success
(22 further jobs: skipped — publish, attest, activation-required, qualification-promotion,
 verify-existing, legacy-bootstrap, source-native-diagnostic, the two validation-smoke-* jobs
 and the source-* validation jobs)

The CI wait script returned code 0, state green, total 37 and no failing checks. Its copy field is {"judge":"origin/main","commit":"8ddd7d1867eb7072dc38e4cfa72d86299c8405c0","handedOver":false}.

Not verified

  • I did not run ansible and did not run nginx -t against a real nginx for the rendered vhost. This was a read-only review, and the --syntax-check output is the author's. The CI template tests run the unit test, not this playbook.
  • How the edge proxy and clients behave against an origin that offers only HTTP/1.1 over TLS was not measured.
  • Hosts with another enabled server block on port 443, whether from earlier runs or the operator's own config, were not measured.

wording

(none)

actor: seat=auron · model=claude-opus-5-5 · host=mac.home · session=3fe1844d · agent=a083526e469aea74e
Gate: auron
Round: 1
Target: cf16008
Verdict: PASS
Claim: auron-slv447-r1-92c5c99e
Effort: xhigh
Wording: 0

@KishiTheMechanic
KishiTheMechanic merged commit 5ef270c into main Nov 19, 2026
37 checks passed
@KishiTheMechanic
KishiTheMechanic deleted the claude/nginx-vhost-http1-only branch November 19, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant