An address that brute forces one of your servers usually tries the others too. With Active response on, Trunc puts it on a blocklist for your account within about 10 seconds. trunc-ar drops every address on that list at the firewall of each Linux server, so about 25 seconds after the attack, the attacker is cut off everywhere.
There are no per-server rules to write or keep in sync. You install one small client per server, and the list does the rest. Below: install, check, keep your own addresses safe, and turn it off in a hurry.
trunc-ar check and remove all of them with one command.What Active response detects and how it fits together
Run this as a user with sudo on each Linux server you want to block on:
curl -fsSL https://trunc.org/downloads/trunc-ar-install.sh | sudo sh -s -- '<your list URL>' Your list URL is on the dashboard under Settings > Security responses, in the Block on your servers card. The command there already has it filled in, so copy it from there.
The installer, in order:
/etc/trunc-ar/allow.conf, so you don't lock yourself out (it prints the IP at the end)trunc-ar serviceIf it finds no SSH session (for example, you install from your provider's console), step 4 adds nothing, so add your IP to allow.conf yourself before blocking starts.
Blocking starts as soon as the install finishes. There is no dry-run mode. Start with one server.
To upgrade, run the same command again. Your config and allow.conf are kept. The client does not update itself.
The installer stops without installing anything when something is wrong. The two messages you're most likely to see:
nftables or ipset) and run the installer again. If it says your nftables is too old, install ipset.If you don't want to pipe a script into sudo, download it, check it and read it first:
curl -fsSLO https://trunc.org/downloads/trunc-ar-install.sh
curl -fsSL https://trunc.org/downloads/trunc-ar-SHA256SUMS \
| grep ' trunc-ar-install.sh$' | sha256sum -c -
less trunc-ar-install.sh
sudo sh trunc-ar-install.sh '<your list URL>' The second command checks the installer against the published SHA-256. That checksum comes from the same server as the script, so it catches a broken or cut-off download. It does not protect you if trunc.org itself is compromised. Reading the script is the real check. It's plain sh and short enough to read. The installer then checks the SHA-256 of the client it downloads against a value inside the script.
If you're installing the TRUNC log agent on a new server, agent 1.4 can install the client in the same step. Add --active-response and your list URL before the usual arguments:
sudo ./install.sh --active-response '<your list URL>' IP PORT KEY On macOS and BSD the agent installs and the client is skipped with a message. The two installs are independent: if one fails, the other is not undone, and the installer reports both. On servers that already run the agent, use the command under Install.
Every IPv4 address on your account's Active response list.
The drop happens before the rest of your firewall, in the raw prerouting hook. That also covers Docker and other port forwarding (DNAT). trunc-ar uses its own objects and doesn't touch your rules, so it runs alongside ufw, firewalld and Docker:
| Backend | What it creates |
|---|---|
| nftables | table ip trunc_ar with chain pre, block sets block_a_1, block_a_2 and so on (up to 50,000 addresses each; the letter switches between a and b on each update), and allow set allow_a or allow_b |
| ipset + iptables | sets trunc_ar (blocked) and trunc_ar_allow, and chain TRUNC-AR in the raw table, jumped to from PREROUTING |
The installer picks the backend: nftables 0.9.3 or newer, otherwise ipset + iptables. The client is plain sh, so it doesn't need bash.
Before your list is published, we take out Google and Bing crawlers and Cloudflare, Fastly and NOC.org edge servers, matched by the IP ranges they publish. A request that only claims to be Googlebot in its User-Agent gets no pass. Private, reserved and CGNAT ranges never get listed either.
On each server, trunc-ar rebuilds an allow list on every cycle. These addresses are never blocked, even if they are on your list:
/etc/resolv.conf and /run/systemd/resolve/resolv.conf/etc/trunc-logging-agent.conf, trunc.org and my.trunc.org/etc/trunc-ar/allow.confOnly logged-in sessions count. An IP that connects to sshd and fails to log in (a brute-forcer) gets no pass.
To keep an address or range from ever being blocked on a server, add it to /etc/trunc-ar/allow.conf. One IPv4 address or CIDR per line, # for comments:
# /etc/trunc-ar/allow.conf
# office
198.51.100.10
# VPN pool
203.0.113.0/24
Changes are picked up on the next cycle (about 15 seconds). No restart needed. A line that doesn't parse is logged and skipped. Nothing broader than /8 is accepted, so a 0.0.0.0/0 typo can't turn blocking off.
The file must be owned by root and not writable by group or others. If it isn't, trunc-ar ignores the whole file and logs a warning every 10 minutes.
allow.conf is per server. An address you allow here is still on your account's list and still blocked on your other servers. If your office shares one public IP, one person failing five logins blocks the whole office, so put office and VPN ranges in allow.conf on every server.
To see whether it's running and the list is fresh:
sudo trunc-ar status On a healthy server it prints:
trunc-ar 1.0.0
backend : nft
service : running
rules : present
blocked : 412 IPv4
allowed : 19 ranges/addresses
last fetch : ok-304, 6 s ago
last ok : 6 s ago
list : 414 entries, written 2 min before the last fetch
etag : "6741f0a2-1b3c"
last apply : 38 ms
stale : no
last fetch is none yet before the first fetch, then ok-200 (new list) or ok-304 (unchanged), or the reason it failed: http-<code>, curl-<exit code>, rejected, too-large or bad-304 (a 304 reply without a saved list). list counts every line on the list, IPv6 included. blocked counts the IPv4 addresses in the firewall. Run it with sudo. Without root it prints trunc-ar: error: run as root (sudo trunc-ar status) and exits 2.
| Exit code | Meaning |
|---|---|
| 0 | running, rules in place, list fresh |
| 1 | running, but the last fetch failed, the list is stale or the firewall rules are missing |
| 2 | not running, not installed, or not run as root |
The exit code makes it easy to add to your own monitoring. The dashboard can't see the client, so trunc-ar status on the server is the health check.
To see why one address is or isn't blocked:
sudo trunc-ar check <IPv4 address> A listed address:
203.0.113.9: on the block list
kernel: in set block_a_1 An address in allow.conf:
198.51.100.10: not on the block list
allowed: 198.51.100.10/32 (allow.conf)
allow wins: this address is not dropped
The word in parentheses says why it's allowed: allow.conf, session-peer (a logged-in SSH session), own-address, gateway, resolver, edge (the Trunc log server your list comes from), trunc.org, agent-remotehost (the agent's log server) or private. check exits 0 if the address is blocked or allowed, 1 if it's neither, and 2 for an address it can't parse or when not run as root.
The service logs to the journal:
journalctl -u trunc-ar Each list change logs one line:
Nov 23 14:05:12 webserver trunc-ar[1187]: info: applied 412 IPv4 (+3 -1, ipv6 skipped 2, dup 0) backend=nft in 38 ms A failed fetch keeps the current blocks and logs why:
Nov 23 14:20:41 webserver trunc-ar[1187]: error: fetch failed: HTTP 503 (attempt 1), keeping the current set
To remove every block on a server right away:
sudo systemctl stop trunc-ar
Stopping the service deletes trunc-ar's nftables table (on ipset systems, it empties the block set). Nothing is blocked again until you start it (sudo systemctl start trunc-ar) or the server reboots. To keep it off after a reboot:
sudo systemctl disable --now trunc-ar If you're locked out of SSH, run it from your provider's console. To unblock just one address on this server, add it to allow.conf instead.
sudo trunc-ar flush removes the blocks only when the service is already stopped. While the service runs, flush refuses and tells you to run systemctl stop trunc-ar, because the next check would put the blocks back.
If the server can't fetch the list (network down, log server unreachable), trunc-ar keeps the blocks it has and retries after 15, 30, then every 60 seconds. sudo trunc-ar status shows why in last fetch, and the journal has one line per failed attempt.
After 24 hours without a fresh list, it releases all blocks, so an old list can't keep blocking forever. Blocks come back with the next good list. trunc-ar status exits 1 while this is going on.
Turning Active response off on the dashboard empties the list, so every server drops its blocks on the next check.
sudo trunc-ar uninstall
This stops and removes the service, the client, its firewall table, chains and sets, and its state. It works even if the service or config is broken. /etc/trunc-ar (config and allow.conf) is kept, so a reinstall picks up where you left off. To remove that too:
sudo trunc-ar uninstall --purge
What the detections look for is on Security Insights, and the overview is on the Active response page. If something doesn't look right, send us the output of sudo trunc-ar status and we'll help.
We love logs. In this section we will share some articles from our team to help you get better at logging.
Logging for fun and a good night of sleep.
Latest articles from our learning center.
Do you have an idea for an article that is not here? See something wrong? Contact us at support@noc.org
14 days free trial. No credit card required.