CrushMFT Documentation

Bans and hammering#

A server on the internet is tried all day: robots guess passwords, scanners look for holes, a broken script of a partner logs in a hundred times a second. The server counts, and shuts out what goes over a limit. This page explains how the parts work together; the settings are in Banning.

Two things can be shut out#

What it is Lifted
an address is banned no connection from it is accepted, on any port by itself when the time is over, for a temporary ban; by hand, for a permanent one
a user name is blocked nobody can log in under it, from anywhere, not even with the right password by itself after the time; or by hand

What is counted#

"Hammering" is the server's word for too much in too little time. Five things are counted, each with a limit of so many within so many seconds:

Counted A new server allows Over the limit
connections from one address, to ports that are not web ports 100 in 10 seconds the address is banned for 5 minutes
connections from one address, to web ports 100 in 3 seconds the address is banned for 5 minutes
failed commands in one session 100 in 30 seconds the address is banned for 5 minutes
failed logins 15 in 30 seconds the address is banned for good, and the user name is blocked for a minute
successful logins of one user name 60 in 30 seconds the user name is blocked for a minute

A ban of 0 minutes means for good: the address goes onto the permanent list.

Beside the counting, some things ban at once:

  • a login attempt under a name that only an attacker would try. A new server lists administrator, admin and root;
  • requests that are plainly an attack, such as attempts to climb out of a folder or to send an oversized request. See Hack Attempts And Limits in Banning.

The order of the checks#

For every new connection:

  1. Is the address on the temporary list, or the permanent list? The first entry it falls into decides.
  2. Do the rules of the listener let it in?
  3. Is its country allowed? (Banning by country)
  4. An address on Never ban these IPs is let in whatever 1 to 3 said.

Then it is counted.

Addresses that must never be banned#

Put on Never ban these IPs:

  • your own networks, so that a colleague's typing mistakes do not lock out the office;
  • the monitoring that checks the server every few seconds;
  • a load balancer or proxy in front of the server. Without the client's real address, every user seems to come from the balancer; one user's failed logins would ban the balancer, and with it everybody. Better still, let the balancer pass the real addresses on: The PROXY protocol on a port.

The list protects from bans. It does not lift the limit on how many connections one address may have open at a time: see Login frequency and slow logins.

Programs that log in often#

A transfer program that opens a new session for every file can look like an attack. For such accounts:

  • put the name on Never block usernames, so that the limit on successful logins does not block it;
  • or raise the limit;
  • or, best, make the program keep its session open.

Seeing and lifting bans#

Where What
Banning the temporary and the permanent list, each entry with its date and reason. Remove an entry to lift the ban.
the dashboard of Server Admin how many addresses are banned now
the server log a line "---IP Banned---" for every automatic ban, with the reason
Alerts a mail or an action when an address is banned or a name is blocked
Block/Unblock username lifts the block of a user name, or sets one for 24 hours

When a partner says "we are locked out", ask for the address they come from, look for it on the two lists, and read the reason. Lift the ban, and fix the cause: a wrong password in a script will have them banned again in a minute.

A user's own limits#

Three settings on a user add to the server's: the account is disabled after so many failed logins, a limit on logins that succeed, and a limit on sessions at the same time. See Restrictions.

Tuning#

  • The defaults suit most servers. Change them when the log shows real users being banned, not before.
  • Be strict with failed logins and generous with connections: browsers and modern clients open many connections at once.
  • With a DMZ server in front, a user name that is blocked by hand is blocked on the DMZ servers too.
  • A ban hides nothing from an attacker with many addresses. It slows guessing down; a second factor is what stops it.