Command or API call to Restrict Plesk Administrative Access via IP

Created:

2016-11-16 13:23:18 UTC

Modified:

2017-08-16 16:56:11 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Command or API call to Restrict Plesk Administrative Access via IP

Applicable to:

  • Plesk 11.x for Linux
  • Plesk 11.x for Windows

Question

How to Restrict Plesk Administrative Access (Tools & Settings > Restrict Administrative Access) via the command line or API.

IP access restriction management

Resolution

Currently there is no possibility to manage this settings via API. Feature request number 1755420 has been created regarding the matter. However this could be done via CLI (see below).

Workaround

Use the 'admin' utility with the below options:

# /usr/local/psa/bin/admin --set-admin-access-restrictions rest.xml

Where rest.xml content should have the following format:

<?xml version="1.0" encoding="UTF-8"?>
<admin-access-restrictions>
<restriction-item ip-subnet-mask="255.255.255.255" ip-address="1.2.3.3" type="deny"/>
<restriction-item ip-subnet-mask="255.255.255.255" ip-address="1.1.3.3" type="deny"/>
<restriction-item ip-subnet-mask="255.255.255.255" ip-address="1.1.1.3" type="deny"/>
<restriction-item ip-subnet-mask="255.255.255.255" ip-address="10.50.2.10" type="deny"/>
<restriction-item ip-subnet-mask="255.255.255.255" ip-address="2.2.2.2" type="allow"/>
<restriction-item ip-subnet-mask="255.255.255.255" ip-address="3.3.3.3" type="allow"/>
</admin-access-restrictions>

Make sure that the access_policy parameters are set to allow specified in psa database:

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e'update misc set val="allow" where param="access_policy"'
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e'select * from misc where param="access_policy"'
+---------------+-------+
| param | val |
+---------------+-------+
| access_policy | allow |
+---------------+-------+
Have more questions? Submit a request
Please sign in to leave a comment.