Skip to content

fix: HTTPS behind Anubis, and the site on the usage screen - #3

Merged
marcos-mendez merged 3 commits into
masterfrom
fix/web-https-waf-usage
Oct 2, 2026
Merged

marcos-mendez merged 3 commits into
masterfrom
fix/web-https-waf-usage

Conversation

@marcos-mendez

Copy link
Copy Markdown
Contributor

Three Keel Web bugs from the maintainer's test screenshots (114, 024 and #2), and the dependencies for the WAF fixes of Keel-Linux/common#27.

114: no browser passed Anubis over HTTP

Root cause: Anubis sets its cookies Secure; SameSite=None; Partitioned. default-anubis served plain HTTP on port 80 only, so a browser never sent the cookies back and the challenge failed with "cookies disabled".

Default chosen: in the cloud modes, where Anubis is on, the front is HTTPS only. This is what decision 0042 sets for sites (redirect_http: true, the default certificate):

  • port 443 is the default server, with TLS 1.2/1.3, HTTP/2 and the machine's certificate (/usr/local/share/ca-certificates/cert.crt, /etc/ssl/private/cert.key);
  • that certificate is self-signed by keel-host-keys at the first boot, until the confconsole Certificate screen issues one through ACME at the same paths;
  • port 80 answers 301 to the same URL on HTTPS;
  • there is no HSTS while the certificate may be self-signed (0042, tls.hsts);
  • the site answers by name and by IP.

Anubis's cookie option is left at Secure: no mode with Anubis needs HTTP. A simple installation keeps Debian's site on port 80. It has no Anubis, so it has no cookie to carry.

The state hook refuses, and changes nothing, while the certificate or its key is missing. The package also activates nginx-reload, so an upgrade from 0.1.0 serves the new front at once.

024: the usage screen did not list the site

Root cause: Core's recipe ships overlay/etc/confconsole/services.txt with Webmin and SSH only (keel-core), and the web layer kept it. confconsole itself is not involved: its default template lists Web, but Core's overlay replaces it. So there is no confconsole change, and nothing overlaps confconsole#16.

The web recipe's overlay now ships its own services.txt, with Web: http://<address> first, IPv6 then IPv4. Port 80 serves the site in simple mode and redirects to HTTPS behind Anubis, so the one URL is right in every mode. conf.d/main fails the build when the usage screen does not list the site.

#2: Anubis's challenge returned 500 without gzip

Root cause: upstream Anubis refuses one request in 64 at random from clients without gzip (Keel-Linux/anubis#2). keel-web 0.1.1 depends on anubis (>= 1.27.0-0+keel2) and on keel-overlay-coraza (>= 0.1.2). Closes #2.

Evidence (LXC container of the step7b Web image, moved to cloud_simple with keel spec apply, these packages installed)

Chromium (playwright-core, normal Chrome user agent), through a relay of the test VM:

start challenge pass-challenge final cookies
http://web.keel.test/ 301 → https://web.keel.test/, "Making sure you're not a bot!" 302 https://web.keel.test/, "Keel Web" auth + verification, both Secure
http://[fd42:…:fe06]/ 301 → https, challenge 302 page same
http://10.0.3.158/ 301 → https, challenge 302 page same
  • An XSS URL and a SQLi URL get 403, and the audit log names the rules.
  • 200 browser loads with Accept-Encoding: identity got 200 × 200.
  • The console usage screen lists Web: http://[…] and Web: http://10.0.3.158.

Unit tests: bats gives 73 + 25 passing tests. COVERAGE_THRESHOLD=100 tests/coverage.sh gives anubis-front 84/84, conf.d/main 20/20 and boot-test-lib 109/109. The package build is lintian-clean.

Test plan

Anubis sets its cookies Secure, and the front of the default site served
plain HTTP only, so no browser passed the challenge by name (the
maintainer's screenshot 114). default-anubis now serves port 443 as the
default server with TLS 1.2 and 1.3, HTTP/2 and the machine's
certificate, /usr/local/share/ca-certificates/cert.crt and
/etc/ssl/private/cert.key, the default of decision 0042: self-signed by
keel-host-keys at the first boot until the confconsole Certificate
screen issues one through ACME (0042), at the same paths. Port 80
answers 301 to the same URL on HTTPS (0042, redirect_http). No HSTS,
which over a self-signed certificate locks visitors out (0042,
tls.hsts). By name and by IP alike, as the usage screen shows the IP.
Simple installations keep Debian's site on port 80: no Anubis, so no
cookie to carry. The state hook refuses, changing nothing, while the
certificate or its key is missing, and the package activates
nginx-reload so an upgrade serves the new front at once.

Core's recipe ships a usage screen of Webmin and SSH only, and the web
layer kept it (screenshot 024). The overlay now ships
/etc/confconsole/services.txt with "Web: http://<address>" first, IPv6
then IPv4; port 80 serves the site in simple and redirects to HTTPS
behind Anubis, so the one URL is right in every mode. conf.d/main fails
the build when the usage screen does not list the site.

keel-web 0.1.1 depends on keel-overlay-coraza 0.1.2 (the WAF lets
Anubis's pass-challenge through by IP, and its audit log names the rule
that blocked) and anubis 1.27.0-0+keel2 (the challenge for clients that
do not accept gzip, instead of HTTP 500 to one in 64 at random).

Closes #2
- 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.
…gin check

anubis-redirect-domains built Anubis's allowed list from hostname and ip
addr at each start, never at spec apply, so a new DNS name, a 0042 site
or a public IP behind NAT failed with redirect_domain_not_allowed after
the challenge. anubis 1.27.0-0+keel3 (Keel-Linux/anubis#3) closes the
open redirect itself while REDIRECT_DOMAINS is empty: redir must be
relative or name the request's own scheme, host and port, never with
userinfo. So keel-web drops the generator, its unit, the drop-in and the
postinst, depends on anubis (>= 1.27.0-0+keel3), and drops iproute2.

Measured on the Keel Web container (step7b image, cloud_simple, these
packages): Chromium passes the challenge by unlisted.keel.test (in
neither /etc/hosts nor DNS of the machine, sent as Host), by IPv6 and by
IPv4. With the browser's pass-challenge rewritten to redir
https://evil.example/, //evil.example/ or https://a@evil.example/,
Anubis answers "Redirect domain not allowed" and the browser sends
nothing to evil.example. tests: 100 bats, coverage 100 percent for the
three shell files.
@marcos-mendez
marcos-mendez merged commit ae46b34 into master Oct 2, 2026
5 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