Manual · Chapter 27

Protection against attacks

Go to the contents

Every computer with an AegisGrid server (target, job scheduler, site server, license server) has the protection service aegisgrid-guard (program bkp_guard). The servers report every irregularity to it: failed logins, made-up access tokens, connections without TLS on an encrypted port, certificates of a foreign certificate authority, requests probing for known vulnerabilities. When the service sees an attack, it blocks the address – first for minutes, for longer when it happens again, in the end permanently. One service covers all servers of the computer; an address that attacks the target no longer reaches the job scheduler there either.

27.1 What the protection service detects#

  • Hard violations block at once: a made-up token (every token carries a checksum), a certificate of a foreign certificate authority, requests for paths that never exist in AegisGrid (such as /wp-login.php), badly malformed HTTP.
  • Soft events only count above a threshold: failed logins (default 5 in 10 minutes), failed TLS connections, connections left waiting, too many connections at once.
  • A login attempt with the name of an existing access counts as soft but sends a mail at once: someone knows one of your accesses.
  • Never blocked are the computer itself, the exceptions (allow) and a proxy in front (trusted-proxy of the license and site servers). A console also cannot block the address it is connected from.

27.2 Steps and known addresses#

Every detection raises the step of the address: with steps = 5m, 1h, 24h, permanent (default) the first detection blocks for 5 minutes, the second for an hour, the third for a day, the fourth permanently. After 30 days without a new detection (forget) an address starts at zero again. IPv6 addresses are counted per /64 network.

An address from which an agent, a console or a user logged in successfully in the last 30 days is known: its failed logins have a higher threshold, and it is never blocked for more than 24 hours (known-max), never permanently. A typo in a password thus does not lock out one of your own computers.

With mode = log the service records everything and shows what it would have blocked, but blocks nothing. This way the protection on a new server can be watched first.

27.3 Where the block applies#

  • On Linux the service blocks through nftables (a table of its own) or, where that is missing, through iptables with ipset; on Windows through the Windows Firewall. Only the AegisGrid ports are blocked (scope = ports); with scope = all every port of the computer, with ports = 22 further ones in addition.
  • The blocks are kept in the state file of the service and survive a restart. If another program deletes the rules (for example nft flush ruleset), the service restores them.
  • In addition the servers turn blocked addresses away themselves, even before TLS. Without a usable firewall (for example in a container) only this block applies; the status line then says so.

27.4 Viewing and releasing blocks#

The blocks of a computer are shown by:

  • the Target Console on the page Protection (Chapter 17),
  • the management console under Scheduler › Protection… (Chapter 16),
  • the web interface on the page Protection (Chapter 18),
  • on the computer itself bkp_guard list (with --all also watched and known addresses) and bkp_guard show <address>.

The list gives for each address its state, step, the reason in plain words, the reporting service and the last event. A double-click shows the events of the address. Only an access with the role admin may change anything (release, block, exceptions).

  • Release ends the block at once. “Reset the counters” (default) lets the address start again at the shortest step; “Do not block for 24 hours” keeps it free for a day, whatever it does – only for a computer you know. On the computer: bkp_guard release <address> [--keep-count] [--allow-hours <n>] [--note <text>].
  • Block by hand, permanently or for a while: bkp_guard block <address> [--for 2h] [--note <text>].
  • Exceptions are addresses and networks that are never blocked, such as your office network: bkp_guard allow add 192.0.2.0/24.

Every change is written to the log of the server and, on Windows, to the Event Viewer.

27.5 Mails of the protection service#

A mail goes out at once when a known address is blocked, an address is blocked permanently or someone tries to log in with the name of an existing access (notify = known, permanent, targeted). All other detections are summed up in one mail a day, only if there were any. The mails go to the recipients of the mail settings of the job scheduler or the target, for the site server to to= in [mail], for the license server to operator-to= in [mail].

27.6 Settings (bkp_guard.cfg)#

The file is /etc/bkp/bkp_guard.cfg or %ProgramData%\AegisGrid\bkp_guard.cfg; the service reads it again by itself after a change. If it contains an error, the service keeps the last valid settings and says so in the status line.

KeyMeaning (default)
modeblock, log (only record) or off (block)
stepshow long a block lasts per step (5m, 1h, 24h, permanent)
forgetthe counter goes back to zero after this long without a detection (30d)
known-days, known-maxhow long an address is known after a login and how long it is blocked at most (30, 24h)
scope, portsonly the AegisGrid ports or all; further ports (ports)
allowexceptions, may be given several times
ipv6-prefixthe network size by which IPv6 addresses are counted (64)
soft-limit, soft-limit-knownfailed logins until a detection (5/10m, 10/10m)
tls-limit, timeout-limitfailed or waiting connections (5/10m)
conn-limit, rate-limitconnections at once and new ones per time window (30, 120/1m)
notifywhen a mail goes out at once (known, permanent, targeted; none = only the summary)

bkp_guard status shows whether the service runs, its mode and what it blocks with; bkp_guard apply writes the whole block list into the firewall again.

27.7 Setup and updates#

  • bkp_setup sets up the protection service with every server component (backup server, job scheduler, site server) and starts it before them: on Linux the systemd unit aegisgrid-guard.service with the system group aegisgrid-guard, on Windows the service “AegisGrid Schutz” (aegisgrid-guard, startup type “Automatic”). No new user account is created.
  • A computer set up before the protection service existed gets it with the next update. Without bkp_guard.cfg, mode = block applies with the default values; to watch first, set mode = log beforehand.
  • The servers do not depend on the protection service: if it does not start, backups keep running, and every server rejects blocked addresses from the state file itself. The setup then reports the error with a warning.
  • When the last server component is removed or AegisGrid is uninstalled, the setup removes the service and its rules in the firewall (bkp_guard remove-rules). The settings are kept.
  • No setup installs the license server; there the service is set up by hand like its other units (docs/license-api.txt, section 10).

27.8 When one of your own computers is blocked#

A blocked computer gets no answer any more: the agent reports a timeout, the consoles say “The server does not answer” or “has blocked the address of this computer”. Then open the page Protection from another computer and release the address, or run bkp_guard release <address> on the server itself. So that it does not happen again: look up the reason in the events (mostly an old password or token in a job) and enter your own network as an exception.