Solved Enable xmlrpc.php for one site only

twv

Verified User
Joined
Oct 31, 2003
Messages
219
I am using the technique here ( https://help.poralix.com/articles/how-to-block-access-to-xmlrpc-php-serverwide-on-directadmin ) to disable xmlrpc.php, but I would like to enable it for one site only. How do I do that?

The technique is to add
Code:
<Location ~ "/xmlrpc.php">
    Order allow,deny
    Deny from all
    ErrorDocument 403 "Sorry, you are not allowed to view this page!"
</Location>

to four files in /usr/local/directadmin/data/templates/custom/ : virtual_host2.conf.CUSTOM.4.post, virtual_host2_secure.conf.CUSTOM.4.post, virtual_host2_secure_sub.conf.CUSTOM.4.post, virtual_host2_sub.conf.CUSTOM.4.post
 
Add some condition checking
Code:
|*if CUST_ALLOW_XMLRPC!="1"|
<Location ~ "/xmlrpc.php">
    Order allow,deny
    Deny from all
    ErrorDocument 403 "Sorry, you are not allowed to view this page!"
</Location>
|*endif|


and go set variable via webpanel ( :2222 ) Custom HTTPD configuration, select target domain and add this to "custom1" before "custom4".
Code:
|?CUST_ALLOW_XMLRPC=1|
 
Last edited:
Thank you very much for your help. It works. The only thing I was a little confused about was that I needed to put "|?CUST_ALLOW_XMLRPC=1|" in the "httpd.conf customization for domain.tld" field and not, as I tried at first, in the Additional CUSTOM tokens -> CUSTOM1 field below it.
 

Attachments

  • screenshot-2024-06-07-145702.jpg
    screenshot-2024-06-07-145702.jpg
    34.7 KB · Views: 6
hehe, I didn't know that. I just remember basic thing and combined with my programming knowledge, good to hear that.
 
  • Like
Reactions: twv
Back
Top