Every server that is reachable from the internet is constantly attacked with automated login attempts. We fend off these brute-force attacks in several layers: Fail2ban blocks suspicious addresses based on the log files, central blocklists distribute these blocks to all of our servers, and rate limiting in the web server slows down requests to login pages. Here we show you how it all works together.
What brute-force attacks look like in the logs
In a brute-force attack, a program automatically tries combinations of usernames and passwords until one works. The attackers are usually not people who are specifically interested in a particular business, but automated systems that work through large address ranges of the internet.
This is easy to spot in a server's log files:
- SSH: Lines such as “Failed password for root” or “Invalid user admin” from the same IP address, often many times per minute and with changing usernames.
- Mail server: failed logins when sending or retrieving mail, often with common names such as “info” or “test” in front of your own domain.
- WordPress: repeated requests to wp-login.php or xmlrpc.php in the web server's access log, often spread across many websites at the same time.
Even if no password is guessed, these requests cost computing time and fill up the logs. With weak passwords, it is only a matter of time until an attempt succeeds.
How Fail2ban works
Fail2ban is a proven open-source tool that continuously analyzes log files. It works with three building blocks:
- Filters: Patterns, usually regular expressions, that detect failed logins in a specific log file and extract the IP address.
- Jails: A jail connects a filter with a log file and defines how many failed attempts are allowed within what period of time. There are separate jails for SSH, mail and the web server.
- Ban time: If the threshold is exceeded, Fail2ban blocks the address in the firewall for a set period of time. Repeat offenders can be blocked for longer.
The right configuration is important. Thresholds that are too strict also lock out real users who make a single typo. Values that are too lenient give attackers too much leeway. We adjust the values to each service. Where possible, we also only allow key-based login for SSH instead of passwords. This means password attempts come to nothing there, and Fail2ban ensures that the attackers cannot keep trying indefinitely.
Central blocklists for multiple servers
At first, Fail2ban only protects the server it runs on. Attackers, however, often try their luck on many servers one after another. That is why we collect the blocks from several servers in a central location and distribute a shared blocklist from there to all servers. An address that stands out on one server is thus blocked on the others as well.
Technically, we use ipset for this. It allows even large numbers of IP addresses to be managed efficiently in the firewall without creating a separate rule for each address. We have described how to set up such drop lists with ipset and ufw in a separate post: Using drop lists with ipset and ufw (in German).
Rate limiting in the web server
For login pages such as the WordPress login, we additionally use rate limiting in nginx. This defines how many requests a single address may make within a certain period of time. Normal visitors do not notice any of this. A program that tries hundreds of logins in a short time, on the other hand, is slowed down and receives an error message before WordPress even has to do any work. Repeated violations can in turn be detected and blocked by Fail2ban.
What this means for our customers
For you, this protection is invisible in everyday use, and that is exactly how it should be. Your website stays faster because less server capacity is used up by attacks. Your mailbox is better protected against unauthorized access. And the likelihood of a weak password being exploited drops significantly. Still, this technology cannot replace a good password. Strong, unique passwords and, where possible, two-factor authentication remain the foundation.
Frequently asked questions
Can I lock myself out?
That can happen if you enter a wrong password many times in a row, for example after changing your password on your smartphone. In that case, get in touch with us and we will lift the block.
Isn't a security plugin in WordPress enough?
A plugin makes sense, but it only takes effect once WordPress is already processing the request. Blocks at the firewall and web server level kick in earlier and also protect SSH and mail.
Are real visitors blocked by the blocklists?
Only addresses that have stood out through repeated failed attempts or suspicious requests are blocked. Normal visitors are not affected.
Securely hosted
Would you like to run your website or your email on servers that are actively monitored and protected? You can read what we do for this under hosting and operations. If you have any questions, you can reach us via the contact page.



