ClamAV Daemon
Instale todos os pacotes, clamav, clamav-server etc.
# yum install clamav*
Copie o arquivo e comente a linha: Example
# cp /usr/share/doc/clamav-server-0.95.3/clamd.conf /etc
# vi /etc/clamd.d/scan.conf
Edite o arquivo, comente a linha: Example e adicione as seguintes configurações:
LocalSocket /tmp/clamd.socket
User root
Inicie a daemom:
# service clamd.scan start
Coloque o clamav para inicialização automática no boot:
# chkconfig clamd.scan on
Mailwatch:
# yum install mysql
# yum install mysql-server
# yum install php-gd
# yum install php-mysql
# chkconfig mysqld on
# service mysqld start
# /usr/bin/mysqladmin -u root password 'sua-senha-aqui'
Baixe e descompacte o mailwatch:
# tar xvf mailwatch-1.0.5.tar
# mysql -p < create.sql
# mysql -p
mysql>
GRANT ALL ON mailscanner.* TO mailwatch@localhost IDENTIFIED BY 'mail';
mysql>
GRANT FILE ON *.* TO mailwatch@localhost IDENTIFIED BY 'mail';
mysql>
FLUSH PRIVILEGES;
mysql>
quit
Edite o arquivo MailWatch.pm e mude:
my($db_user) = 'mailwatch';
my($db_pass) = 'mail';
Copie o MailWatch.pm para /usr/lib/MailScanner/MailScanner/CustomFunctions/. Veja abaixo:
# cp MailWatch.pm /usr/lib/MailScanner/MailScanner/CustomFunctions/
# mysql mailscanner -u mailwatch -p
# INSERT INTO users VALUES ('admin',md5('sua-senha-aqui'),'admin','A','0','0','0','0','0');
# quit
Mova o diretório mailscanner para o root do httpd:
# mv mailscanner /var/www/html
# cd /var/www/html
# chown root:apache images
# chmod ug+rwx images
# chown root:apache images/cache
# chmod ug+rwx images/cache
# cp conf.php.example conf.php
No arquivo conf.php:
Ajuste a senha do mysql e usuário nos parâmetros DB_USER E DB_PASS.
Ajuste para True a opção QUARANTINE_USE_FLAG.
# mv /root/mailwatch-1.0.5 /opt/
# echo "/opt/mailwatch-1.0.5/tools/quarantine_maint.php --clean" > /etc/cron.daily/quarantine_maint.sh
# chmod +x /etc/cron.daily/quarantine_maint.sh
Modifique a primeira linha do script db_clean.php para:
#!/usr/bin/php -q
# cp /tools/db_clean.php /etc/cron.daily/
Ajuste o parâmetro Virus Scanner = clamavmodule no arquivo MailScanner.conf (use clamd para quando estiver usando a versão daemon do clamav conforme você instalou/configurou acima).
Ajuste esses parâmetros no arquivo MailScanner.conf.
Always Looked Up Last = &MailWatchLogging
Detailed Spam Report = yes
Quarantine Whole Message = yes
Quarantine Whole Message As Queue Files = no
Include Scores In SpamAssassin Report = yes
Quarantine User = root
Quarantine Group = apache (this should be the same group as your web server)
Quarantine Permissions = 0660
Detailed Spam Report = yes
Include Scores In SpamAssassin Report = yes
Always Include SpamAssassin Report = yes
Spam Actions = store header "X-Spam-Status: Yes" forward spamquarentena@meudominio.org.br
High Scoring Spam Actions = store header "X-Spam-Status: Yes" forward spamquarentena@meudominios.org.br
Verifique novamente as permissões do diretório /var/spool/MailScanner:
drwxr-xr-x 9 postfix postfix 4096 Ago 10 18:09 incoming
drwxr-xr-x 4 postfix apache 4096 Ago 10 18:08 quarantine
drwxr-xr-x 2 postfix postfix 4096 Jul 28 17:55 spamassassin
Integrando a Whitelist e Blacklist do Mailscanner com o MailWatch
Edite o arquivo: SQLBlackWhiteList.pm.
Configure os seguintes valores:
my($db_user) = '<username>';
my($db_pass) = '<password>';
# cp SQLBlackWhiteList.pm /usr/lib/MailScanner/MailScanner/CustomFunctions/
Edite o MailScanner.conf e configure os valores abaixo:
Is Definitely Not Spam = &SQLWhitelist
Is Definitely Spam = &SQLBlacklist