Blocking Attackers With Active Response on Linux
Nov 23, 2026
Trunc Team

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.

What you get

  • One block, every server. An address that attacks one server is dropped on all of them, including servers it hasn't reached yet.
  • About 25 seconds. The list updates within about 10 seconds of the attack, and trunc-ar checks it every 15.
  • Short blocks. An address stays blocked for the Response timeout you set (10 minutes to 2 days, 30 minutes by default), then is unblocked on its own.
  • It's your firewall. trunc-ar adds its own table and leaves your rules alone. You can see every block with trunc-ar check and remove all of them with one command.

What Active response detects and how it fits together

Before you start

  • Active response is turned on under Settings > Security responses. With it off, the list is empty and trunc-ar has nothing to block.
  • Supported on Linux with systemd. trunc-ar blocks IPv4.
  • A user with sudo, and a way in that doesn't depend on SSH from your current IP (your provider's console), in case you need it.

Install

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:

  1. checks that it's running as root on Linux with systemd and that the tools it needs are there
  2. downloads the client and checks its SHA-256
  3. fetches your list once with it to test the URL
  4. adds the IP you're connected from to /etc/trunc-ar/allow.conf, so you don't lock yourself out (it prints the IP at the end)
  5. installs and starts the trunc-ar service

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

If the install fails

The installer stops without installing anything when something is wrong. The two messages you're most likely to see:

  • The list URL returned 404. Active response isn't on for the account yet, or the URL changed. Copy the command again from Settings > Security responses.
  • No usable firewall backend. trunc-ar needs nftables 0.9.3 or newer, or ipset with iptables. Install one with your package manager (nftables or ipset) and run the installer again. If it says your nftables is too old, install ipset.

Verify the download first

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.

With the Trunc agent

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.

What it blocks

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:

Firewall objects trunc-ar creates, per backend
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.

What it never blocks

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:

  • private and reserved ranges (10.0.0.0/8, 192.168.0.0/16, CGNAT and the rest)
  • this server's own IP addresses
  • the default gateway
  • the DNS resolvers in /etc/resolv.conf and /run/systemd/resolve/resolv.conf
  • the Trunc log server your list comes from, the log server in /etc/trunc-logging-agent.conf, trunc.org and my.trunc.org
  • IPs with a logged-in SSH session on this server, for 24 hours after they were last seen
  • the IP you installed from (the installer adds it to allow.conf)
  • anything in /etc/trunc-ar/allow.conf

Only logged-in sessions count. An IP that connects to sshd and fails to log in (a brute-forcer) gets no pass.

allow.conf

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.

Check it

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 codes of trunc-ar status
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

Emergency unblock

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 list stops updating

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.

Uninstall

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

Limits

  • Linux with systemd only.
  • IPv4 only. IPv6 addresses on the list are skipped, and the server stays reachable over IPv6. If your servers have public IPv6, attackers can still come in that way.
  • Behind a CDN (Cloudflare, Fastly, NOC.org or any other), your server sees the CDN's addresses for web traffic, so a block at the origin firewall does nothing there. It still covers SSH and anything else that doesn't go through the CDN. For web traffic, block in the web server instead.
  • It blocks right away. No dry-run, no per-server switch on the dashboard. Use allow.conf for exceptions.
  • No auto-update. Re-run the install command to upgrade.

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.

Logging Guides

We love logs. In this section we will share some articles from our team to help you get better at logging.

Trunc Logging

Logging for fun and a good night of sleep.

  • Real time search
  • Google simple
  • Cheap
  • Just works
  • PCI compliance
Contact us!

Do you have an idea for an article that is not here? See something wrong? Contact us at support@noc.org

Tired of price gouging
  • Clear pricing
  • No need to guess
  • Real people
  • Real logging

Simple, Affordable, Log Management and Analysis.

14 days free trial. No credit card required.