Plesk

ModSecurity rule-set activation/update fails in Plesk: Unable to find row with id X in domains table

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

 

For Plesk on Linux

 

  1. Connect to the Plesk server via SSH.

  2. Create a Plesk database dump:

    # plesk db dump psa > /root/psa_dump.sql

  3. Repair the Plesk database:

    # plesk repair db -y

  4. Log in to Plesk.

  5. 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.

 

For Plesk on Windows Server

 

  1. Connect to the Plesk server via RDP.

  2. Start a command prompt as an Administrator.

  3. Create a Plesk database dump:

    C:> plesk db dump psa > C:psa_dump.sql

  4. Repair the Plesk database:

    C:> plesk repair db -y

  5. Open the Plesk database in MySQL:

    C:> plesk db

  6. 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;

  7. Log in to Plesk.

  8. 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.

 

Exit mobile version