Symptoms
When activating or updating ModSecurity rule-set in Plesk at Tools & Settings > Web Application Firewall (ModSecurity), the operation fails with:
Unable to find row with id X in domains table.
Cause
Inconsistency in the Plesk database: orphaned records exist in the psa.IisAppPools
table.
Resolution
-
Connect to the Plesk server via SSH.
-
# plesk db dump psa > /root/psa_dump.sql
-
Repair the Plesk database:
# plesk repair db -y
-
Go to Tools & Settings > Web Application Firewall (ModSecurity), and click OK to update/activate the rule-set.
Note: If the error message is still shown, select another rule-set and apply the changes. Then switch back to previous rule-set.
-
Connect to the Plesk server via RDP.
-
C:> plesk db dump psa > C:psa_dump.sql
-
Repair the Plesk database:
C:> plesk repair db -y
-
Open the Plesk database in MySQL:
C:> plesk db
-
Remove the orphaned entries:
DELETE i, ia FROM IisAppPools i LEFT JOIN IisAppPoolDomains ia ON i.id = ia.poolId LEFT JOIN domains d ON d.id = ia.domainId WHERE d.name IS NULL AND i.id != 1;
-
Go to Tools & Settings > Web Application Firewall (ModSecurity), and click OK to update/activate the rule-set.
Note: If the error message is still shown, select another rule-set and apply the changes. Then switch back to previous rule-set.