Repository navigation
fix: serve the challenge to clients that do not accept gzip - #2
Merged
Merged
Conversation
Upstream's RenderIndex refused one challenged request in 64, at random, with HTTP 500 when the client did not list gzip in Accept-Encoding. A missing Accept-Encoding accepts any coding (RFC 9110, 12.5.3), and real clients send none (curl by default, some accessibility and archiving tools, proxies that strip it), so Keel Web answered them 500 at random instead of the proof of work (Keel-Linux/keel-web#2). Upstream's #1958, after 1.27.0, only changes the status to the policy's DENY and keeps the sampling. debian/patches/challenge-without-gzip.patch drops the sampled refusal and adds TestNonGzipClientGetsChallenge (4096 requests each without Accept-Encoding, with identity and with br, all challenged; it failed at request 67 before the patch). TestChallengeFor_ErrNotFound, skipped as flaky because of the refusal, runs again. The autopkgtest sends 512 requests without Accept-Encoding through nginx and expects the challenge page with 200 every time. 1.27.0-0+keel2.
2 tasks
…drops the sampling Forwarded: no instead of not-needed. The header names upstream #501, which brought the sampled refusal, and #1958, which only changed its status and left the sampling to a discussion of its own, and says why Keel drops it: a DENY page is still an error for a legitimate client, any scraper sends gzip for free, and the proof of work is the real defence.
Keel Web closes pass-challenge's open redirect by setting REDIRECT_DOMAINS to the machine's names and addresses (Anubis compares the host of redir with itself when it is unset). The host of an IPv6 URL is [2001:db8::1], but main refused that entry at start: url.Parse reads it as a path whose first segment has a colon. Measured on the Keel Web container: anubis@keel exited with "cannot parse redirect-domain". debian/patches/redirect-domains-ipv6.patch accepts an entry that parses as the host of a URL, or as a URL as before, and adds TestParseRedirectDomains (it failed to build before the change).
marcos-mendez
added a commit
to Keel-Linux/keel-web
that referenced
this pull request
Oct 2, 2026
- default-anubis: ssl_ciphers is common's zz-ssl-ciphers list (Mozilla intermediate, forward secret only) with TLS 1.2 and 1.3 and ssl_prefer_server_ciphers off. Measured: TLS 1.1 and the non-PFS AES128-SHA and AES128-GCM-SHA256 are refused, 1.2 gets ECDHE-RSA-AES256-GCM-SHA384, 1.3 TLS_AES_256_GCM_SHA384. - HSTS once ACME issues a CA's certificate, and the 443 listen lines a tls-passthrough site must take away, are TODOs in the front linked to Keel-Linux/tracker#51, the implementation of decision 0042. - Anubis's pass-challenge redirected a solved challenge to any host: it compares redir's host with itself unless REDIRECT_DOMAINS is set. anubis-redirect-domains writes it from the machine's short name, fqdn and global addresses (IPv6 bracketed), failing when there is none; keel-web-anubis-domains.service runs it before each start, required by a drop-in of anubis@keel.service (systemd reads an EnvironmentFile before ExecStartPre: measured, the unit failed with "resources"). postinst reloads systemd and try-restarts a running Anubis. Depends on iproute2; IPv6 entries need anubis 1.27.0-0+keel2 (Keel-Linux/anubis#2). Measured on the Keel Web container: REDIRECT_DOMAINS=web,10.0.3.86, [fd42:...:f02a],[fd42:...:6554]; Chromium passes the challenge by name, IPv6 and IPv4, and by a name that is not the machine's it gets Anubis's "Oh noes!" from pass-challenge instead of a redirect. tests: 110 bats, coverage 100 percent for the four shell files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Keel-Linux/keel-web#2: the Anubis challenge returned 500 to clients that do not accept gzip.
Root cause
The cause is in Anubis, not in Coraza (common#25's
coraza_delay_response_headers offand the module patch of libnginx-mod-http-coraza#3 are not involved). Upstream 1.27.0'sRenderIndex(lib/http.go) refuses one challenged request in 64, at random, whenAccept-Encodingdoes not containgzip. The refusal goes throughrespondWithError(HTTP 500), with the log lineclient was given a challenge but does not in fact support gzip compression. That line is in Anubis's log of the step 7 run, next to the 500.A missing
Accept-Encodingmeans any coding is acceptable (RFC 9110, 12.5.3), and real clients send none: curl by default, some accessibility and archiving tools, and proxies that strip the header. They got a server error at random and never reached the proof of work, which is the actual defence. Upstream's #1958 (after 1.27.0) only changes the status to the policy's DENY and keeps the sampling, so even with it these clients get an error page instead of the challenge.Change (1.27.0-0+keel2)
debian/patches/challenge-without-gzip.patch(DEP-3) drops the sampled refusal. It addsTestNonGzipClientGetsChallenge: 4096 requests each withoutAccept-Encoding, withidentityand withbr, and all must be challenged. Before the patch it failed at request 67 with status 500.debian/rules:TestChallengeFor_ErrNotFound, skipped as flaky because of this refusal, runs again.behind-nginx: 512 requests withoutAccept-Encodingthrough nginx must all get the challenge page with 200. The old code passes this by chance about once in 3000 runs.Evidence
dpkg-buildpackage -bon trixie with golang-1.26: every Go test passes, including the new one. lintian is clean.Accept-Encodingover HTTPS got 300 × 200;Accept-Encoding: identity(checked in Nginx's log) and got 200 × 200, with no 500 and no gzip refusal in Anubis's journal.Test plan
build / trixie(build plus autopkgtest in the LXC container) green