martes, 7 de septiembre de 2010

qmail greylisting

Muy potente herramienta para evitar el spam, los pasos para instalar son realmente muy simples. A continuación un resumen;

1. Bajar el software
mkdir /downloads/greylisting
cd /downloads/greylisting
wget http://oss.albawaba.com/files/cqgreylist-0.2.tar.gz

2. Descomprimir y dar permisos al directorio
tar xzf cqgreylist-0.2.tar.gz
cd cqgreylist-0.2
mkdir /var/qmail/cqgreylist
chown vpopmail /var/qmail/cqgreylist

3. Dos configuraciones sencillas en el archivo cqgreylist.c
vi cqgreylist.c
. . .
/*
* Change anything you want here
*/
/* RFC 2821 specifies the timeout for recieving a command to at least 5 mins */
#define TIMEOUT 300
/* specify the greylisting time in which to not accept mail from a sender */
#define GREY_SECONDS 60
char* hostname = "mail.servidorcorreo.com";
char* message = "Usted esta greylisted por favor vuelva a intentar";
char* base_directory = "/var/qmail/cqgreylist/";
/*
* End of user editable parameters
*/

4. Correr el programa y copiar el ejecutable
make
cp cqgreylist /var/qmail/bin/ /var/qmail/cqgreylist

5. Borrar archivos creados cada día:
crontab -e
. . .
23 * * * * /usr/bin/find /var/qmail/cqgreylist -mtime 1 -type f -exec rm -f {} \;

6. Configurar qmail para que se ejecute graylisting. El archivo de configuración debería quedar parecido a:
vi /var/qmail/supervise/qmail-smtpd/run
. . .
exec /usr/local/bin/softlimit -m 40000000 \
/usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
rblsmtpd \
-r sbl.spamhaus.org \
-r zen.spamhaus.org \
-r bl.spamcop.net \
-r list.dsbl.org \
/var/qmail/bin/cqgreylist \
/var/qmail/bin/qmail-smtpd mail.servidorcorreo.com \
/home/vpopmail/bin/vchkpw /usr/bin/true 2>&1
. . .

1 comentario:

  1. excelente artículo, sobretodo la parte de las configuraciones, tenia algunos problemas con ese detalle. Espero que ahora ya me funcione correctamente.

    saludos.

    ResponderEliminar