Overview

Fail2Ban is a new feature in Plesk 12 that allows users to set up filters to block ip addresses to prevent things like brute force attacks. The following support articles outlines how to configure Fail2Ban for WordPress. This article assumes you already have Fail2Ban to installed and configured, if not you can read our guide here.

Instructions

  1. From the Admin bar on the left hand side menu, click on “Tools & Settings”, then click on “IP Address Banning (Fail2Ban)”.
    fail2ban wordpress

  2. Under “IP Address Banning” click on the “Jails” tab.
    fail2ban wordpress

  3. Under the “Jails” tab, click on “Manage Filters”.
    fail2ban wordpress

  4. From the “Jail Filters” screen click “Add Filter”.
    fail2ban wordpress

  5. From within the “Add Jail Filter” give the filter a meaningful name in the “Name” field. Then in the “Content” field add the following:
    fail2ban wordpress

    [Definition]
    failregex = <HOST>.*] "POST /wp-login.php
    ignoreregex =
    
    
  6. Navigate back to the “Jails” screen. Alternatively you can click on the green arrow “Up Level” icon in the top right hand corner.
    fail2ban wordpress

  7. From under the “Jails” tab click on “Add Jail”.
    fail2ban wordpress

  8. [A] – Under “Name”, give the Jail a meaningful name, we used the same as the filter for ease of management. Under “Filter” select the filter we created in the pervious steps. 

    [B] – Enter the below details, updating “name=WPLogin” with the name you have give the Filter. 

    iptables-multiport[name=WPLogin, port="http,https"]

    [C] – This step is optional but allows email notifications to be set up for instances of where IP addresses have been jailed. Under “dest” specify the email address notifications are to go to. Then from the “Action” drop down list select “sendmail-whois”.
     

    sendmail-whois[name=WPLogin, dest=YOUR@EMAIL_ADDRESS.com.au]

    [D] – Specify the directory of the access log of the site/s. 
     

    /var/www/vhosts/system/*/logs/*access*log

    [E] – Specify the duration of the ban of an ip address, and the number of attempts before its banned.

    Click “OK”. The filter is set up on the server.
    fail2ban wordpress

Was this article helpful?

Related Articles