Skip to content

fix: serve the challenge to clients that do not accept gzip - #2

Merged
marcos-mendez merged 3 commits into
keel/trixiefrom
fix/challenge-without-gzip
Oct 2, 2026
Merged

marcos-mendez merged 3 commits into
keel/trixiefrom
fix/challenge-without-gzip

Conversation

@marcos-mendez

Copy link
Copy Markdown
Contributor

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 off and the module patch of libnginx-mod-http-coraza#3 are not involved). Upstream 1.27.0's RenderIndex (lib/http.go) refuses one challenged request in 64, at random, when Accept-Encoding does not contain gzip. The refusal goes through respondWithError (HTTP 500), with the log line client 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-Encoding means 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 adds TestNonGzipClientGetsChallenge: 4096 requests each without Accept-Encoding, with identity and with br, 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.
  • autopkgtest behind-nginx: 512 requests without Accept-Encoding through nginx must all get the challenge page with 200. The old code passes this by chance about once in 3000 runs.

Evidence

  • dpkg-buildpackage -b on trixie with golang-1.26: every Go test passes, including the new one. lintian is clean.
  • On the Keel Web container (step7b image, cloud_simple), with this package:
    • 300 curl requests as Googlebot without Accept-Encoding over HTTPS got 300 × 200;
    • Chromium sent 200 navigations with 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
  • Released together with Keel-Linux/keel-web's PR, whose keel-web 0.1.1 depends on anubis (>= 1.27.0-0+keel2)

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.
…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.
@marcos-mendez
marcos-mendez merged commit d1f5eac into keel/trixie Oct 2, 2026
4 checks passed
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.

Anubis challenge returns 500 to clients that do not accept gzip

1 participant