Virtualmin Fail2Ban WordPress/404/XMLRPC Setup Checklist

by | May 14, 2026 | Technical Help, Web Hosting, WordPress

🧾 Fail2Ban Virtualmin With WordPress Setup Checklist

Fail2Ban logoThis is a followup to my SmarterMail Fail2Ban installation (see https://charlesworks.com/hardening-your-smartermail-server-the-bouncer-defense/). I’m not an expert at Fail2Ban, but installing these filters reduced server CPU usage by about 30% on both virtual and bare metal servers. On systems running hard drives it was especially helpful as this filtering greatly reduced hard drive accesses which can be a real bottleneck on servers. Feel free to contact me at support@charlesworks.com with any observations or improvements.


👍 Here’s a clean, no-nonsense checklist you can walk through with nano:


📁 1. Create a WordPress filter

nano /etc/fail2ban/filter.d/wordpress.conf

Paste:

[Definition]
failregex = ^<HOST> -.*"(POST)\s+/wp-login\.php
ignoreregex =

📁 2. Create a 404 scanner filter

nano /etc/fail2ban/filter.d/apache-404.conf

Paste:

[Definition]
failregex = ^<HOST> -.*"(GET|POST).*(wp-admin|wp-login|xmlrpc|phpmyadmin|\.env|\.git).*" 404
ignoreregex =

📁 3. Create an xmlrpc filter

nano /etc/fail2ban/filter.d/xmlrpc.conf

Paste:

[Definition]
failregex = ^<HOST> -.*"(GET|POST).*xmlrpc\.php
ignoreregex =

📁 4. Create an “aggressive ajax” filter

NOTE: Use cautiously on busy WooCommerce or heavily dynamic WordPress sites. Monitor logs carefully before enabling on production ecommerce systems. This may cause false positives and can break shopping carts on very high use sites.

nano /etc/fail2ban/filter.d/wp-ajax-spam.conf

Paste:

[Definition]
failregex = ^<HOST> -.*"POST /wp-admin/admin-ajax\.php
ignoreregex = .*post\.php\?post=.*action=edit    # Ignore a user's actual editing activity

📁 5. Edit jail.local

nano /etc/fail2ban/jail.local

Add this line at the top of the file to prevent ever banning yourself, replacing the x.x.x.x with your IP address:

[DEFAULT]
ignoreip = 127.0.0.1/8 ::1 x.x.x.x

Then add these sections at the bottom of the file:


🔐 WordPress login protection

[wordpress]
enabled = true
port = http,https
filter = wordpress
backend  = polling
logpath = /var/log/virtualmin/*_access_log
maxretry = 5
findtime = 3600
bantime = 86400

⚡ XML-RPC is still accessible, but abusive clients are banned aggressively.

[xmlrpc]
enabled = true
port = http,https
filter = xmlrpc
backend  = polling
logpath = /var/log/virtualmin/*_access_log
maxretry = 3
findtime = 600
bantime = 86400

🔍 404 scanner protection

[apache-404]
enabled = true
port = http,https
filter = apache-404
backend  = polling
logpath = /var/log/virtualmin/*_access_log
maxretry = 20
findtime = 300
bantime = 86400

⚡ Aggressive Ajax protection

[wp-ajax-spam]
enabled = true
port = http,https
filter = wp-ajax-spam
backend  = polling
logpath = /var/log/virtualmin/*_access_log
maxretry = 30
findtime = 60
bantime = 86400

📁 Save the file


🔄 6. Restart Fail2Ban

systemctl restart fail2ban

✅ 7. Verify all jails

fail2ban-client status

You should see with the others in the list:

wordpress
xmlrpc
apache-404

🔍 8. Check each jail (optional)

fail2ban-client status wordpress
fail2ban-client status xmlrpc
fail2ban-client status apache-404

Or check in Virtualmin at:
Webmin > Networking > Fail2Ban Intrusion Detector > Jails Status


👍 That’s it

You now have:

  • WordPress login protection
  • XML-RPC abuse control (not blocked, but aggressive bans)
  • Bot/scanner detection via 404s
  • Ajax abuse control
  • All working across every Virtualmin domain automatically

Extra:

On some servers we have Remote Desktop enabled. We can monitor the access logs in those as well. Not a lot of sense in adding this to a box with no Remote Desktop enabled.

📁 1. Create XRDP filter

nano /etc/fail2ban/filter.d/xrdp.conf

Paste:

[Definition]
failregex = ^.*login failed for user .* from <HOST>
ignoreregex =

📁 2. Create XRDP jail file

nano /etc/fail2ban/jail.d/xrdp.local

Paste:

[xrdp]
enabled = true
port = 3389
filter = xrdp
logpath = /var/log/xrdp-sesman.log
maxretry = 5
bantime = 3600
findtime = 600

🔄 3. Restart Fail2Ban

systemctl restart fail2ban

✅ 4. Verify all jails

fail2ban-client status

You should see with the others in the list:

xrdp

🔍 5. Check the jail (optional)

fail2ban-client status xrdp

Or check in Virtualmin at:
Webmin > Networking > Fail2Ban Intrusion Detector > Jails Status


/>

Here are the official website URLs for Fail2Ban and FirewallD:

While the Fail2Ban website is the official home for documentation and the project wiki, much of the active development and issue tracking happens on their GitHub repository: https://github.com/fail2ban/fail2ban.

CLICK HERE to find your domain name!   CLICK HERE to transfer your domain name!

Archives

Tags

24 hour (1) Accessibility (2) Accounting (1) Advertising (19) AdWare (1) Alex Johnson (2) Alignment (1) Android (2) Anti-Virus (1) Antivirus (1) Antrim Computer Repair and Service (3) APC Back-UPS (1) Appearance (2) Apple Mail (4) Apple Mobile Mail (2) Attachments (1) Audit (1) Authorized (1) Autoresponder (5) Availability (1) Backups (1) Badges (3) Bank Account (1) Bank Statement (1) Battery Backup (2) Better Business Bureau (3) Bob Hill (1) Bookkeeper (1) Branding (11) Budget (2) Business (30) Business Management (1) Catalog (1) Categories (1) Charles Oropallo (1) CharlesWorks (43) Cherryl Jensen (1) Chrome (1) CleanTalk (1) Cloud (1) Code (2) Communicating (1) Competition (1) Computer (2) Computer Cache (1) Computer Hardware (1) Computer Security (2) Constant Contact (1) Consultation (1) Contact Information (2) Content (1) Content Management (41) Content Management System (1) Copiers (1) Copy Machine (1) Coronavirus (2) Courteous (1) COVID-19 (3) Credibility (9) Credit Card (1) Credit Card Processing (1) CSS (9) Customer Service (2) Database (1) Debian (1) Design (51) Design Expertise (1) Desktop (1) Dialup (1) DirectAdmin (4) Directions (1) DIVI (7) DNS (2) Do-it-Yourself (1) Documentation (1) Domain Expiration (1) Domains (23) Domain Transfers (5) E-Commerce (1) ecommerce (1) Elementor (1) Email (71) Email Lists (5) Email Management (5) Email marketing (4) Etiquette (3) Eudora 6 (1) Exchange (1) Expanding (1) Expiring Domains (1) Facebook (2) Financial (1) Finish (1) Firefox (1) Fonts (1) Forms (2) Forms Protection (1) Fraud (2) Galaxy S4 (1) General Info (1) Gmail (1) GoDaddy (1) Google (1) Google Adwords Certified Partner (1) Google Chrome (2) Groups (1) Happy Holidays (1) Hardware Help (1) Hill Specialty Networks (1) Hosting (1) Images (1) IMAP (1) include (1) Infected (1) Information (38) insert pages (1) Internet Browsing Errors (1) Internet Consultant (1) Internet Explorer (1) Joomla! (1) Keywords (2) Laptop (1) Legibility (1) Linux (14) Logging on (1) Macintosh (1) Mail 6.0 (1) Mail 2011 (2) Make-Over (1) Malicious (1) Malware (1) Marketing (11) Matt Burke (3) MDaemon (3) MelbourneIT (2) menu (1) Merchant (1) meta (1) Microsoft (1) Microsoft Edge (1) Microsoft Hosted Exchange (5) Microsoft Live (2) Mobile Email Setup (1) Monadnock Region (1) Mozilla Firefox (2) MySQL (1) Nathan Wesley (1) Netscape (1) Netscape Messenger (1) Office Copiers (1) OfficeLive (1) Online (1) Outlook (10) Outlook 2010 (2) Outlook Express (1) PayPal (1) Pay Per Click (2) PC (1) Personal (1) Peter Harris (1) Peter Harris Creative (1) Phishing (2) PHP (3) pixel (1) plugins (1) Pop Email (1) Popularity (1) Portfolio (1) Power Grid Failure (1) PPC (1) Prevent Fraud (1) Privacy (1) Private (1) Product (6) products (1) Professional (6) Projects (2) Protect (1) Protection (1) QR codes (1) Quality (2) QuickBooks (1) Reconciliation (1) Reduce Risk (1) Register (1) Reliability (2) Renew (1) Reseller (2) Resolution (1) Restrict User Access (1) Results (1) Review (2) Risk (1) Robin Snow (1) Roundcube (1) Safe (1) Samsung (2) Scam (23) Scammer (23) Search (1) Search and Replace (1) Search Engine Optimization (SEO) (22) Security (34) Security Risk (1) Selling (1) Servers (2) Service (11) Shopping Cart (1) Site (1) SmarterMail (9) Social Engineering (1) Social Networking (1) Software (1) solar flares (1) Solutions for Today (1) Spam (1) Spam Filtering (17) Spammer (1) Spyware (2) SquirrelMail (1) SSL (9) Statistics (2) Stats (2) Stone Pond Technology (1) Storage (1) Support (1) Tablet (1) Target Market (1) Technical Help (1) Testimonials (10) The CW Corner (1) Thom Little (1) Thom Little Associates (1) Thunderbird (3) Thunderbird 10 (2) TLD (1) Topic (1) Top Level Domains (3) Transaction (2) Transfer Data (1) Transfer Funds (1) Typography (1) Update (2) Uploading (1) UPS System (2) Up to Date (1) Virtualmin (1) Virus (2) Viruses (1) Vista (1) Web (1) Web-Over (1) Web Development (109) Web Hoster (1) Web Hosting (2) Web Hosting Company (1) Webmail (8) Web Mail (1) Webmaster (10) Webmin (1) Web Presence (29) Website (120) Website Development (1) websites (2) Web Stats (1) Web terms (1) Web Writing (1) Windows 7 (2) Windows Mail (6) Windows XP (1) WooCommerce (6) WordPress (94) WordPress Updates (1) Working Remote (2) Writing (1) YouTube (1)

Protected by Security by CleanTalk and CleanTalk Anti-Spam