Hermes SEG Bulk Recipient Import and Delete
Currently, Hermes SEG provides a way to bulk import Internal Recipients through the Administration Console Web GUI only by using Active Directory Integration if you have a Hermes SEG Pro license. However, if Active Directory Integration is not available or possible, there is no way to bulk import or delete Internal recipients through the Administration Console Web GUI. For those cases, we are providing a command line bash script that will enable you to bulk import and bulk delete Internal Recipients that are stored in a .csv file.
As an added benefit, if your mailboxes are stored on a Microsoft Exchange server, we are also providing a export_exchange_mailboxes.ps1 powershell script that will allow you to export all your Exchange mailboxes into a .csv file that you can use to import into Hermes SEG.
Download Required Files
In a Hermes SEG root command console run the following command to download the required files to a directory of your choice:
wget https://raw.githubusercontent.com/deeztek/Hermes-Secure-Email-Gateway/master/dirstructure/opt/hermes/scripts/hermes_bulk_import_delete_recipients.sh \ wget https://raw.githubusercontent.com/deeztek/Hermes-Secure-Email-Gateway/master/dirstructure/opt/hermes/scripts/insert.sql \ wget https://raw.githubusercontent.com/deeztek/Hermes-Secure-Email-Gateway/master/dirstructure/opt/hermes/scripts/delete.sql
After running the command above, you will end up with the following files:
- hermes_bulk_import_delete_recipients.sh - Bulk Import/Delete Bash Script
- insert.sql - Bulk Import .sql file that hermes_bulk_import_delete_recipients.sh script uses to clean up the imported data and update additional fields in the database for the bulk import to succeed.
- delete.sql - Bulk Delete .sql file that hermes_bulk_import_delete_recipients.sh script uses to clean up the imported data and update additional fields in the database for the bulk delete to succeed.
Perform Bulk Import or Delete
Copy the .csv file containing the e-mail addresses to be imported/deleted to a directory of your choice on the Hermes SEG machine.
The hermes_bulk_import_delete_recipients.sh assumes that the first line of the .csv file will contain a column header and it's already setup to skip the first line during import. If the first line contains an e-mail address that must be imported, then that e-mail address will be skipped.
You must have the domain for each recipient to be imported/deleted already configured under 'Gateway --> Relay Domains' before attempting to run the hermes_bulk_import_delete_recipients.sh script below.
Run the hermes_bulk_import_delete_recipients.sh script by running the command below:
If the domains for every recipient to be imported/deleted are already configured in Hermes SEG under Gateway --> Relay Domains, enter 1 to continue in the following prompt (Figure 1):
In the following prompt enter the MySQL(MariaDB) root password (Figure 2):
In the following prompt enter the full path and filename to your .csv file (Figure 3):
In the following prompt enter 1 if you are performing bulk import or enter 2 if you are performing bulk delete (Figure 4):
If the operation was successful, you should get an output similar to below depending on the operation you chose above (Figure 5):
If you selected Import, you should have a listing of the e-mail addresses contained in your .csv file under the Internal Recipients to be added section (Figure 6)
If you selected Delete, you should have a listing of the e-mail addresses contained in your .csv file highlighted in bold red under the Existing Internal Recipients section (Figure 7):
Verify that the e-mail address listing is correct and then click on the Apply Settings button at the bottom of the page to finish (Figure 8):
If you are performing a bulk delete and you are deleting a lot of e-mail addresses, the operation can take a very long time to complete after you click the Apply Settings button. Please be patient and do NOT navigate away from Internal Recipients page until the operation has finished.
Support can be obtained by visiting our Community Discussions on Github.