How to Fix Outdated WP fail2ban Filters on DigitalOcean WordPress
Step-by-step guide for a DigitalOcean one-click WordPress installation on Ubuntu.
/etc/fail2ban/filter.d/wordpress-extra.conf is obsolete (version 4.3.0.8).
WP fail2ban’s WordPress plugin and Ubuntu’s server-side Fail2ban filters are separate. Updating the plugin does not necessarily update the copies under /etc/fail2ban/filter.d/.
1. Why this happens
The WordPress plugin emits security events, while server-level Fail2ban reads logs, matches them using filter files, and applies bans through configured firewall actions. The plugin ships filter files in its own directory; Fail2ban uses server-side copies.
After a plugin update, the server-side filters may remain old. WP fail2ban version 5 also changed its filter layout, so an old wordpress-extra.conf may no longer be needed in a standard setup. Do not assume this without checking your jail configuration.
Official references: WP fail2ban maintenance guide and version 5 upgrade notes.
2. Step-by-step instructions
Step 1 — Connect to the Droplet and check Fail2ban
sudo systemctl status fail2ban --no-pager
sudo fail2ban-client statusThese commands show whether Fail2ban is running and which jails are active.
Step 2 — Find the plugin’s supplied filter files
sudo find /var/www -path '*/wp-fail2ban/filters.d/*.conf' -print 2>/dev/nullA common plugin path is /var/www/html/wp-content/plugins/wp-fail2ban/filters.d/. Use the path actually returned by your server.
Step 3 — Back up the server filter directory
sudo cp -a /etc/fail2ban/filter.d "/root/fail2ban-filter-backup-$(date +%F-%H%M%S)"This preserves the current filters so you can recover them if needed.
Step 4 — List the installed WordPress filters
sudo ls -l /etc/fail2ban/filter.d/wordpress*.confStep 5 — Check whether the obsolete extra filter is referenced
sudo grep -Rni 'wordpress-extra' /etc/fail2banIf there is no output, no file under /etc/fail2ban appears to reference it. If output appears, review the referenced jail before removing or changing the filter.
Step 6 — Compare the hard and soft filters
These commands assume the plugin is in the standard directory. If Step 2 returned another path, replace the source path accordingly.
sudo diff -u \
/var/www/html/wp-content/plugins/wp-fail2ban/filters.d/wordpress-hard.conf \
/etc/fail2ban/filter.d/wordpress-hard.confsudo diff -u \
/var/www/html/wp-content/plugins/wp-fail2ban/filters.d/wordpress-soft.conf \
/etc/fail2ban/filter.d/wordpress-soft.confNo output means the files are identical. Differences mean they are not identical; review the plugin version and release notes before replacing them.
Step 7 — Update the hard and soft filters (only after comparing)
sudo install -m 644 \
/var/www/html/wp-content/plugins/wp-fail2ban/filters.d/wordpress-hard.conf \
/etc/fail2ban/filter.d/wordpress-hard.conf
sudo install -m 644 \
/var/www/html/wp-content/plugins/wp-fail2ban/filters.d/wordpress-soft.conf \
/etc/fail2ban/filter.d/wordpress-soft.confAdjust the source path if your plugin directory differs. WP fail2ban releases may change which filter files are required.
Step 8 — Remove the old extra filter only if it is not needed
If the grep in Step 5 produced no output, and you confirmed your installed release and jails no longer need the file, back it up separately:
sudo cp -a /etc/fail2ban/filter.d/wordpress-extra.conf /root/wordpress-extra.conf.backupThen, only if you confirmed it is unnecessary:
sudo rm /etc/fail2ban/filter.d/wordpress-extra.confStep 9 — Test the configuration
sudo fail2ban-client -tDo not reload if the test fails. Read the error and fix the missing filter or invalid configuration first.
Step 10 — Reload and verify
sudo fail2ban-client reload
sudo systemctl status fail2ban --no-pager
sudo fail2ban-client statusIf your WordPress jail is actually named wordpress, inspect it with:
sudo fail2ban-client status wordpress3. Common problems
- “No such file or directory”: Use Step 2 to locate the real plugin path. Do not guess paths.
- Warning remains: Check the plugin version and its release notes. The Site Health check may itself have a version-detection issue.
- Configuration test fails: Do not reload. Review the reported jail/filter error and restore the backup if necessary.
- No bans appear: Confirm a jail is enabled, reading the expected log, matching events, and applying a working firewall action.
allowipv6warning: This is separate from obsolete filters. The defaultautosetting is often appropriate; don’t disable IPv6 merely to hide the warning.
4. Final check
In WordPress, open Tools → Site Health and check whether the obsolete-filter warning has disappeared. If it remains, confirm the installed WP fail2ban version and compare the server filters with the matching release.
Official documentation: WP fail2ban maintenance.