### Install Maltrail via curl pipe to sudo sh Source: https://github.com/stamparm/maltrail/blob/master/README.md Downloads and runs the official installer script with elevated privileges. Installs dependencies, creates a managed checkout under /opt/maltrail, verifies the sensor checksum, creates an unprivileged maltrail account, installs systemd units, prepares log/state directories, and starts sensor and server. Re-running upgrades the managed checkout. Review the script before running with elevated privileges. ```bash curl -fsSL https://raw.githubusercontent.com/stamparm/maltrail/master/install.sh | sudo sh ``` -------------------------------- ### Install Maltrail on Windows with install.ps1 Source: https://github.com/stamparm/maltrail/blob/master/README.md Runs the Windows installer script with PowerShell. It refuses to install without Npcap, places the binary, configuration and support tree under %ProgramFiles%\Maltrail, keeps logs and the trail set in %ProgramData%\Maltrail, seeds the trail set from the release, runs the sensor's own -T preflight, and starts it at boot as SYSTEM via a scheduled task. The -Uninstall flag removes the task and the program directory while keeping everything under %ProgramData%. ```powershell powershell -ExecutionPolicy Bypass -File install.ps1 ``` -------------------------------- ### Dry-run installer from existing checkout Source: https://github.com/stamparm/maltrail/blob/master/README.md Shows the commands the installer would run without changing the system. Use from an existing checkout to preview the installation or upgrade actions. ```bash sh install.sh --dry-run ``` -------------------------------- ### Common installer options for Maltrail Source: https://github.com/stamparm/maltrail/blob/master/README.md Lists common installer options: --role sensor installs only the sensor, --ref master tracks master instead of the latest release, --no-service installs without changing systemd, --dry-run prints commands without applying them, and --uninstall removes the managed installation while keeping logs and state. ```bash sh install.sh --role sensor # Install only the sensor ``` ```bash sh install.sh --ref master # Track master instead of the latest release ``` ```bash sh install.sh --no-service # Install without changing systemd ``` ```bash sh install.sh --dry-run # Print commands without applying them ``` ```bash sh install.sh --uninstall # Remove the managed installation; keep logs and state ``` -------------------------------- ### Start the Maltrail server Source: https://github.com/stamparm/maltrail/blob/master/README.md Starts the Maltrail server process. Run this in another terminal or on another host after building the sensor. ```bash python3 server.py ``` -------------------------------- ### Install prerequisites per distribution Source: https://github.com/stamparm/maltrail/blob/master/sensor/docs/INSTALL.md Installs libpcap, build tools, and setcap for Debian/Ubuntu, RHEL/Fedora, openSUSE/SLES, and optionally Rust via rustup. The openSUSE/SLES line already includes rust 1.74 and python3. ```bash # Debian / Ubuntu sudo apt-get install libpcap-dev build-essential libcap2-bin ``` ```bash # RHEL / Fedora sudo dnf install libpcap-devel gcc libcap ``` ```bash # openSUSE / SLES (rust 1.74 and python3 are usually already installed) sudo zypper install libpcap-devel gcc libcap-progs rust cargo ``` ```bash # Rust, only if your distribution has none curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` -------------------------------- ### Create maltrail user and install systemd service Source: https://github.com/stamparm/maltrail/blob/master/sensor/docs/INSTALL.md Commands to create the unprivileged 'maltrail' system user and install/enable the provided systemd unit. The unit runs with CAP_NET_RAW and CAP_NET_ADMIN ambient capabilities, not as root. StateDirectory and LogsDirectory create /var/lib/maltrail and /var/log/maltrail; point TRAILS_FILE and LOG_DIR there because ProtectHome=yes blocks the $HOME-derived default. ```bash # the unit's User=/Group= need this account to exist. `useradd` only creates a matching # group on distributions that default to per-user groups, so create it explicitly. sudo groupadd --system maltrail sudo useradd --system --gid maltrail --no-create-home --shell /usr/sbin/nologin maltrail sudo cp packaging/systemd/maltrail-sensor.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable --now maltrail-sensor journalctl -u maltrail-sensor -f ``` -------------------------------- ### Install distribution packages for building from source Source: https://github.com/stamparm/maltrail/blob/master/README.md Installs Rust, libpcap development headers, capability tools, and Python for building Maltrail from source. The sensor requires Rust 1.74 or newer, libpcap development headers, and the system's capability tools; the server and trail updater require Python 3.6 or newer. Choose the command block matching your distribution (Debian/Ubuntu/Raspberry Pi OS, RHEL/Fedora, or openSUSE/SLES). ```bash # Debian / Ubuntu / Raspberry Pi OS sudo apt-get install cargo libpcap-dev libcap2-bin python3 ``` ```bash # RHEL / Fedora sudo dnf install cargo libpcap-devel libcap python3 ``` ```bash # openSUSE / SLES sudo zypper install cargo rust libpcap-devel libcap-progs python311 ``` -------------------------------- ### Record Windows install metadata Source: https://github.com/stamparm/maltrail/blob/master/docs/compat/README.md Run on a Windows machine to record install metadata for the compatibility table. The --windows flag and label are required. ```bash python3 tests/install/record.py record --windows