Skip to content

Turn HTTP/2 off by default on the managed Nginx vhost, with a switch to turn it on - #552

Open
shipmill-romamo[bot] wants to merge 2 commits into
mainfrom
fix/551-nginx-http2-switch
Open

shipmill-romamo[bot] wants to merge 2 commits into
mainfrom
fix/551-nginx-http2-switch

Conversation

@shipmill-romamo

@shipmill-romamo shipmill-romamo Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Plan

  • Serves: quality bar
  • Files: engine/ansible/roles/cloudfall_nginx_site/{defaults/main.yml,meta/argument_specs.yml,templates/domain-site.conf.j2}, engine/tests/test_nginx_site_templates.py, engine/tests/test_nginx_site_routes.py, engine/README.md, changelog.d/551-nginx-http2-switch.md
  • Order: role default and argument spec, then the template switch, then tests on 1.22.1 and 1.26.3, then the README line and changelog fragment
  • Proof: the new tests fail on the unchanged template; the role-default case fails while the default is true

Summary

The managed vhost always rendered HTTP/2 in its TLS server, so an operator could not turn it off (a hand edit was lost on the next domains run). The cloudfall_nginx_site role now takes cloudfall_nginx_site_http2 (bool, default false, in defaults/main.yml and meta/argument_specs.yml), as the maintainer chose on this PR (option 1):

  • false (default): listen 443 ssl; and listen [::]:443 ssl; with no http2 anywhere, on both sides of 1.25.1. Every managed vhost drops to HTTP/1.1 on its next domains run
  • true: renders exactly as before (listen 443 ssl http2; below 1.25.1, listen 443 ssl; + http2 on; from 1.25.1)

The template reads the variable through | bool: a key=value --extra-vars cloudfall_nginx_site_http2=false hands the role the string "false", which is truthy in a Jinja if. The domains playbook does not pass the variable, so the role default applies unless the inventory or --extra-vars sets it. No Domain schema field or CLI flag was added. engine/README.md says how to turn HTTP/2 back on; #555 tracks flipping the default back once Debian ships the fix.

Tests

  • test_nginx_site_routes.py: the golden files keep the HTTP/2-on shape and are rendered with the variable true. test_http2_off_drops_it_from_the_tls_server_on_every_version renders through Ansible's template module with the role default, false, and the string "false" on 1.22.1 and 1.26.3, and checks the vhost equals the golden one minus its HTTP/2 spelling
  • test_nginx_site_templates.py: false and "false" on both versions with the Jinja helper, plus a check that the default and the argument spec both say false
  • uv run ruff check ., uv run mypy, ansible-lint engine/ansible/roles/cloudfall_nginx_site (with ANSIBLE_CONFIG=engine/ansible/ansible.cfg) pass; pytest engine/tests/test_nginx_site_templates.py engine/tests/test_nginx_site_routes.py engine/tests/test_nginx_site_role.py engine/tests/test_domains_one_domain.py engine/tests/test_domains_certificate.py pass (69). nginx -t was not run

Fixes #551

🤖 Generated with Claude Code

The cloudfall_nginx_site role takes cloudfall_nginx_site_http2 (bool,
default true). When false the TLS server renders listen 443 ssl; and
listen [::]:443 ssl; with no http2 on either side of Nginx 1.25.1. The
template reads it through | bool, since a key=value --extra-vars hands
the role the truthy string "false". The default render is byte-identical
to the golden files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@shipmill-romamo shipmill-romamo Bot 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.

Review of d0326e9: MERGE

  • domain-site.conf.j2: {% if not cloudfall_nginx_site_http2 | bool %} parses as not (x | bool) (filters bind tighter than not), so false and the string "false" from a key=value --extra-vars both drop HTTP/2; true falls through to the existing version branches unchanged
  • Default true in defaults/main.yml and meta/argument_specs.yml; the golden files are untouched and the routes test now feeds the role default into the render, so the goldens prove the default stays byte-identical
  • Tests cover off as bool and as string on 1.22.1 and 1.26.3; HTTP (port 80) output is unchanged for the off case
  • Fragment changelog.d/551-nginx-http2-switch.md under ### Added; README sentence matches the behaviour
  • No security surface: no secrets, no new inputs beyond a bool role variable
  • Unverified: nginx -t on a real host for the off case (rendered text only)

@shipmill-romamo

Copy link
Copy Markdown
Contributor Author

Reviewed at d0326e9: MERGE (review recorded). On hold: waits on #535, the merge gate reading main red.

pr_gate.py prints base: red: converge / converge failed on main@92481fc. That failure is job 135111539881 of the hotfix Release dispatch https://github.com/cloudfall-dev/cloudfall/actions/runs/44391818494, which ran main's converge.yml against 59bbeaa (the 0.7.1 hotfix branch, since deleted) where engine/tests/converge/project doesn't exist. Main's own converge / converge on 92481fc passed twice afterwards (runs 44391773941 and 44408318149). A rerun of the failed run would fail the same way and re-dispatches a release job, so it isn't the fix. This lands once #535 is fixed or main gets a new commit.

@shipmill-romamo

Copy link
Copy Markdown
Contributor Author

@romamo Decision needed: should #552 flip cloudfall_nginx_site_http2 to default false before it merges, as the veto relayed on #551 asks?
CI on d0326e9: 2 checks green

The veto on #551 ("veto: default false", 2026-11-19 13:09 UTC) was posted by the App as a relay and carries the agent marker. By D-16 it doesn't count as a veto, so nothing stops this PR from merging with default true once main is green (it is only held on #535 today).

  1. Flip the default to false on this branch (recommended): the role default becomes false, with the default-off test, the golden files re-rendered and the changelog line updated. Every managed vhost drops to HTTP/1.1 on its next domains run until the operator, or Turn cloudfall_nginx_site_http2 back on by default once Debian ships the NGINX2Root fix #555 later, turns HTTP/2 back on. This matches the advisory the relay cites (nginx 1.31.9, CVE-2026-123007, client-side HTTP/2) and is what Turn cloudfall_nginx_site_http2 back on by default once Debian ships the NGINX2Root fix #555 is built to revert
  2. Merge as is, default true: existing vhosts keep HTTP/2, and an operator turns it off by hand. Turn cloudfall_nginx_site_http2 back on by default once Debian ships the NGINX2Root fix #555 then becomes moot and gets closed

Reply here with a number or your own answer; shipmill takes this up on the tick after your reply.

@shipmill-romamo shipmill-romamo Bot added the needs-decision A shipmill session asked a question here; waits for a reply label Nov 19, 2026
@shipmill-romamo

Copy link
Copy Markdown
Contributor Author

Decision by @romamo, relayed by Claude Code

1

@shipmill-romamo shipmill-romamo Bot removed the needs-decision A shipmill session asked a question here; waits for a reply label Nov 19, 2026
The maintainer chose option 1 on #552's question: the managed vhost's
HTTPS server drops HTTP/2 by default, and an operator turns it back on
with the variable once the installed Nginx carries the HTTP/2 fix.

The golden files keep the HTTP/2-on shape: the routes test renders them
with the variable true, and a new role-default case proves the role's
default renders the vhost without http2 on 1.22.1 and 1.26.3.

Part of #551

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shipmill-romamo shipmill-romamo Bot changed the title Let operators turn HTTP/2 off on the managed Nginx vhost Turn HTTP/2 off by default on the managed Nginx vhost, with a switch to turn it on Nov 19, 2026

@shipmill-romamo shipmill-romamo Bot 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.

Review of 93fc258: MERGE

  • Takes up the maintainer's answer on this PR (option 1, relayed 2026-11-19 19:46 UTC): cloudfall_nginx_site_http2 defaults to false in defaults/main.yml and meta/argument_specs.yml; the template is unchanged from d0326e9, which the earlier review covered
  • Behaviour change, named in the changelog under ### Changed: every managed vhost renders without HTTP/2 on its next domains run; true renders as before
  • The golden files keep the HTTP/2-on shape and are now rendered with true; a new role-default case renders with the role default and must equal the golden minus its HTTP/2 spelling on 1.22.1 and 1.26.3, so it fails if the default goes back to true
  • README sentence now says how to turn HTTP/2 on; no unverified CVE claim in code or docs
  • ruff, mypy, ansible-lint on the role, and the nginx-site and domains tests (69) pass locally
  • Unverified: nginx -t on a real host for the off case (rendered text only)

This branch has not been deployed

No deployments
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.

cloudfall_nginx_site always enables HTTP/2; make it a switch, off by default

0 participants