How to stop xmlrpc attacks without disabling component to allow JetPack to work in WordPress?

With a whitelist, you typically deny all first, then allow. Then just keep adding Allow entries as needed. Try this:

<Files xmlrpc.php>
Order Deny,Allow
Deny from all
Allow from 122.248.245.244/32
Allow from 54.217.201.243/32
Allow from 54.232.116.4/32
Allow from 192.0.80.0/20
Allow from 192.0.96.0/20
Allow from 192.0.112.0/20
Allow from 195.234.108.0/22
Satisfy All
ErrorDocument 403 http://127.0.0.1/
</Files>

Note: Those last few IPs from the list in your question are covered by the preceding CIDR range, 192.0.96.0/20, so I omitted them.

You can get up-to-date details on the specific IP addresses to whitelist for various Jetpack services here: https://jetpack.com/support/hosting-faq/.


Personally I use fail2ban. That method has the advantage of preventing sketchy IPs from making any further type of requests to your server, either permanently or for a period of time according your settings. You might just need to review your fail2ban settings and reconfigure them to be tighter. It could possibly be related to this issue.

It’s also worth noting that Automattic offers free support for all Jetpack users. (Full disclosure: I work there. 🙂)