hMailServer backup routine with extras
Discussion thread: https://hmailserver.com/forum/viewtopic.php?f=9&t=35447
OpenPhish database files updater. New variables added to config.
See topic for further info: https://hmailserver.com/forum/viewtopic.php?t=40295
Removed offsite upload to letsupload.io because they are now defunct
- Stops hMailServer and SpamAssassin Services
- Updates SpamAssassin
- Cycles hMailServer and SpamAssassin logs
- Backs up hMailServer data directory using RoboCopy
- Dumps MySQL database -or- internal database and adds to backup directory
- Backs up miscellaneous files
- Updates OpenPhish database files
- Restarts SpamAssassin and hMailServer
- Prunes messages older than specified number of days in specified folders and subfolders (eg Trash, Spam, etc)
- Feeds messages newer than specified number of days to Bayes database through spamc.exe
- Prunes hMailServer logs older than specified number of days
- Prunes local backup copies older than specified number of days
- Compresses the backup directory into a multi-volume 7z archive with AES-256 encryption (including header encyrption)
- Sends email with debug log attached
Working hMailServer using either internal database or MySQL
If using SpamAssassin, must configure service for --allow-tell in order to feed spamc
OpenPhish update requires WGET in the system path
Create account at LetsUpload.io and create API keys
Fill in variables in hMailServerBackupConfig.ps1.dist and rename to hMailServerBackupConfig.ps1
Run hMailServerBackup.ps1 from task scheduler at 11:58 PM (time allows for properly cycling logs)