Linux (Debian, Ubuntu)
The commands for Debian and Ubuntu: prepare the system, run the one-line installer, open the ufw firewall, check the services, upgrade and uninstall.
您安装的是哪个版本
目前公开的是名为 0.3.0-dev 的开发版。名称保持不变:每次发布都会替换上一次,并用构建编号区分两个构建。尚无稳定版:只有在每个系统和每个软件包都完成端到端测试之后,才会发布稳定版。因此本页的命令从 dev 通道安装。开发版可能存在缺陷:在依赖它之前,请先在测试站点上试用。
At a glance
- Debian 11 and later, Ubuntu 20.04 and later, amd64 and arm64. systemd 239 or newer and glibc 2.28 or newer are needed.
- The installer adds missing prerequisites (curl, tar, libcap), creates an unprivileged user and installs the hardened systemd services toutwaf-dp (ports 80 and 443) and toutwaf-cp (console, port 9443).
- If ufw is active it opens 80 and 443 and the console port 9443 (restrict it to your admin network with --console-from). Port 9444 is never opened automatically.
- SELinux is not used by default on Debian and Ubuntu and no AppArmor profile is shipped: the systemd sandbox is the confinement.
The commands, step by step
安装前置依赖(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 --purgeWhat is not verified
We prefer to say it plainly.
- “Tested” means the full installation passed in a container with systemd on that version; it has not been tried on a clean real machine.
- No stable version exists yet: the public version is the development version 0.3.0-dev.