Skip to content
SSH protection

SSH brute force protection that you can verify

Every server with SSH on a public address receives login attempts within minutes. SSH brute force protection is not only installing fail2ban: Avanguard checks that it is configured, that it reads the right log and that it really bans the addresses that attack you.

How Avanguard handles an attack
  1. Attack Scans, brute force, floods hit the server
  2. Detected in 15 s The agent reads logs and connections
  3. Blocked or explained Scanners blocked; AI writes the fix for the rest
  4. Verified Check again: the problem is gone

How an SSH brute force attack works

Automated tools try common usernames and passwords against port 22, one after another, all day long. Most attempts fail, but a single weak password, an old test account or a forgotten user without a password is enough to give someone a shell on your server.

The attempts end up in the SSH log as failed logins. The agent reads the new lines every 15 seconds and sends them aggregated, as failed logins per IP, so Avanguard sees the attack while it happens and opens a suggestion with its severity.

fail2ban checks performed by Avanguard
CheckWhat Avanguard looks atIf it fails
Installed and runningfail2ban (or CrowdSec with bouncer, sshguard) is present and activeInstall commands for your distribution
sshd jailThe jail for SSH is enabledConfiguration to enable it
Log readableThe jail reads a log that exists on the serverThe right log path or backend
maxretryAt most 10 failures before a banA stricter value
Ban timeBans last at least 5 minutesA longer ban time
EffectivenessBans and failed logins per hourAlert: fail2ban is not stopping an attacker

Protect SSH from brute force with fail2ban

To protect SSH from brute force, Avanguard relies on the tool built for the job: fail2ban, which bans addresses after too many failures. CrowdSec with a firewall bouncer and sshguard are recognized too. The agent does not install anything: when something is missing, you get the commands prepared for your distribution and you run them.

A minimal /etc/fail2ban/jail.local looks like this: [sshd], enabled = true, maxretry = 5, bantime = 1h. Then sudo fail2ban-client status sshd shows the addresses currently banned.

fail2ban monitoring: is it really banning?

A fail2ban that runs but reads a log that does not exist, or whose jail is disabled, protects nothing and gives a false sense of safety. That is why fail2ban monitoring is part of the check: the agent follows the fail2ban log and the Protection tab shows bans and failed logins per hour, side by side.

If an address keeps failing without being banned, you receive the suggestion fail2ban is not stopping an attacker, with the explanation and the commands to fix the configuration.

Distributed brute force

Some attacks come from hundreds of addresses, each trying only a few passwords. Every single IP stays below the fail2ban threshold, so nothing is banned while the attack goes on. Avanguard also recognizes failed logins from many addresses together and reports a distributed brute force.

Against this kind of attack the real defence is not a stricter threshold but removing passwords from the game altogether.

Key-only SSH: the change that matters most

With key-only SSH a guessed password is useless. In /etc/ssh/sshd_config set PasswordAuthentication no and PermitRootLogin prohibit-password (or no), check that your key works in a second session, then reload SSH. Avanguard reports SSH root login and password login as findings among the vulnerabilities, and the hourly scan records new users and new SSH keys, so an unexpected key added to authorized_keys does not go unnoticed.

From failed logins to a protected server

  1. 1

    Check

    Avanguard verifies fail2ban and the SSH configuration at every full scan and follows failed logins every 15 seconds.

  2. 2

    Fix

    Run the commands prepared for your distribution: install, enable the jail, tighten the settings, switch to keys.

  3. 3

    Verify

    Check again in one click and watch bans per hour: failed logins must turn into bans.

Frequently asked questions

Does Avanguard install or configure fail2ban for me?

No. The agent never executes commands received from the network. Avanguard prepares the commands for your distribution and you run them, so you keep control of every change on the server.

Is fail2ban enough if I still use passwords?

It slows attackers down, but a distributed brute force can stay below its thresholds. Key-only SSH is the recommended setup; fail2ban then keeps the logs clean and stops the noise.

What about brute force on my web application?

Avanguard also reads the web server access logs and reports login brute force on your application, scans and floods. See attack protection for the full list, or how the agent collects the data on how it works.

Does it work with servers that run Docker?

Yes. The agent itself runs in a container and reads the host logs read-only. For the firewall side of Docker hosts see Docker server security.

Know what is happening on your servers, today

Create your account, run one Docker command and in a few minutes you see attacks, vulnerabilities and resources of the server, with the commands to fix what matters.

Already have an account? Sign in · Documentation