• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Forwarded to devs Plesk keeps mail service attached to a dedicated IP after receiving release request from WHMCS

burnley

Regular Pleskian
TITLE:
Plesk keeps mail service attached to a dedicated IP after receiving release request from WHMCS
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:
Plesk Onyx Version 17.5.3 Update #72, last updated on May 7, 2019 04:49 PM
CentOS Linux 7.6.1810 (Core)‬
PROBLEM DESCRIPTION:
We're using WHMCS with Plesk API to deploy hosting on shared/dedicated IP addresses and we've noticed this behaviour, which we strongly believe is a bug. Test case follows:
Very important!! At the time of the test, Plesk is configured with Server-Wide Mail Settings -> Outgoing mail mode -> Send from domain IP addresses

Shared IP: 192.168.1.240
Dedicated IP: 192.168.10.245

In WHMCS I create an order for a test hosting which is configured to use a dedicated IP (192.168.10.245 here). All good, the subscription gets deployed on the dedicated IP and I can see it in Tools & Settings -> IP Addresses attached to the dedicated IP.
This is what I see in psa:

MariaDB [psa]> SELECT d.name, d.webspace_id, ipac.ipCollectionId,ds.type,ip.ip_address FROM DomainServices ds INNER JOIN IpAddressesCollections ipac ON ds.ipCollectionId = ipac.ipCollectionId INNER JOIN domains d ON d.id = ds.dom_id JOIN IP_Addresses ip on ipac.ipaddressid=ip.id WHERE (ds.type = 'web' OR ds.type = 'mail') and d.name='000adidedicatedip2.local';
+--------------------------+-------------+----------------+------+----------------+
| name | webspace_id | ipCollectionId | type | ip_address |
+--------------------------+-------------+----------------+------+----------------+
| 000dedicatedip2.local | 0 | 1096 | mail | 192.168.10.245 |
| 000dedicatedip2.local | 0 | 1097 | web | 192.168.10.245 |
+--------------------------+-------------+----------------+------+----------------+
2 rows in set (0.00 sec)

Next, I go in WHMCS and, for the selected product, I click "Release dedicated Ip" "Confirm Release" button, which reconfigures the subscription in Plesk to use the shared IP. When I can into Plesk Tools & Settings -> IP Addresses I see 0 sites for the dedicated IP that's just been released.

At this point I should be able to reuse the dedicated IP for another subscription. But this is not the case, Plesk still thinks it's in use and we've found that, even after reconfiguring the subscription with the shared IP, Plesk keeps the mail service bound to the dedicated IP. The sam query now returns:
MariaDB [psa]> SELECT d.name, d.webspace_id, ipac.ipCollectionId,ds.type,ip.ip_address FROM DomainServices ds INNER JOIN IpAddressesCollections ipac ON ds.ipCollectionId = ipac.ipCollectionId INNER JOIN domains d ON d.id = ds.dom_id JOIN IP_Addresses ip on ipac.ipaddressid=ip.id WHERE (ds.type = 'web' OR ds.type = 'mail') and d.name='000adidedicatedip2.local';
+--------------------------+-------------+----------------+------+----------------+
| name | webspace_id | ipCollectionId | type | ip_address |
+--------------------------+-------------+----------------+------+----------------+
| 000dedicatedip2.local | 0 | 1096 | mail | 192.168.10.245 |
| 000dedicatedip2.local | 0 | 1097 | web | 192.168.1.240 |
+--------------------------+-------------+----------------+------+----------------+
2 rows in set (0.00 sec)

How can I *fix* the database inconsistency in order to be able to reuse dedicated IP 192.168.10.245?​
STEPS TO REPRODUCE:
  • Make sure that, at the time of the test, Plesk is configured with Server-Wide Mail Settings -> Outgoing mail mode -> Send from domain IP addresses
  • Use WHMCS to deploy hosting on a dedicated IP attached
  • Verify the successful deployment in Plesk
  • Go into WHMCS and release the dedicated IP
  • Verify the release in Plesk. In our case, web service is reconfigured on the shared IP, but mail stays on the dedicated one. <- THIS is the issue.
ACTUAL RESULT:
When receiving the release request from WHMCS, Plesk reconfigures the subscriptions on the shared IP for the web service only, mail service stays on dedicated.​
EXPECTED RESULT:
When receiving the release request from WHMCS, Plesk reconfigures the subscriptions on the shared IP for both web and mail services.​
ANY ADDITIONAL INFORMATION:
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:
Confirm bug
 
More test results. Trying to remove the dedicated IP address 192.168.10.245 in Plesk I'm getting "Unable to remove an IP address: The IP address is already used for hosting". Next, did a backup of the psa database and ran these sql queries:

MariaDB [psa]> SELECT d.name, d.webspace_id, ipac.ipCollectionId,ds.type,ip.ip_address FROM DomainServices ds INNER JOIN IpAddressesCollections ipac ON ds.ipCollectionId = ipac.ipCollectionId INNER JOIN domains d ON d.id = ds.dom_id JOIN IP_Addresses ip on ipac.ipaddressid=ip.id WHERE (ds.type = 'web' OR ds.type = 'mail') and d.name='000adidedicatedip2.local';
+--------------------------+-------------+----------------+------+----------------+
| name | webspace_id | ipCollectionId | type | ip_address |
+--------------------------+-------------+----------------+------+----------------+
| 000dedicatedip2.local | 0 | 1096 | mail | 192.168.10.245 |
| 000dedicatedip2.local | 0 | 1097 | web | 192.168.1.240 |
+--------------------------+-------------+----------------+------+----------------+
2 rows in set (0.00 sec)

MariaDB [psa]> select * from IpAddressesCollections where ipCollectionId='1096';
+----------------+-------------+
| ipCollectionId | ipAddressId |
+----------------+-------------+
| 1096 | 7 |
+----------------+-------------+
1 row in set (0.00 sec)

MariaDB [psa]> select * from IpAddressesCollections where ipCollectionId='1097';
+----------------+-------------+
| ipCollectionId | ipAddressId |
+----------------+-------------+
| 1097 | 1 |
+----------------+-------------+
1 row in set (0.00 sec)


MariaDB [psa]> update IpAddressesCollections set ipAddressId=1 where ipCollectionId=1096;
Query OK, 1 row affected (0.04 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [psa]> SELECT d.name, d.webspace_id, ipac.ipCollectionId,ds.type,ip.ip_address FROM DomainServices ds INNER JOIN IpAddressesCollections ipac ON ds.ipCollectionId = ipac.ipCollectionId INNER JOIN domains d ON d.id = ds.dom_id JOIN IP_Addresses ip on ipac.ipaddressid=ip.id WHERE (ds.type = 'web' OR ds.type = 'mail') and d.name='000adidedicatedip2.local';
+--------------------------+-------------+----------------+------+---------------+
| name | webspace_id | ipCollectionId | type | ip_address |
+--------------------------+-------------+----------------+------+---------------+
| 000dedicatedip2.local | 0 | 1096 | mail | 192.168.1.240 |
| 000dedicatedip2.local | 0 | 1097 | web | 192.168.1.240 |
+--------------------------+-------------+----------------+------+---------------+
2 rows in set (0.00 sec)

Then, to clean up Postfix configuration, went and removed this entry from /etc/postfix/master.cf:
plesk-192.168.10.245- unix - n n - - smtp -o smtp_bind_address=192.168.10.245 -o smtp_bind_address6= -o smtp_address_preference=ipv4
Followed by "plesk repair mail 000adidedicatedip2.local"

After doing all these I was able to remove the IP from Plesk. Is the above procedure correct, or did I stuff something up?
 
Yep, we know about that article and have used it in the past in similar situations. Just wanted to confirm the workaround after changing both psa & Postfix configuration, as well as asking for a fix.
 
Thank you for the report.
We confirm, there is a bug in WHMCS module, EXTWHMCS-53 was submitted.
 
Thanks for looking into this. Just want to make sure I get this one right: is this a WHMCS module bug? Anything to do with the Plesk server at all? We're not using any Plesk module for WHMCS, we're just using the Plesk API.
 
Integration between Plesk and WHCS is done by the mean of WHMCS module and bug is related to this module. It performs wrong API request to Plesk server on releasing IP address.
 
Katya, thanks again for confirming there *is* and issue and it will be fixed. *However* your replies are very cryptic and they're not helping us in understanding exactly where the problem is in OUR case. Again, we're not using the standard WHMCS provided module for Plesk, we've developed and are maintaining our own. So, what does that "bug is related to this module. It performs wrong API request to Plesk server" supposed to mean in our case? If the WHMCS module is using the wrong API request, maybe we are doing the same. What is the correct API request in this case? How is this call supposed to be coded to make sure the dedicated IP is released properly?
 
Correct API request for changing IP address on both web and mail service is:
Code:
<webspace>
  <set>
    <filter>
      <name>000adidedicatedip2.local</name>
    </filter>
    <values>
      <hosting>
        <vrt_hst>
          <ip_address>192.168.1.240</ip_address>
        </vrt_hst>
      </hosting>
      <mail>
        <ip_address>192.168.1.240</ip_address>
      </mail>
    </values>
  </set>
</webspace>
 
Cool, thanks for that. Now, we don't do the <mail> <ip_address>192.168.1.240</ip_address> </mail> at the moment because when setting up the dedicated ip, we don't specify two different blocks - one for hosting and one for mail. But the API for setting up dedicated ip take only the hosting node and does it for both hosting and mail, this is how it's been working for us for a very long time! Looks like the Plesk behaviour in this case is inconsistent in its current form:
- "Set up dedicated IP API" adjusts hosting & mail
- "Release dedicated IP API call" only adjusts hosting. Why doesn't it touch mail? It'd be logical & common sense to undo *all* the changes, not just some. Unless, instead of the current API call for releasing the IP, we should be using another one that changes both hosting & mail.
Does the above make sense?
 
Back
Top