Assume that the mail server is configured using the ISPConfig hosting control panel according to the instructions: Configure Postfix mail server in Debian for ISPConfig 3 - part 7
Archiving option 1:
This method is often used by the security service of the organization, or the head to monitor the work of employees.
Set up archiving of all emails, both incoming and outgoing, for this we add to the configuration file. /etc/postfix/main.cf parameter with a box for collecting letters:
echo 'always_bcc = [email protected]' >> /etc/postfix/main.cf
wherein [email protected] A mailbox to collect all the letters.
Reboot the Postfix mail server to apply changes by executing the command:
/etc/init.d/postfix restart
We try to send, receive mail, then check the mailbox to collect mail, make sure that the letters are copied into it.
Archiving option 2:
Archiving all boxes using the program rsync:
Create a folder to store the mail archive, add a command to synchronize mail in the folder:
mkdir -p /home/backup/mail/ crontab -e 10 2 * * * rsync -a --delete-after /var/vmail/ /home/backup/mail/
After that, the archive of all letters will be made every night at 2:10.
Recovery of mail messages from the archive Option 1:
Suppose that the mailbox [email protected] was accidentally deleted in the ISPConfig3 panel when the mailbox is removed and all emails are deleted. If there is no backup email that can be done using the program rsync posture Option 2, We can recover letters from the mailbox to collect mail.
Make sure that the remote box is not on the server, then re-create the mailbox [email protected] In the ISPConfig 3 panel.
To recover letters, go to the mailbox folder [email protected] And then I did the command.
cd /var/vmail/domen.ru/archive/
Next, search for all emails with content Return-Path: <[email protected] and copy the found files to a clean box folder:
find Maildir/cur/ -type f -exec grep -ilR 'Return-Path: <[email protected]>' {} \; | xargs -I % cp % /var/vmail/domen.ru/marketing/Maildir/cur/
On this team. We search Maildir/cur/ in all Files for Return-Path content: <[email protected]> and we copy the found into a folder /var/vmail/domen.ru/marketing/Maildir/cur/
After searching and copying messages, change the rights of email files by executing the command:
chown -R vmail:vmail /var/vmail/domen.ru/marketing/Maildir/cur/
Recovery of mail messages from the archive optionally 2:
rsync -a --delete-after /home/backup/mail/ /var/vmail/
Or you can simply copy files from the archive to the mail folder with your hands using the file manager. mc team cp.
In this article, we have considered 2 types of mail archiving, as well as the recovery of a separate box or all letters from the archive.
I was with you. Sergey Lazarenko.
Let’s take a short break and watch an interesting video about how to hide from the thermal imager:



comment