Fail2Ban Jails Management

Advanced users might also be interested in configuring the way the so-called Fail2Ban jails are used to block IP addresses. A Fail2Ban jail is a combination of a filter and one or several actions. A filter defines a regular expression that matches a pattern corresponding to a failed login attempt or another suspicious activity. Actions define commands that are executed when the filter catches an abusive IP address.

In Plesk, there are preconfigured jails for all hosting services (web server, mail server, FTP server). Most of them work in the same way: they detect failed login attempts and block access to the service for ten minutes. These jails require special explanation:

Preconfigured jails for non-installed Plesk components are not shown in the list. For example, if RoundCube webmail is not installed, the plesk-roundcube jail is not shown in the list of available jails.

To protect your services from specific threats, as well as to protect third-party services that are not shipped with Plesk, you might want to set up your own jails, switch them on and off, update jail settings, and add filters that can be used by jails.

Note: Jails shipped with Plesk cannot be removed, you can only deactivate them. However, you can remove jails that you added yourself.

Only jails for installed Plesk components are shown in Plesk. For example, if the qmail mail server is not installed, the qmail jail is hidden.

If you try to switch on several jails at once with a group Switch On operation and one of the jails fails to start, then all the jails will not be started. In this case, switch on the jails one by one.

To set up a new jail:

  1. Go to Tools & Settings > IP Address Banning (Fail2Ban) > Jails > Add Jail.
  2. Specify the jail settings.

    You can use the following filters already set up in Plesk:

    You can use the following actions, which are already set up in Plesk:

To add a filter that can be used by a jail:

  1. Go to Tools & Settings > IP Address Banning (Fail2Ban) > Jails > Manage Filters > Add Filter.
  2. Specify the filter name and the regular expression used to match the lines of log files. For details about Fail2Ban filters, refer to Fail2Ban documentation at http://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Filters. As Fail2Ban is a Python application, for details about Python regular expressions, refer to Python documentation at https://docs.python.org/2/library/re.html.