Solução completa com o sendmail (segunda edição)
Quase 2 anos após ter escrito a primeira versão deste artigo, chegou a hora de rescrevê-lo com informações adicionais e atualizadas. Dentre seus recursos podemos citar o suporte a SMTP TLS e POP SSL (criptografado), antivírus, antiSPAM, autenticação SMTP e sistema de quota de usuário.
Parte 4: SpamAssassin
Adquirindo e instalando os pacotes (spamassassin-3.1.0-i486-1mjg.tgz ,spamassassin-extra-3.0.0-i486-3aru.tgz, spamassassin-nonreq-3.0.0-i486-3aru.tgz):
# cd /pkg
# wget http://opensys.linuxpackages.net/Slackware-10.2/Daemon/\
spamassassin/spamassassin-3.1.0-i486-1mjg.tgz
# wget http://opensys.linuxpackages.net/Slackware-10.2/\
Library/spamassassin-extra/spamassassin-extra-3.0.0-i486-3aru.tgz
# wget http://opensys.linuxpackages.net/Slackware-10.2/Library/\
spamassassin-nonreq/spamassassin-nonreq-3.0.0-i486-3aru.tgz
# installpkg spamassassin-*
O SpamAssassin necessita do procmail para funcionar, então devemos criar o arquivo /etc/procmailrc ou se o arquivo já existir, adicionar no topo do arquivo o seguinte conteúdo:
# cd /pkg
# wget http://opensys.linuxpackages.net/Slackware-10.2/Daemon/\
spamassassin/spamassassin-3.1.0-i486-1mjg.tgz
# wget http://opensys.linuxpackages.net/Slackware-10.2/\
Library/spamassassin-extra/spamassassin-extra-3.0.0-i486-3aru.tgz
# wget http://opensys.linuxpackages.net/Slackware-10.2/Library/\
spamassassin-nonreq/spamassassin-nonreq-3.0.0-i486-3aru.tgz
# installpkg spamassassin-*
O SpamAssassin necessita do procmail para funcionar, então devemos criar o arquivo /etc/procmailrc ou se o arquivo já existir, adicionar no topo do arquivo o seguinte conteúdo:
# SpamAssassin sample procmailrc
#
# Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc'
# if you use the spamc/spamd combination)
#
# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.
#
# The lock file ensures that only 1 spamassassin invocation happens
# at 1 time, to keep the load down.
#
:0fw: spamassassin.lock
* < 256000
| spamassassin
# Mails with a score of 15 or higher are almost certainly spam (with 0.05%
# false positives according to rules/STATISTICS.txt). Let's put them in a
# different mbox. (This one is optional.)
:0:
* ^X-Spam-Level: ***************
almost-certainly-spam
# All mail tagged as spam (eg. with a score higher than the set threshold)
# is moved to "probably-spam".
:0:
* ^X-Spam-Status: Yes
probably-spam
# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped. This will re-add it.
:0
* ^^rom[ ]
{
LOG="*** Dropped F off From_ header! Fixing up. "
:0 fhw
| sed -e '1s/^/F/'
}
#
# Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc'
# if you use the spamc/spamd combination)
#
# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.
#
# The lock file ensures that only 1 spamassassin invocation happens
# at 1 time, to keep the load down.
#
:0fw: spamassassin.lock
* < 256000
| spamassassin
# Mails with a score of 15 or higher are almost certainly spam (with 0.05%
# false positives according to rules/STATISTICS.txt). Let's put them in a
# different mbox. (This one is optional.)
:0:
* ^X-Spam-Level: ***************
almost-certainly-spam
# All mail tagged as spam (eg. with a score higher than the set threshold)
# is moved to "probably-spam".
:0:
* ^X-Spam-Status: Yes
probably-spam
# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped. This will re-add it.
:0
* ^^rom[ ]
{
LOG="*** Dropped F off From_ header! Fixing up. "
:0 fhw
| sed -e '1s/^/F/'
}
Removendo arquivo de inicialização desnecessário, se tiver:
# rm -r /etc/rc.d/rc.spamd
Criando o arquivo /etc/rc.d/rc.spamd:
#!/bin/sh
#
# spamd
#
case "$1" in
start)
# Start daemons.
echo -n "Starting spamd: "
spamd -c -d --nouser-config -u mail
echo "done"
;;
stop)
# Stop daemons.
echo -n "Shutting down spamd: "
killall spamd
echo "done"
;;
esac
#
# spamd
#
case "$1" in
start)
# Start daemons.
echo -n "Starting spamd: "
spamd -c -d --nouser-config -u mail
echo "done"
;;
stop)
# Stop daemons.
echo -n "Shutting down spamd: "
killall spamd
echo "done"
;;
esac
Dando permissão no arquivo /etc/rc.d/rc.spamd:
# chmod +x /etc/rc.d/rc.spamd
Iniciando o SpamAssassin:
# spamd -c -d --nouser-config -u mail
O seguinte erro pode acontecer caso você tenha atualizado a sua versão do perl.
-bash: /usr/bin/spamd: /usr/bin/perl5.8.7: bad interpreter: No such file or directory
Dê o seguinte comando caso o erro acima ocorra e inicie novamente o spamassassin:
# ln -s /usr/bin/perl /usr/bin/perl5.8.7
Os arquivos para ativação de quota no slackware mudaram!
# touch /aquota.user
# touch /aquota.group
# chmod 600 /aquota.user
# chmod 600 /aquota.group