Configurar y usar fetchmail, PostFix, Procmail, Movemail (Thunderbird)
Como crear filtros para tus correos electronicos y saturar a los spammers al mismo tiempo.
Instalar los programas
sudo apt-get -u install fetchmail postfix procmail mailutils
Configurar postfix
sudo vi /etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = server.net
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = server.net, akuma, localhost, localhost.localdomain, localhost
relayhost = smtp.server.net:587
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
#smtp_use_tls = yes
#smtp_sasl_tls_security_options = noanonymous
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 prodigy.net.mx
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
header_checks = pcre:/etc/postfix/header_checks.pcre
sudo vi /etc/postfix/header_checks.pcre
/^From.*asistente@gestiontransporte.info*/ REJECT 5.1.0 - Unknown address error 550-'5.1.1
/^From.*noreply@cuponicamail.com*/ REJECT 5.1.0 - Unknown address error 550-'5.1.1
/^From.*regina.cortes@inversionfiscal.com*/ REJECT 5.1.0 - Unknown address error 550-'5.1.1
/^From.*contacto@organizacionfiscal.com*/ REJECT 5.1.0 - Unknown address error 550-'5.1.1
/^From.*n.tostado@riesgofiscal.com*/ REJECT 5.1.0 - Unknown address error 550-'5.1.1
/^From.*nformes@estrategiasdeutilidades.com*/ REJECT 5.1.0 - Unknown address error 550-'5.1.1
...
sudo vi /etc/postfix/sasl_passwd
smtp.server.net:587 user@server.net:password
sudo postmap /etc/postfix/sasl_passwd
Cambiar permisos y propietario
sudo chown ... ; sudo chmod ... (obvio ¿no?)
Reiniciar server
sudo /etc/init.d/postfix restart
Editar archivo de configuración de fetchmail
vi .fetchmailrc
# Configuration created Sun Sep 22 11:35:58 2013 by fetchmailconf 1.57
set postmaster "postmaster"
set bouncemail
set properties ""
poll pop.server.net via "pop.server.net"
with proto POP3 auth password and options no dns
localdomains server.net
user 'user' there with password 'password' is 'user' here options keep fetchall warnings 50000
antispam 571 550 501 554
sudo -u user fetchmail -v -d 53
Si, la idea es ejecutarlo con un usuario sin privilegios
Configurar procmail
sudo vi /etc/procmailrc
MAILDIR=/var/mail
LOGFILE=$MAILDIR/procmail.log
:0:
#* ^From user@gmail.com
anotheruser
Configurar hostname
sudo vi /etc/hosts
127.0.0.1 server.net
Este truco es para poder rechazar los correos y saturar a los spammers
Configurar hostname
Seguir las instrucciones de los links de abajo y agregar un filtro para que llegue a la cuenta de correo correcta y asi no usar el reply-to
Links:
http://www.gb.nrao.edu/pubcomputing/redhatELWS4/RH-DOCS/rhel-rg-es-4/s1-email-mta.html
http://www.gb.nrao.edu/pubcomputing/redhatELWS4/RH-DOCS/rhel-rg-es-4/s1-email-mda.html
Procmail
http://www.gb.nrao.edu/pubcomputing/redhatELWS4/RH-DOCS/rhel-rg-es-4/s1-email-mda.html
http://partmaps.org/era/procmail/mini-faq.html
http://www2.tiendalinux.com/docs/manuales/redhat/rhl-rg-es-7.3/s1-email-procmail.php3
Postfix:
http://www.linuxparatodos.net/web/comunidad/base-de-conocimiento/-/wiki/Base+de+Conocimiento/Instalaci%C3%B3n+y+Configuraci%C3%B3n+de+Postfix++en+Ubuntu
http://ortegaga.wordpress.com/2008/09/26/filtrar-emails-por-asunto-en-postfix/
http://www.telegeconsultora.com.ar/postfix/header_checks.htm
http://desdelaconsola.es/controles-de-acceso-en-postfix/
http://www.oxixares.com/~gbv/Notas_Postfix.html
http://www.servitux.org/view.php/page/postfix
http://tuxjm.net/2008/11/26/postfix_como_enviar_correo_a_traves_de_un_servidor_externo_usando_sasl_y_tls/
http://www.itbarna.com/enviar-correos-con-postfix-en-un-servidor-ubuntu
PCRE
http://www.pcre.org/pcre.txt
Movemail
http://askubuntu.com/questions/1916/how-can-i-access-system-mail-in-var-mail-via-thunderbird
http://forums.debian.net/viewtopic.php?f=5&t=8707
http://ubuntuforums.org/showthread.php?t=1718795
http://www.pantz.org/software/thunderbird/thunderbirdandmovemail.html
http://kb.mozillazine.org/Checking_for_new_messages_in_other_folders_%28Thunderbird%29