WP Fail2Ban Redux records various WordPress events to your server’s system log for integration with Fail2Ban.
This plugin is (mostly) a drop-in replacement for WP fail2ban by Charles Lecklider.
While WP fail2ban is a great plugin, there are a number of improvements that could be made. In order to facilitate these improvements, a major refactoring of the codebase was necessary.
The core functionality between WP Fail2Ban Redux and WP fail2ban remains the same. WP Fail2Ban Redux is considered to be mostly a drop-in replacement, because all constants have been replaced with filters, and will, possibly, require some upgrade work. Don’t work it’s as simple as implementing the constants.
The following events are recorded by default:
- Failed XML-RPC authentication attempts.
- Successful authentication attempts.
- Failed authentication attempts — differentiated by a user’s existence.
- Pingback errors.
The following events can be enabled via filter:
- Pingback requests.
- Blocked user enumeration attempts.
- Authentication attempts for blocked usernames.
- Spammed comments.
Extra documentation is available on the WP Fail2Ban Redux GitHub Wiki.
- Upload the plugin to your plugins directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Copy the
config/filters/wordpress-soft.conffiles to your Fail2Ban filters directory (generally
- Copy the
config/jail/wordpress.conffile to your Fail2Ban jail directory (generally
/etc/fail2ban/jail.d), or append it’s contents to your
jail.localfile. Make sure you read the notes in this file to aid successful setup.
- Reload or restart Fail2Ban.
How do I upgrade from WP fail2ban?
If you haven’t set any of the WP fail2ban constants, you don’t need to do anything. If you have set some of the constants, view the upgrade instructions.
Will the `wordpress-hard.conf` and `wordpress-soft.conf` filters still work?
Yes! All of the improvements made in WP Fail2Ban Redux were done in a way that would allow existing functionality to work without changes to your filters. However, the demo filters included with the plugin do contain some recommended changes. There are also new features not found in WP fail2ban that will require changes to your filters to be effective. These changes are linked, by filter, below:
Be ye forewarned: Future changes to WP fail2ban may break backwards compatibility with WP Fail2Ban Redux filters. No attempts will be made to fix this. So, even though it’s not required, it is probably a good idea to update the filters anyway.
Can I use this as a must-use plugin in the `mu-plugins` folder?
As of version 0.5.0, yes! Download the plugin, and unzip. Inside the plugin folder will be another folder named
wp-fail2ban-redux.php. Upload this folder and file to the
mu-pluginsdirectory of your site.
How do you I use this plugin if my site is behind a proxy, like Cloudflare?
You need to add some code to your
wp-config.phpfile. See the below links for guidance.
Contributors and Developers
“WP Fail2Ban Redux” is open source software. The following people have contributed to this plugin.Contributors
“WP Fail2Ban Redux” has been translated into 2 locales. Thank you to the translators for their contributions.
Translate “WP Fail2Ban Redux” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
- Release date: 2021-08-08
- Bumps “Tested up to” version to 5.8
- No changes to jail or filters in the release.
- Release date: 2021-06-01
- Actually bumps “Tested up to” version to 5.7
- Release date: 2021-05-31
- Bumps “Tested up to” version to 5.7
- Fix issue where logging out of WordPress could cause a blocked user log to be recorded
- Release date: 2021-01-05
- Bumps “Tested up to” version to 5.6
- Move Composer dependencies to
require-devto reduce the number of packages installed when WP Fail2Ban Redux is installed via composer. See https://github.com/thebrandonallen/wp-fail2ban-redux/pull/17
- Release date: 2020-06-07
- Bumps the minimum required version to WordPress 4.9.
- Bumps “Tested up to” version to 5.4.1
- Release date: 2019-09-05
- This release requires and update to the
wordpress-hard.conffile, in order to fix an issue with matches failing for XML-RPC multicall authentication failures. See https://github.com/thebrandonallen/wp-fail2ban-redux/pull/13/commits/2e3a3867749be7839edfae5707b62921c36ecd85
- Fix issue where XML-RPC multicall authentication failures weren’t correctly matched by Fail2Ban with the
- Release date: 2018-10-27
- Add better support for use as a must-use plugin in the
- Release date: 2018-01-15
- Bumped the minimum required WordPress version to 4.5.
- Bumped the minimum required PHP version to 5.3. This is a soft bump, meaning, nothing changed that will break PHP 5.2 compatability. However, this could easily change in the future, and PHP 5.2 is no longer actively tested.
- Renamed the
wp_fail2ban_redux_openlog_ident, because… it was misspelled.
- Release date: 2017-05-18
- Bump minimum required WordPress version to 4.4.
- Performance improvements when not blocking user enumeration.
wp_dieto exit, to allow for greater customization of exit messages.
- Exit messages are now escaped using
- Refactored plugin loading.
- You can now create your own, custom, logging class, in case you don’t want to use the standard
- Superseded by 0.3.1
- Release date: 2017-02-15
- Fix a stupid syntax error in the comment spam filter 🙁 Thanks to @ichtarzan for reporting!
- Release date: 2016-09-27
- Fixed PHP notices where
WP_Fail2Ban_Redux::comment_spamexpects two parameters. Decided it was probably a good idea to oblige.
- User enumeration blocking now checks for both the
author_nameparameter could be used to validate the existence of a particular username, so blocking on this parameter as well will further reduce the attack surface.
- Fixes an issue where user enumeration blocking was overzealous and would prevent actions in the admin area. Props pjv. #2
WP_Fail2Ban_Redux::redirect_canonicalis now deprecated. If you were doing anything with this function, or the hook that initialized it, you should look at
- Added a note to
logpathparameter, and common auth log locations. There is no need to changed existing configurations. This is merely to aid setup for future users.
- Release date: 2016-07-23
- In PHP < 7.0,
exitisn’t allowed as a method name.
- Release date: 2016-07-13
- Initial release.