Ban IP's from PHP Website


What is the easiest way to block an IP in Fail2Ban via web server.
The User apache has no rights for blocking IP.

I would like to put it online, but not without this function.



NethServer Version: 7.9.2009
Module: httpd, fail2ban, php

Can somebody help?



I’m automatically getting such mails:

This does imply that apache is “covered” by fail2bans protection…

→ Let Fail2ban do it’s work!


My 2 cents


If you install whois ( yum install -y whois ) fail2ban gives more info about the IP / Region.

1 Like

Hi Andy,

I don’t quite get it.
On my website is a registration form (PHP),
which logs failed login attempts to MariaDB.

How does Nethserver know when this happened?

I’ve thought about logging the incorrect logins in an existing log and F2B then blocks them.
Creating a new jail will be difficult for me.

greetings and thanks

ich verstehe es nicht so ganz.
Auf meiner Webseite ist ein Anmeldeformular (PHP),
welches fehlgeschlagene Loginversuche in MariaDB protokolliert.

Woher weiĂź Nethserver wann dies passiert ist?

Ich habe mir ĂĽberlegt, in einem vorhandenen Protokoll die fehlerhaften Logins zu protokollieren und F2B sperrt diese dann.
Einen neuen Jail anlegen wird fĂĽr mich schwierig.

GruĂź und Danke


Hi @supernicky

As this is an english based forum, I’ll answer in english, so others may also benefit… :slight_smile:

Have a look in Cockpit under Applications → Fail2ban…

This is what it shows me, on an average installed NethServer (I do have 30 clients I support with NethServer and Proxmox).

Note: I did install several packages here, all configured correctly. However, I’ll admit to not configuring fail2ban, when I saw the above… :slight_smile:
It seems to include most needed jails - out of the box!

Hope this helps…

My 2 cents

You should formulate again because my first answer when I read your issue, is fail2ban is not the good tool for your need, use shorewall