Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
VGSources
Blog

How to Set Up a Fail2ban Jail for WordPress XML-RPC Attacks

A practical guide to configuring, validating, and tuning Fail2ban jails for WordPress XML-RPC attacks, including WP fail2ban filters, systemd journals, web-server logs, thresholds, and troubleshooting.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To block WordPress XML-RPC brute-force traffic with Fail2ban, install and activate the WP fail2ban plugin, make sure WordPress failures are written to a log Fail2ban can read, define a local jail using the wordpress-hard and (optionally) wordpress-soft filters, then validate the filter against real log lines before enabling bans. The exact configuration depends on whether your site logs through systemd or through Apache, Nginx, or PHP log files.

What XML-RPC attacks are and what Fail2ban can do

WordPress exposes remote publishing and integration functions through xmlrpc.php. Attackers commonly send repeated authentication requests to that endpoint, often using the system.multicall method to bundle many attempts into one request. WordPress’s Advanced Administration Handbook describes xmlrpc.php as “a frequent brute-force target (especially the system.multicall method).”

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fail2ban does not sit in front of PHP and does not make XML-RPC requests disappear. It watches authentication or security messages, counts matches from each source IP, and asks the host firewall to reject that address for a specified period. This reduces repeated attempts after the first threshold is reached, but the request that produces the log entry still reaches your web stack. If the endpoint is not needed, disabling or restricting it is a stronger way to remove that workload.

Choose an XML-RPC policy before configuring Fail2ban

Approach When it fits Trade-off
Disable or restrict XML-RPC The site has no integration that requires remote publishing or XML-RPC calls. Removes or narrows the endpoint, but breaks clients that depend on it.
wordpress-hard filter Clearly malicious WordPress events, including XML-RPC authentication and multicall failures. Fast blocking with a higher false-positive risk; requires WP fail2ban and reliable WordPress logging.
wordpress-soft filter Failed-login events where a legitimate user or integration could be involved. Allows more retries, reducing accidental bans but delaying blocking.
Web-server or edge throttling You need to reduce requests before PHP handles them. Rules vary by Apache, Nginx, proxy, and real-IP configuration; this complements rather than replaces log-based bans.

Jetpack, mobile clients, or another publishing integration may require XML-RPC. Confirm those dependencies before disabling the endpoint. If XML-RPC must remain available, combine a suitable Fail2ban jail with server-level rate controls and accurate client-IP logging.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Prerequisites and the log path Fail2ban must read

  • Install Fail2ban from the supported package source for your operating system.
  • Install and activate WP fail2ban in WordPress when you intend to use its purpose-built filters.
  • Confirm that WordPress failures are actually being emitted either to the systemd journal or to a readable Apache, Nginx, or PHP log file.
  • Verify that each record contains the original client IP, not the address of a reverse proxy or load balancer.
  • Use a Fail2ban version and WP fail2ban version whose filter and jail syntax are compatible.

The WP fail2ban journal example uses backend = systemd and journalmatch = SYSLOG_IDENTIFIER=wordpress. Those values are correct only when your deployment writes WordPress messages with that identifier. If your installation uses a different identifier, the jail can be enabled yet match nothing.

For file-based logging, identify the exact access or error log that contains the WordPress failure lines. A path such as /var/log/... is only an example; use the path created by your virtual host, container, PHP handler, or hosting layout.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Put local changes in a file that package updates will not overwrite

Do not edit the packaged /etc/fail2ban/jail.conf. Distribution updates can replace it. Create a local override such as /etc/fail2ban/jail.d/wordpress.conf, or place the definitions in /etc/fail2ban/jail.local. The jail.d file is easier to isolate when you have several sites or services.

Create the directory first if your distribution does not already provide it, then open the file with an editor as an administrator:

sudo mkdir -p /etc/fail2ban/jail.d
sudo editor /etc/fail2ban/jail.d/wordpress.conf

Keep one jail definition per section. Names such as wordpress-hard and wordpress-soft are useful because they make status and troubleshooting commands unambiguous.

Configure a systemd-journal jail

When WP fail2ban sends messages to journald with SYSLOG_IDENTIFIER=wordpress, use a systemd backend. This is the documented starting point:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
[wordpress-hard]
enabled = true
filter = wordpress-hard
backend = systemd
journalmatch = SYSLOG_IDENTIFIER=wordpress
maxretry = 1
port = http,https

[wordpress-soft]
enabled = true
filter = wordpress-soft
backend = systemd
journalmatch = SYSLOG_IDENTIFIER=wordpress
maxretry = 3
port = http,https

The hard filter is intended for events that are almost always malicious, so the example bans after one matching event. The soft filter allows three failures because an ordinary login mistake or an integration hiccup can be legitimate. The documentation recommends using both when your logging and traffic patterns support that distinction.

port = http,https tells the action which web-service ports to protect. It does not create a listener, change your firewall policy outside the ban action, or prove that your site uses only those ports. If the site is published through a different port or an upstream firewall, make the action and network policy agree.

Do not add logpath to this systemd definition as though it were a file backend. For the systemd backend, the journal selector is the source. A file path belongs in a file-based jail.

Configure the same filters for Apache, Nginx, or PHP log files

If WordPress failures are written to a web-server or PHP log, retain the appropriate filter but change the backend and point logpath at the real file. A generic pattern looks like this:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
[wordpress-hard]
enabled = true
filter = wordpress-hard
backend = auto
logpath = /path/to/your/actual-wordpress.log
maxretry = 1
port = http,https

Replace the example path with the file that contains representative matching lines. Some systems need a file backend explicitly; others work with Fail2ban’s automatic backend. Follow the backend conventions of the Fail2ban package installed on that host.

Do not copy the journalmatch line into a file-based jail, and do not assume an Apache access log contains the WordPress authentication message. If the filter expects WP fail2ban messages but your web server logs only a URL and status code, the filter may never match. Capture a real failed XML-RPC event in a controlled test and inspect which log receives it before choosing the source.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Understand and tune bantime, findtime, and maxretry

Fail2ban’s three principal thresholds have distinct meanings:

Setting Meaning Stock default Practical question
bantime How long a matching IP remains banned. 10m How long should this address be unable to connect?
findtime The interval during which Fail2ban counts failures. 10m How far back should recent failures be considered?
maxretry The number of failures required within findtime before a ban. 5 How many matches are acceptable before blocking?

The stock values are package defaults, not a security recommendation for every site. A conservative rollout starts with a short ban and a narrow observation window, watches for legitimate XML-RPC clients being caught, and increases the ban duration only after the behavior is understood. The journal example deliberately overrides maxretry to one for the hard filter and three for the soft filter; it leaves bantime and findtime at their configured defaults unless you set them globally or in the jail.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For example, a site that has verified that every hard-filter match is hostile might add:

bantime = 1h
findtime = 10m
maxretry = 1

That policy means one hard-filter match causes a one-hour ban, while the ten-minute window still governs counting. Do not select a long duration merely because attacks are annoying: shared office NAT, mobile carriers, VPN exits, monitoring systems, and legitimate integrations can make one public address represent many users.

Handle trusted addresses and reverse proxies carefully

Use ignoreip only for addresses you can identify reliably, such as a fixed administrative address or a known monitoring host. Fail2ban warns that DNS-based identity can be unsafe because reverse and forward DNS may not agree. Prefer literal IP addresses that appear in the application log.

[DEFAULT]
ignoreip = 192.0.2.10 198.51.100.7

The addresses above are documentation examples; replace them with the real, stable addresses you have verified. Never whitelist an entire provider range simply because a legitimate client currently uses it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

When a reverse proxy sits in front of the origin, configure trusted real-IP handling in the proxy and web server first. Otherwise every failed request can appear to come from the proxy itself, and Fail2ban may ban that shared proxy address. A ban against the proxy can interrupt every visitor while leaving the attacker unaffected. Check a raw log line and confirm that its source address is the original client before enabling an aggressive jail.

Reload Fail2ban and confirm that the jails loaded

After saving the local file, reload or restart the service using the service manager on your operating system. Then inspect the global jail list and each WordPress jail:

sudo systemctl restart fail2ban
sudo fail2ban-client status
sudo fail2ban-client status wordpress-hard
sudo fail2ban-client status wordpress-soft

The status output should show each jail as active, the selected filter, the configured backend, and counters for currently failed and banned addresses. If a jail is missing, Fail2ban rejected the file or the section is disabled. If it is present but has zero matches, continue with log and regex validation rather than assuming the site is safe.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test the filter against representative log entries

Run fail2ban-regex against the actual log file or a fixture containing representative lines. Use the filter installed on the host:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo fail2ban-regex /path/to/representative-wordpress.log /etc/fail2ban/filter.d/wordpress-hard.conf

For a journal-backed deployment, first export or otherwise capture representative journal lines, then test that fixture. The important point is to test the same format and identifier your jail will consume. A regex that matches a hand-written example but not the production timestamp, hostname, process name, or client-IP field will not produce bans.

Review the match count and the unmatched lines. Confirm that:

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
  • The XML-RPC authentication or multicall failure is recognized by the selected filter.
  • The captured address is the original client address.
  • A legitimate login failure is not being classified as a hard event unintentionally.
  • Lines from unrelated virtual hosts are not being included by an overly broad file path.

Then generate a controlled failed request from an address you are prepared to ban, or use a safe log fixture if you do not want to trigger a real authentication failure. Watch the jail status again and verify that the failure counter increases for the expected address.

Inspect, unban, and adjust through fail2ban-client

fail2ban-client can inspect and change jail settings without editing the packaged configuration. Use the jail status command to see current failures and bans:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo fail2ban-client status wordpress-hard

If a legitimate address is banned, remove it from the specific jail rather than disabling protection globally:

sudo fail2ban-client set wordpress-hard unbanip 203.0.113.25

Replace the documentation address with the real address shown in the status output. You can also use the client to inspect or change values such as findtime, bantime, and maxretry, and to query the active failregex. Runtime changes are useful for recovery and testing; make permanent changes in your local jail file so a service restart does not undo them.

Troubleshoot the common failure modes

The jail is active but never bans

  • Check that the selected filter is installed. The wordpress-hard and wordpress-soft filters come from WP fail2ban and require that plugin.
  • Verify the source. A wrong journalmatch identifier or an incorrect logpath produces no matches.
  • Run fail2ban-regex with a real log sample and inspect unmatched lines.
  • Confirm that the WordPress event is logged at all. A web-server access line alone may not contain the failure text the filter expects.

The jail fails to start after editing

  • Check section names, indentation, and option spelling in the local file.
  • Do not combine systemd-only journal settings with a file backend.
  • Review the Fail2ban service log for the exact parse error, correct the file, and restart.

Every visitor appears to share one address

This almost always indicates missing or incorrect real-IP handling behind a proxy or load balancer. Fix trusted proxy configuration and verify the resulting log lines before allowing bans. Do not solve it by whitelisting the proxy indefinitely; that simply prevents the jail from protecting the origin.

Legitimate integrations are blocked

Identify the integration’s source addresses and failure pattern. Lower the aggressiveness of the soft jail, increase maxretry for events that can be legitimate, or add only stable administrative addresses to ignoreip. If the integration cannot tolerate the policy, use endpoint restriction or web-server throttling that distinguishes the integration from unauthenticated brute force.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A ban does not reduce server load

Fail2ban acts after a log event, so the initial requests still reach the web server and PHP. Add server-level or edge throttling, or disable XML-RPC when no required integration uses it. Keep Fail2ban for repeated authentication events and as a response layer.

Operational checklist for a safe rollout

  1. List every service that uses XML-RPC, including publishing tools, mobile clients, and automation.
  2. Install Fail2ban and WP fail2ban from supported sources, and activate the WordPress plugin if its filters are required.
  3. Trigger or observe a known failed XML-RPC authentication and locate the exact journal or file record.
  4. Confirm that the record contains the original client IP.
  5. Create /etc/fail2ban/jail.d/wordpress.conf or edit /etc/fail2ban/jail.local; leave the packaged jail.conf unchanged.
  6. Choose the systemd example only when SYSLOG_IDENTIFIER=wordpress matches your journal; otherwise configure the real file path and compatible backend.
  7. Enable wordpress-hard for clearly malicious events and add wordpress-soft when you need a less aggressive policy for ambiguous failures.
  8. Set bantime, findtime, and maxretry based on observed traffic instead of copying a long ban blindly.
  9. Reload Fail2ban and inspect both global and per-jail status.
  10. Run fail2ban-regex against representative production-format lines before relying on automatic bans.
  11. Test a controlled match, verify the expected address is banned, and practice unbanning a legitimate address.
  12. Monitor false positives and revisit whether XML-RPC can be disabled or restricted entirely.

What a correctly working setup looks like

A working configuration has three aligned pieces: WordPress emits a recognizable failure, the selected Fail2ban backend reads the place where that failure is written, and the filter extracts the real client address. The jail then applies your chosen threshold and firewall action. If any one of those pieces is wrong, the service can appear healthy while providing no protection.

Start with the smallest policy that fits your site, prove the matches with fail2ban-regex, and increase enforcement only after observing real clients. When no integration needs XML-RPC, removing or restricting the endpoint is preferable; when an integration does need it, accurate logging, a tested WP fail2ban filter, and carefully tuned thresholds provide a measurable way to contain repeated attacks.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.