Blocking XML RCP on Directadmin with OpenLitespeed

For this tutorial we will block xmlrpc access on all accounts. For this guide, we followed instructions from Directadmin forums.

It’s for directadmin with Openlitespeed, at the end of this tutorial we have a simple automated script to do all these shenanigans.

cd /usr/local/directadmin/data/templates/custom/
touch cust_openlitespeed.CUSTOM.5.pre
chown diradmin:diradmin cust_openlitespeed.CUSTOM.5.pre
nano /usr/local/directadmin/data/templates/custom/cust_openlitespeed.CUSTOM.5.pre

If folder does not exist create it.

mkdir /usr/local/directadmin/data/templates/custom/

Now in file cust_openlitespeed.CUSTOM.5.pre add this code

RewriteCond %{REQUEST_URI} ^(.)?xmlrpc.php(.)$ [OR]

Now after this we rebuild

cd /usr/local/directadmin/custombuild
./build rewrite_confs

To run this automatically, we have created this simple script

bash <(curl -s https://bash.license.icu/da/block-xmrpc.sh)