Repository navigation
Adds what an operator needs around the gate: counters for every outcome,
ready-made crawler rules, more inputs for the policy map, and clearances that
survive a restart without Redis. All of it is opt-in; an existing configuration
keeps working unchanged. Built for nginx mainline 1.31.10 and nginx
stable 1.30.7.
What changed
- Metrics.
pow_gate_status;in a location serves counters per
(result, reason)in the Prometheus text format, shared across workers and
kept across a reload, plus the load gauges. See
Metrics. - Bundled rules.
rules/holdsmapincludes for AI
crawlers, search engines and automation tools, and verifier blocks with the
published range feeds of Google, Bing, DuckDuckGo, Apple, OpenAI and
Perplexity.scripts/robots2map.pyturns arobots.txtintomapentries.
The files are in the repository at this tag, not in the release artifacts. - Weighted scoring.
pow_gate_weights $a $b …;sums integer signals into
$pow_gate_score, which amapturns into a decision. - Load-adaptive difficulty.
$pow_gate_load(one-minute load as a
percentage of the CPUs) and$pow_gate_load_1mfeed
pow_gate_difficulty_scale $var;, a multiplier for newly issued challenges.
Clients that are already cleared are not challenged again when load rises. - Restart survival.
pow_gate_state_file <file>;keeps the store identity
on disk, so clearances survive a full restart on a single instance.
Challenges and no-JS grants issued before the restart are refused, because
the record of which ones were already redeemed is lost with the restart. - Honeypot. The embedded challenge page carries a hidden link to
{endpoint}trap. A hit is answered with404, logged as
result=honeypotwith awarnline for fail2ban, and counted. The module
does not block the client itself. deny:<status>. A decision can refuse with any status from 400 to 599;
deny:444closes the connection without a response.pow_gate_cookie_partitioned on;addsPartitioned(and forces
Secure) for gated content inside third-party iframes.- Link previews.
examples/link-previews.conf
admits preview fetchers: checked against the operator's ASN where it owns its
network, by User-Agent otherwise, and rate-limited in both cases.
New how-tos: Use the bundled rules,
Keep link previews working and
Monitor the gate.
Upgrade notes
- Protocol and cookies are unchanged. Protocol v2 clients, cookie names and
existing configurations work as before. /verifyaccepts a challenge at or above the location's difficulty
instead of exactly equal. This is what lets a load surcharge apply to new
challenges only. A challenge below the required difficulty is still rejected.- Replacing the module needs a restart, which invalidates clearances once
unless Redis is configured. Addingpow_gate_state_filetakes effect from
the next restart on: the first start creates the file, later ones restore it. - Do not share a state file between instances, and prefer a service restart
over nginx's binary-upgrade procedure while it is set. See
Restart survival. - Custom challenge pages do not get the honeypot link automatically; see
challenge-page.md. - Memory: the counters reserve one additional 256 KiB shared-memory zone
per instance. - Map regexes containing
{or}must be quoted in nginx, for example
"~^\d{3,}$". The bundled examples do this.
Dependencies and toolchain
ureq3,p2560.14,sha20.11,hmac0.13,getrandom0.4 and a
refreshed lockfile. This clears five RustSec advisories in dependencies:
RUSTSEC-2026-0204 (crossbeam-epoch), RUSTSEC-2026-0381 (webpki-roots),
RUSTSEC-2026-0382 (rustls-webpki), RUSTSEC-2026-0387 (crypto-bigint) and
RUSTSEC-2026-0592 (url).webpki-rootsis the trust store of the HTTPS
client that fetches crawler range feeds.- Release modules are built with Rust 1.100. The musl build moved to Alpine
3.24 with clang 20, the same Alpine release as thenginx:alpineimage. - Building from source now needs Rust 1.88 or newer.
Performance
A before/after comparison against v0.6.2 on Linux/amd64 shows no measurable
change from the new features or the dependency upgrades: cleared, proof and
challenge requests stay within 1% in the four-worker layout, the same as the
ungated control. A profile-guided pass over the request path then makes cleared
requests about 3% faster (3.6% less worker CPU per request on one pinned
worker): headers are read through nginx's own pointers without lossy
conversion, the clearance payload is parsed without heap buffering, and each
worker counts outcomes in its own row. Portable P-256
verification in pow-gate-core is about 12% slower with p256 0.14; the nginx
module verifies with ring and is not affected. Details and raw results are in
performance.md.
A module must match the exact nginx version, libc and architecture of its
runtime.
Artifacts
| nginx | libc | arch | Module |
|---|---|---|---|
| 1.31.10 | glibc | amd64 | ngx_http_pow_gate_module-0.7.0-nginx1.31.10-glibc-amd64.so |
| 1.31.10 | glibc | arm64 | ngx_http_pow_gate_module-0.7.0-nginx1.31.10-glibc-arm64.so |
| 1.31.10 | musl | amd64 | ngx_http_pow_gate_module-0.7.0-nginx1.31.10-musl-amd64.so |
| 1.31.10 | musl | arm64 | ngx_http_pow_gate_module-0.7.0-nginx1.31.10-musl-arm64.so |
| 1.30.7 | glibc | amd64 | ngx_http_pow_gate_module-0.7.0-nginx1.30.7-glibc-amd64.so |
| 1.30.7 | glibc | arm64 | ngx_http_pow_gate_module-0.7.0-nginx1.30.7-glibc-arm64.so |
| 1.30.7 | musl | amd64 | ngx_http_pow_gate_module-0.7.0-nginx1.30.7-musl-amd64.so |
| 1.30.7 | musl | arm64 | ngx_http_pow_gate_module-0.7.0-nginx1.30.7-musl-arm64.so |
Each module includes a .sig signature and .pem certificate. SHA256SUMS
covers all eight modules. The release workflow requires two independent,
byte-identical builds per module and attaches GitHub build-provenance
attestations before publishing.
Verify
Download your module, its .sig and .pem, and SHA256SUMS, then run:
module=ngx_http_pow_gate_module-0.7.0-nginx1.31.10-glibc-amd64.so
sha256sum -c --ignore-missing SHA256SUMS
gh attestation verify "$module" --repo teian/ngx_http_pow_gate
cosign verify-blob \
--certificate "$module.pem" \
--signature "$module.sig" \
--certificate-identity 'https://github.com/teian/ngx_http_pow_gate/.github/workflows/release.yml@refs/tags/v0.7.0' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
"$module"