Introduction
There may be times the database has become corrupted and you want to backup, restore, or regenerate the database. Using the utility provided with cPanel, this can be quickly done through the command line.
Procedure
cPanel offers the following script to reimport, export, or regenerate the Greylisting database.
/scripts/setup_greylist_db
Utility to manage the cPanel Greylist service. Available options:
--init => Initialize the SQLite DB with the basic data structure as needed.
--reset => Forceably reset the DB.
Note: This will attempt to preserve the Trusted Hosts List, if the greylisting service is enabled on the server.
--trust => Trust the IPs for the common email services specified. Specify this switch more than once to trust multiple services at the same time.
The following common services are recognized by this script:
--import => [/path/to/json/file]
Imports the Trusted Hosts contained in the specified JSON file:
/scripts/setup_greylist_db --import import.json
--export => Export the current Trusted Hosts List.
To export the list to a file, specify the 'export_to' switch:
/scripts/setup_greylist_db --export --export_to export.json
Or redirect stdout:
/scripts/setup_greylist_db --export > export.json
--update_common_mail_providers => Update the Common Mail Provider data in the database.
Fetches the latest data from a cPanel update mirror, and updates the database
based on current Common Mail Provider configuration.
You can specify '--force', in order to forceably update the IP data in the database.
The SQLite file is located at: /var/cpanel/greylist/greylist.sqlite.