商业产业 Hacker News AI 2026-10-10T15:27 正文 ok 1654 words

Show HN:Sibuna——采用工作量证明的开源 Web 应用防火墙

英文标题:🔶 Show HN: Sibuna an open source web application firewall with proof of work

Sibuna 是一款开源 Web 应用防火墙,可通过浏览器端工作量证明挑战、签名会话、访问策略和本地限流,帮助网站及 API 降低非预期机器人流量的影响。它支持反向代理与 forward_auth 两种部署模式,可配合 Caddy、nginx 或 Traefik 使用,并内置 SQL 注入、XSS 和路径遍历检测,以及可选的 OWASP CRS 支持。项目以单一可执行文件提供引擎、嵌入式存储、浏览器求解器和运营控制台,覆盖 Linux、macOS、Windows 及部分 BSD 平台。基准测试显示,在所列测试负载中,Sibuna Gate 和 Shield 的请求吞吐量接近直接访问源站,但项目也明确说明这些测试不代表等效防护能力或机器人识别准确率。
打开原文相关 2 · 机会 2
media6.1 KB media93.8 KB media48.9 KB media65.0 KB media100.9 KB media9.8 KB media9.8 KB media9.3 KB media9.3 KB media5.8 KB media5.8 KB media69.3 KB

中文

通过浏览器工作量证明和可选控制台提供 Web 防护。

**Sibuna 可帮助保护网站和 API 免受非预期机器人流量的影响。**它可以将请求转发至你的应用,也可以与现有代理协同工作,例如 Caddy、nginx 或 Traefik。

发送请求通常成本很低,而处理请求可能需要你的应用付出更多成本。Sibuna 会要求客户端在获得访问权限前解决一道谜题。该谜题被设计为:生成工作量证明所需的计算成本高于验证它所需的计算成本。自动化客户端因此需要分担更多访问网站的成本。

计算同样会消耗能源,但具体消耗量取决于硬件和配置。工作量证明会增加准入成本;它并不能证明访问者是人类,也无法阻止所有攻击。已获准客户端可通过签名会话再次访问,而不必在每次请求时都解决新谜题。请使用访问规则和本地速率限制,控制这些客户端后续可请求的内容。

  • **单一可执行文件:**包含引擎、嵌入式存储、浏览器求解器和控制台资源。
  • **原生软件包:**支持 Linux、macOS 和 Windows。浏览器求解器使用 WebAssembly。
  • **浏览器挑战:**可配置 Hashcash 或顺序工作量证明,随后发放签名会话。
  • **访问策略:**可根据地址、路径、请求头和 User-Agent 允许、挑战或拒绝请求。
  • **应用检查:**内置 SQL 注入、XSS 和路径遍历检测。
  • **可选 OWASP CRS:**支持已签名规则更新、Audit 与 Enforce 模式、私有测试及回滚。
  • **本地速率限制:**控制突发流量和持续流量,并可选择按规则设置限制。
  • **运营控制台:**提供流量、抽样国家/地区活动、已记录事件和策略编辑功能。
  • **集群支持:**独立的源代码构建版本可通过 Zaxonlite 复制策略与信誉数据。

下载发行版以适配你的平台。默认软件包包含存储和控制台支持。使用 --console 启动控制台。

平台 软件包 要求
Linux x86-64 sibuna-linux-amd64.tar.gz Linux 5.10 或更高版本;静态链接 musl
Linux ARM64 sibuna-linux-arm64.tar.gz Linux 5.10 或更高版本;静态链接 musl
macOS Apple Silicon sibuna-macos-arm64.tar.gz macOS 15 或更高版本
macOS Intel sibuna-macos-amd64.tar.gz macOS 15 或更高版本
Windows x86-64 sibuna-windows-amd64.zip Windows 10 / Server 2019 或更高版本;原生 sibuna.exe
FreeBSD x86-64 sibuna-0.3.5-freebsd-15.1-amd64.pkg FreeBSD 15.1;CLI 软件包
OpenBSD x86-64 sibuna-0.3.5.tgz OpenBSD 7.9;CLI 软件包

macOS 构建版本未签名。每个软件包均包含许可证、源代码链接和构建清单。使用前,请根据 SHA256SUMS 验证归档文件。

Debian/RPM 软件包覆盖 Linux x86-64 和 ARM64;Arch 的 sibuna-bin 覆盖 x86-64。FreeBSD 15.1 和 OpenBSD 7.9 软件包覆盖 x86-64,并安装 CLI。Linux 软件包包含一个可选但默认禁用的 systemd 服务。BSD 软件包不会创建服务、账户或状态数据。这些是上游下载;社区软件仓库是否接纳则另行决定。该发行版还包含一个 Homebrew 源码 formula 和 Helm chart。有关安装、验证、私有状态、升级及 Kubernetes 配置,请参阅软件包操作指南。

Sibuna Homebrew tap 提供一个从源代码构建的 CLI formula。安装不会启动服务:

brew tap insanai/sibuna
brew install insanai/sibuna/sibuna
sibuna --version

对于 Linux x86-64,假设你的应用监听 3000 端口:

curl -fLO https://github.com/insanai/sibuna/releases/download/v0.3.5/sibuna-linux-amd64.tar.gz
curl -fLO https://github.com/insanai/sibuna/releases/download/v0.3.5/SHA256SUMS
sha256sum --ignore-missing -c SHA256SUMS
tar -xzf sibuna-linux-amd64.tar.gz
(umask 077; openssl rand -hex 32 > sibuna.seed)
./sibuna --host 127.0.0.1 --port 8080 --upstream-port 3000 --secret-file ./sibuna.seed

打开 http://127.0.0.1:8080 即可在本地试用。对于公开网站,请在可信入口处终止 HTTPS,并保持 Sibuna 的监听器处于私有网络中。有关 Caddy 或 nginx 的部署方式,请遵循部署指南。

默认模式为 reverse_proxy。当你的入口转发请求并向 Sibuna 请求访问决策时,请使用 --mode forward_auth。指南包含这两种配置。Shield 的内置检查器默认启用。如仅需准入控制而不使用该检查器,请使用 --gate。使用 --policy-file <file> 选择访问规则,其中可包括针对无法运行浏览器挑战的 API 客户端和健康检查的规则。

在 Windows 上,解压 ZIP 文件后,在 PowerShell 中运行 .\sibuna.exe --help。使用 Ctrl+C 停止服务。请通过 Windows ACL 限制对 seed、凭据和数据文件的访问。

使用 Zig 0.17.0。固定的工具链校验和与依赖源位于代码仓库中。

git clone git@github.com:insanai/sibuna.git
cd sibuna
python3 tools/prepare_build.py
zig build -Doptimize=safe -j2

可执行文件位于 zig-out/bin/sibuna。集群构建使用 -Dcluster=true,并需要 OpenSSL 3。构建检查详见 CONTRIBUTING.md。

CRS 默认禁用。下载并验证一个受支持的已签名发行版,然后以 Audit 模式启动,以便在不应用 CRS 拒绝规则的情况下审查发现结果:

./sibuna crs check --version 4.30.0 --output ./crs-candidate
./sibuna --host 127.0.0.1 --upstream-port 3000 --secret-file ./sibuna.seed \
  --crs-mode audit --crs-dir ./crs-candidate

请使用新的候选目录。检查候选版本不会改变正在运行的守护进程。CLI 和控制台可用于准备更新、审查变更并选择已验证的候选版本。在测试应用的正常流量并审查排除规则后,再启动 Enforce 模式。有关更新、回滚、请求体限制和不完整检查,请参阅 CRS 指南。forward-auth 要求使用 --crs-profile headers;它无法查看完整的应用请求体。

控制台运行在同一个可执行文件中。请在守护进程停止时引导创建管理员:

./sibuna init-admin admin --data-dir ./data
./sibuna --host 127.0.0.1 --upstream-port 3000 --secret-file ./sibuna.seed \
  --data-dir ./data --console 127.0.0.1:19446

打开 http://127.0.0.1:19446/console/ 并修改临时密码。操作指南说明了 HTTPS 访问、GeoIP 导入和 CRS 更新。将上例中的 CRS 标志追加到命令中,即可在控制台旁启用检查。

Sibuna 控制台的地球、请求时间线和覆盖情况

地球显示过去一分钟内经过抽样的国家/地区活动。标记显示大致的国家/地区位置。箭头指向服务器的配置位置,而非显示单个实时连接。GeoIP 需要单独导入数据集。使用 --console-location <latitude,longitude> 在地球上放置服务器位置。

流量概览、策略编辑器和事件调查

流量概览——请求结果、观测窗口和实时更新。

Sibuna 控制台流量概览,显示已准入、已挑战和已拒绝请求计数器

策略编辑器——一个示例结账挑战规则,包含明确的匹配器和设置。

Sibuna 控制台策略编辑器,展示针对结账流程的挑战规则草稿

事件调查——已记录证据,以及有边界限制、经过脱敏处理的请求头信息。

Sibuna 控制台事件证据,包含脱敏请求头和响应状态

这些图片是在审查节点上通过 Chrome 截取的 v0.2.0 版本界面。流量和 GeoIP 映射均为测试数据。显示的计数并非基准测试结果。

请求可以被准入、挑战或拒绝。成功完成挑战的访问者会获得签名会话。后续请求仍将通过适用的策略和速率检查。

解决谜题、获取签名会话,并在后续请求中检查规则

Gate 会检查访问规则、会话和本地速率限制。Shield 则增加内置攻击检查器。原生 CRS 需单独配置。在启用 Enforce 前,应先以 Audit 模式启动,以审查检测结果。

Gate、Shield 与 Sibuna 内部模块 Gate 和 Shield 的请求决策:允许、挑战或拦截

该图展示了内置的 Gate 和 Shield 检查。可选 CRS 会增加自己的检查机制。有效会话不会绕过适用的攻击检查或请求限制。

Sibuna 内部各模块的职责

这些模块将网络、证明、策略、本地状态和管理功能分离。技术手册说明了它们各自的职责。

Sibuna 在其私有监听器上使用 HTTP/1.1。你的入口负责处理公开 TLS 和 HTTP/2。forward-auth 会检查入口提供的元数据。完整的反向代理 CRS 检查使用已配置的请求体和工作量限制。内置检查器覆盖前 8 KiB。禁用 CRS 时,上传内容会以流式方式传输。WebSocket 消息会被中继,但不接受检查。完整 CRS 默认设置 4 MiB 请求限制和 1 MiB 响应限制,并会缓冲请求体以供检查。Enforce 会拒绝不完整检查;在启用前,请为你的应用审查限制和流式传输例外情况。

速率限制仅在每个节点本地生效。Sibuna 不提供大规模网络流量缓解能力。严格的控制台性能目标尚未正式通过。请在生产应用旁启用控制台前,审阅部署限制和测量数据。

技术手册会记录每次运行所用的源代码修订版本、配置和主机。这些测量结果展示的是单一工作负载下的请求成本,并不衡量等效防护能力或机器人识别准确率。

本次测试于 2026 年 10 月 4 日比较了 Sibuna v0.2.0、Anubis 1.27.0 和 BunkerWeb 1.6.15。服务器和请求生成器运行在不同的物理主机上。每个产品配置四个 CPU、64 个连接,并使用相同的 Caddy 源站。挑战和管理界面均未启用。下表为五次运行的中位数。

配置 正常 GET(req/s) p99(ms) 8 KiB JSON POST(req/s) p99(ms)
直接访问源站 70,759 4.67 13,719 9.01
Sibuna Gate 71,270 4.12 13,719 9.16
Anubis 28,277 7.50 13,718 9.20
BunkerWeb,CRS 关闭 13,617 8.27 12,300 8.94
Sibuna Shield 70,909 4.06 13,719 9.08
BunkerWeb,CRS 开启 2,730 32.73 797 98.42

在此表中,BunkerWeb 的 CRS 配置文件检查内容多于 v0.2.0 Shield 配置文件。Sibuna v0.3.0 新增原生 CRS;本次比较早于该引擎。两台主机均为共享容器。CPU 频率和无关的主机活动未受控制。

另一轮单独测试使用了八个仪表板、四个产品 CPU,以及来自另一台主机的 16 个连接。下表显示五轮测试的中位速率。内置检查器已禁用。

工作负载 CRS 禁用(req/s) Audit,paranoia 1(req/s) Audit,paranoia 2(req/s)
小型 GET 47,311 10,787 7,423
8 KiB JSON POST 13,726 1,151 799
16 KiB multipart 上传 6,704 4,248 2,887

在 paranoia one 级别下,这些工作负载的 p99 延迟分别为 2.34 ms、23.43 ms 和 6.34 ms。不同 CRS 配置下,进程 RSS 峰值为 133.8–140.5 MiB。没有任何已测请求达到工作量限制。该测试使用干净修订版本 d461e7f。其负载数据和并发度不同于三产品比较,因此两张表不能构成严格配对比较。

有关范围、CPU、内存、Enforce 结果和重放命令,请参阅基准测试记录。这些数据并未通过单独的控制台影响门槛。

可考虑的其他软件

  • Anubis:通过浏览器挑战减少爬虫流量。
  • BunkerWeb:提供 nginx、ModSecurity、CRS 和机器人挑战。
  • ModSecurity:通过连接器使用的 WAF 引擎。
  • Coraza:支持 ModSecurity 规则和 CRS 的 Go WAF 库。
  • OWASP Core Rule Set:面向 WAF 引擎的攻击检测规则。

这些项目覆盖 Web 防护的不同领域。Sibuna 会评估已签名的标准 CRS 发行版。插件、Lua 和其他 ModSecurity 规则集不在其支持范围内。

引擎采用 LGPL 3.0 许可证。控制台及其 WebAssembly 界面采用 AGPL 3.0 许可证。默认可执行文件结合两者,并以 AGPL 3.0 分发。使用 -Dconsole=false 可在不包含控制台的情况下构建引擎。

LICENSE 说明了适用范围。

English / 原文

Web protection with browser proof of work and an optional console.

Features · Quickstart · Console · How it works · Documentation

English · 简体中文 · 한국어 · 日本語 · Español · Deutsch · हिन्दी · العربية

Sibuna helps protect websites and APIs from unwanted bot traffic. It can forward requests to your app or work alongside an existing proxy, such as Caddy, nginx or Traefik.

Sending requests is often cheap. Processing them can cost your app more work. Sibuna asks clients to solve a puzzle before granting access. The puzzle is designed to make proof creation cost more computation than verification. Automated clients share more of the cost of accessing a site.

Computing also uses energy, but the amount depends on hardware and settings. Proof of work adds an admission cost. It does not prove that a visitor is human or stop every attack. A signed session lets admitted clients return without solving a new puzzle on every request. Use access rules and local rate limits to control what those clients can request afterwards.

  • One executable: engine, embedded storage, browser solver and console assets.
  • Native packages: Linux, macOS and Windows. The browser solver uses WebAssembly.
  • Browser challenges: configurable Hashcash or sequential work, followed by a signed session.
  • Access policies: allow, challenge or deny requests by address, path, headers and User-Agent.
  • Application inspection: built-in checks for SQL injection, XSS and path traversal.
  • Optional OWASP CRS: signed rule updates, Audit and Enforce modes, private tests and rollback.
  • Local rate limits: control bursts and sustained traffic, with optional limits per rule.
  • Operator console: traffic, sampled country activity, recorded incidents and policy editing.
  • Cluster support: a separate source build replicates policy and reputation through Zaxonlite.

Download a release for your platform. The default package includes storage and console support. The console starts with --console.

Platform Package Requirements
Linux x86-64 sibuna-linux-amd64.tar.gz Linux 5.10 or later; statically linked musl
Linux ARM64 sibuna-linux-arm64.tar.gz Linux 5.10 or later; statically linked musl
macOS Apple Silicon sibuna-macos-arm64.tar.gz macOS 15 or later
macOS Intel sibuna-macos-amd64.tar.gz macOS 15 or later
Windows x86-64 sibuna-windows-amd64.zip Windows 10 / Server 2019 or later; native sibuna.exe
FreeBSD x86-64 sibuna-0.3.5-freebsd-15.1-amd64.pkg FreeBSD 15.1; CLI package
OpenBSD x86-64 sibuna-0.3.5.tgz OpenBSD 7.9; CLI package

macOS builds are unsigned. Each package includes licenses, source links and a build manifest. Verify the archive against SHA256SUMS before using it.

Debian/RPM packages cover Linux x86-64 and ARM64; Arch sibuna-bin covers x86-64. FreeBSD 15.1 and OpenBSD 7.9 packages cover x86-64 and install the CLI. Linux packages include an optional, disabled systemd service. BSD packages create no service, account or state. These are upstream downloads; community archive acceptance is separate. The release also includes a Homebrew source formula and a Helm chart. See the package operations guide for installation, verification, private state, upgrades and Kubernetes setup.

The Sibuna Homebrew tap provides a source-built CLI formula. Installation does not start a service:

brew tap insanai/sibuna
brew install insanai/sibuna/sibuna
sibuna --version

For Linux x86-64, with your app listening on port 3000:

curl -fLO https://github.com/insanai/sibuna/releases/download/v0.3.5/sibuna-linux-amd64.tar.gz
curl -fLO https://github.com/insanai/sibuna/releases/download/v0.3.5/SHA256SUMS
sha256sum --ignore-missing -c SHA256SUMS
tar -xzf sibuna-linux-amd64.tar.gz
(umask 077; openssl rand -hex 32 > sibuna.seed)
./sibuna --host 127.0.0.1 --port 8080 --upstream-port 3000 --secret-file ./sibuna.seed

Open http://127.0.0.1:8080 to try it locally. For a public site, terminate HTTPS at a trusted ingress and keep Sibuna's listener private. Follow the deployment guide for Caddy or nginx.

The default mode is reverse_proxy. Use --mode forward_auth when your ingress forwards requests and asks Sibuna for an access decision. The guide includes both configurations. Shield's built-in inspection is enabled by default. Use --gate for admission without that inspector. Choose access rules with --policy-file <file>, including rules for API clients and health checks that cannot run a browser challenge.

On Windows, extract the ZIP and run .\sibuna.exe --help in PowerShell. Use Ctrl+C to stop it. Restrict access to seed, credential and data files with Windows ACLs.

Use Zig 0.17.0. The pinned toolchain checksums and dependency sources are in the repository.

git clone git@github.com:insanai/sibuna.git
cd sibuna
python3 tools/prepare_build.py
zig build -Doptimize=safe -j2

The executable is zig-out/bin/sibuna. Cluster builds use -Dcluster=true and need OpenSSL 3. See CONTRIBUTING.md for build checks.

CRS is disabled by default. Download and verify a supported signed release, then start in Audit to review findings without applying CRS denials:

./sibuna crs check --version 4.30.0 --output ./crs-candidate
./sibuna --host 127.0.0.1 --upstream-port 3000 --secret-file ./sibuna.seed \
  --crs-mode audit --crs-dir ./crs-candidate

Use a new candidate directory. Checking a candidate does not change a running daemon. The CLI and console can prepare updates, review changes and select a verified candidate. Start Enforce after testing your application's normal traffic and reviewing exclusions. See the CRS guide for updates, rollback, body limits and incomplete inspection. Forward-auth requires --crs-profile headers; it does not see full application bodies.

The console runs in the same executable. Bootstrap an administrator while the daemon is stopped:

./sibuna init-admin admin --data-dir ./data
./sibuna --host 127.0.0.1 --upstream-port 3000 --secret-file ./sibuna.seed \
  --data-dir ./data --console 127.0.0.1:19446

Open http://127.0.0.1:19446/console/ and change the temporary password. The operations guide explains HTTPS access, GeoIP imports and CRS updates. Append the CRS flags from the example above to enable inspection alongside the console.

Sibuna Console globe, request timeline and coverage

The globe shows sampled country activity over the last minute. Markers give approximate country positions. Arrows point toward the server's configured location. They do not show individual live connections. GeoIP needs a separately imported dataset. Set --console-location <latitude,longitude> to place the server on the globe.

Traffic overview, policy editor and incident investigation

Traffic overview — request outcomes, observation windows and live updates.

Sibuna Console traffic overview with admitted, challenged and denied request counters

Policy editor — a sample checkout challenge rule, with explicit matchers and settings.

Sibuna Console policy editor with a draft challenge rule for checkout

Incident investigation — recorded evidence and bounded, redacted request heads.

Sibuna Console incident evidence with redacted headers and response state

These are Chrome captures of v0.2.0 on a review node. Traffic and GeoIP mappings are test data. The displayed counts are not benchmark results.

A request can be admitted, challenged or denied. A visitor who solves a challenge receives a signed session. Later requests still pass the applicable policy and rate checks.

Solve a puzzle, receive a signed session and check rules on later requests

Gate checks access rules, sessions and local rate limits. Shield adds the built-in attack inspector. Native CRS is configured separately. Start it in Audit to review findings before enabling Enforce.

Gate, Shield and the modules inside Sibuna Gate and Shield request decisions: allow, challenge or block

The diagram shows the built-in Gate and Shield checks. Optional CRS adds its own inspection. A valid session does not bypass applicable attack checks or request limits.

The jobs of the modules inside Sibuna

The modules separate networking, proofs, policies, local state and management. The book explains their responsibilities.

Sibuna uses HTTP/1.1 on its private listener. Your ingress handles public TLS and HTTP/2. Forward-auth inspects the metadata supplied by the ingress. Full reverse-proxy CRS inspection uses configured body and work limits. The built-in inspector covers the first 8 KiB. Uploads stream when CRS is disabled. WebSocket messages are relayed without inspection. Full CRS defaults to a 4 MiB request limit and a 1 MiB response limit. It buffers bodies for inspection. Enforce refuses incomplete inspection; review limits and streaming exceptions for your application before enabling it.

Rate limits are local to each node. Sibuna does not provide volumetric network mitigation. The strict console performance target has not formally passed. Review the deployment limits and measurements before enabling the console beside a production app.

The book records the source revision, configuration and host for each run. These measurements show request cost under one workload. They do not measure equivalent protection or bot accuracy.

This run compared Sibuna v0.2.0 , Anubis 1.27.0 and BunkerWeb 1.6.15 on 4 October 2026. The server and request generator ran on separate physical hosts. Each product had four CPUs, 64 connections and the same Caddy origin. Challenges and management interfaces were inactive. The table shows medians over five runs.

Profile Benign GET (req/s) p99 (ms) 8 KiB JSON POST (req/s) p99 (ms)
Origin directly 70,759 4.67 13,719 9.01
Sibuna Gate 71,270 4.12 13,719 9.16
Anubis 28,277 7.50 13,718 9.20
BunkerWeb, CRS off 13,617 8.27 12,300 8.94
Sibuna Shield 70,909 4.06 13,719 9.08
BunkerWeb, CRS on 2,730 32.73 797 98.42

BunkerWeb's CRS profile inspects more than the v0.2.0 Shield profile in this table. Sibuna v0.3.0 adds native CRS; this comparison predates that engine. Both hosts are shared containers. CPU frequency and unrelated host activity were not controlled.

This separate run used eight dashboards, four product CPUs and 16 connections from another host. The table shows median rates over five rounds. The built-in inspector was disabled.

Workload CRS disabled (req/s) Audit, paranoia 1 (req/s) Audit, paranoia 2 (req/s)
Small GET 47,311 10,787 7,423
8 KiB JSON POST 13,726 1,151 799
16 KiB multipart upload 6,704 4,248 2,887

At paranoia one, p99 latency was 2.34 ms, 23.43 ms and 6.34 ms for these workloads. Peak process RSS was 133.8–140.5 MiB across the CRS profiles. No measured request hit the work limit. The run used clean revision d461e7f. Its payloads and concurrency differ from the three-product comparison, so the two tables do not form a matched comparison.

See the benchmark records for ranges, CPU, memory, Enforce results and replay commands. These figures do not pass the separate console-impact gate.

Other software to consider

  • Anubis: browser challenges for reducing crawler traffic.
  • BunkerWeb: nginx, ModSecurity, CRS and bot challenges.
  • ModSecurity: a WAF engine used through connectors.
  • Coraza: a Go WAF library supporting ModSecurity rules and CRS.
  • OWASP Core Rule Set: attack-detection rules for WAF engines.

These projects cover different parts of web protection. Sibuna evaluates signed stock CRS releases. Plugins, Lua and other ModSecurity rule sets are outside its scope.

The engine is LGPL 3.0. The console, including its WebAssembly interface, is AGPL 3.0. The default executable combines both and is distributed under AGPL 3.0. Use -Dconsole=false to build the engine without the console.

LICENSE describes the scope. LICENSES contains the full terms. NOTICE lists dependencies. Source and build scripts are available under each release tag.

Companies seeking other licensing terms can contact Vikrant Rathore and Ronak Rathore. Third-party libraries and materials keep their respective licenses.