Prerequisite
- Installed MailScanner
Resolving MailScanner Dependencies
- Run the following cpan commands one at a time (i.e. to see if they are successfully installed):
sudo cpan -i Filesys::Df
sudo cpan -i IO::Stringy
sudo cpan -i DBI
sudo cpan -i Net::CID
sudo cpan -i Sys::SigAction
sudo cpan -i MIME::Parser
sudo cpan -i Archive::Zip
sudo cpan -i OLE::Storage_Lite
sudo cpan -i DBD::SQLite
- Install the following packages:
sudo apt-get install unrar sudo apt-get install sqlite
Installing Clamav Antivirus
Run the following command:
sudo apt-get install clamav clamav-daemon
Integrating Clamav to MailScanner
- Update the /etc/MailScanner/MailScanner.conf to have the fields Virus Scanner and Clamd Socket to become as follows:
Virus Scanner = clamd Clamd Socket = /var/run/clamav/clamd.ctl
- Restart the mailscanner service with the following command:
sudo service mailscanner restart
- Update the file /etc/apparmor.d/usr.sbin.clamd to have the following entries:
/var/spool/MailScanner/** rw, /var/spool/MailScanner/incoming/** rw,
- Restart the apparmor service with the following command:
sudo systemctl restart apparmor.service
Installing and Updating Spamassassin
Run the following commands:
sudo apt-get install spamassassin sudo sa-update sudo service spamassassin start
Integrating MailScanner to Postfix
- Open the file /etc/postfix/main.cf for editing and add the following line and save:
header_checks = regexp:/etc/postfix/header_checks
- Create the file /etc/postfix/header_checks with the following:
/^Received:/ HOLD
- Open the file /etc/MailScanner/MailScanner.conf for editing and update with the following if necessary:
Run As User = postfix Run As Group = postfix Incoming Queue Dir = /var/spool/postfix/hold Outgoing Queue Dir = /var/spool/postfix/incoming MTA = postfix
- Open the file /etc/MailScanner/defaults for editing and update with the following if necessary:
run_mailscanner=1
- Update the group of /var/spool/MailScanner to mtagroup and allow the it write permission as follows:
sudo chown :mtagroup /var/spool/MailScanner sudo chmod 775 MailScanner
- Prepare spamassassin's directory using the following commands:
sudo mkdir /var/spool/MailScanner/spamassassin sudo chown postfix /var/spool/MailScanner/spamassassin
- Update the permission of the MailScanner's incoming and quarantine folders with the following commands:
sudo chown postfix.mtagroup /var/spool/MailScanner/incoming sudo chmod 770 /var/spool/MailScanner/incoming sudo chown postfix.mtagroup /var/spool/MailScanner/quarantine
- Restart the mailscanner service with the following command:
sudo service mailscanner restart
Related Post
Configuring Email Server with Postfix and Dovecot:
Recent Comments