PT
EUR
Edição gratuitaGratuito Instalar

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.

All ways to install

A versão que instala

A versão pública é uma versão de desenvolvimento, chamada 0.3.0-dev. O nome não muda: cada publicação substitui a anterior e um identificador de compilação distingue duas compilações. Ainda não existe nenhuma versão estável: só será publicada quando cada sistema e cada pacote tiverem sido testados de ponta a ponta. Por isso, os comandos desta página instalam a partir do canal dev. Uma versão de desenvolvimento pode conter erros: experimente-a num site de teste antes de depender dela.

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

Instale os pré-requisitos (apt)

bash
sudo apt update && sudo apt -y upgrade
sudo apt -y install curl tar ca-certificates ufw

Instale com o instalador de uma linha

O script descarrega os binários nativos para a sua arquitetura, cria um utilizador dedicado sem privilégios e instala os serviços systemd reforçados toutwaf-dp (plano de dados, portas 80 e 443) e toutwaf-cp (plano de controlo e consola, porta 9443), e depois apresenta as informações do primeiro acesso.

bash
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh | sudo bash

Prefere ler primeiro o script?

Descarregue-o, reveja-o e depois execute-o. Recomendado para servidores de produção.

bash
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh -o install.sh
less install.sh
sudo bash install.sh

Opções do instalador

Uma instalação nova fica numa única pasta, /var/toutwaf (bin, conf, data e logs; altere-a com --home DIR ou TOUTWAF_HOME), e as ferramentas de linha de comandos são ligadas em /usr/local/bin. Uma instalação anterior mantém os seus próprios caminhos (/etc/toutwaf, /var/lib/toutwaf) e nunca é movida.

options
# 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

Abra a firewall (ufw)

O instalador abre estas portas por padrão quando o firewalld ou o ufw está ativo: 80 e 443, e a porta 9443 da console (restrinja-a à sua rede de administração com --console-from). A porta 9444 dos agentes nunca é aberta ao público. Estes comandos só são necessários com --no-firewall, com outro firewall ou para fazer à mão.

ufw
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

Gerir os serviços

Ambos os serviços arrancam com o sistema. Use estes comandos para os iniciar, parar ou reiniciar.

systemd
sudo systemctl enable --now toutwaf-cp toutwaf-dp
sudo systemctl restart toutwaf-cp toutwaf-dp
sudo systemctl stop toutwaf-dp toutwaf-cp

Verifique os serviços

bash
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

Atualizar

Faça uma cópia da configuração e dos dados e execute o instalador de novo: ele mantém as suas definições e reverte sozinho se a nova versão não ficar saudável. Os caminhos mostrados são os de uma instalação nova (/var/toutwaf); uma instalação anterior mantém /etc/toutwaf e /var/lib/toutwaf. Também pode atualizar a partir da console, na página Atualizações.

bash
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

Desinstalar

O primeiro bloco remove os serviços, os binários e as regras de firewall adicionadas pelo ToutWAF, e mantém os seus dados. O segundo apaga também a configuração, os dados e os registos.

bash
curl -fsSL https://repo.qu3ntin.com/toutwaf/toutwaf/-/raw/dev/install.sh -o install.sh
sudo bash install.sh --uninstall
purge
sudo bash install.sh --uninstall --purge

What 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.

Other ways to install

Learn more in the documentation