Block IP Manually from Fail2Ban Plesk server

While using Fail2Ban under a Plesk handled server, you have a GUI to view the current Banned IP’s, and also “whitelist” IP’s (move to trusted IP’s), But you don’t have the option to manually add an IP to the Blacklist, and permanently block a specific IP.

To do so, SSH to your terminal as root.

To see all the Fail2Ban Blacklist IP’s
run (as root):

sudo iptables -nL

To manually block an IP

Run:

sudo fail2ban-client set <JAILNAME> banip <IP ADDRESS>

Where:

<JAILNAME> – Is the Jail name.

<IP ADDRESS> – Is the ip address you want to ban.

To see your Jail’s run:

fail2ban-client status

To see the list of Banned IP’s Run:

iptables -L -n

In Plesk the common Jail to use is “recidive”

So the command will look like:

sudo fail2ban-client set recidive banip <IP_ADDRESS>

Be careful not to ban your own IP 🙂

If you do, just switch to your phone network (open an HotSpot) and whitelist your IP (add to Trusted IP’s).