msgbartop
Blog di Dino Ciuffetti (Bernardino in realtà)
msgbarbottom

12 Dic 11 How to quickly install courier-mta mail server from source on debian (for the impatients)

What it follows is a quick n’ dirty but working list of things to do to correctly install you brand new courier mta mail server from source on a linux debian system (or ubuntu). This is for the impatients that don’t want to read the courier installation manual page (http://www.courier-mta.org/install.html). You can download the last stable courier packages from here: http://www.courier-mta.org/download.php.
You only have to download those three software archive files:

  1. Courier
  2. Courier authentication library
  3. Courier unicode library

You’ll need to be root and have an internet connection to install dependencies debian packages.
First of all you have to enable the EN_US-utf8 locale, or “make check” will fail. You can do it with:

dpkg-reconfigure locales

Ready to install? Ok. This is how I have done:

groupadd courier
useradd -m -g courier courier
groupadd vmail
useradd -g vmail -d /opt/courier -m vmail

apt-get install build-essential
apt-get install libldap2-dev
apt-get install ldap-utils
apt-get install slapd
apt-get install libmysqlclient-dev
apt-get install libpcre++-dev libpcre3-dev
apt-get install libidn11-dev
apt-get install libgdbm-dev
apt-get install libdb-dev
apt-get install libgamin-dev
apt-get install libssl-dev
apt-get install libgnutls28-dev
apt-get install expect
apt-get install libperl-dev
apt-get install libltdl-dev
apt-get install libsqlite3-dev

tar jxvf courier-unicode-x.x.tar.bz2
cd courier-unicode-x.x

./configure –prefix=/opt/courier/unicode

make
make install

cd ..

tar jxvf courier-authlib-0.xx.0.tar.bz2
cd courier-authlib-0.xx.0

export CFLAGS=”-I/opt/courier/unicode/include”
export LDFLAGS=”-L/opt/courier/unicode/lib”

./configure \
–prefix=/opt/courier/authlib \
–without-authvchkpw \
–without-authpgsql \
–with-mysql-libs=/usr \
–with-mysql-includes=/usr \
–with-mailuser=vmail \
–with-mailgroup=vmail

make
make install

cd ..

tar jxvf courier-0.xx.0.tar.bz2
chown -R courier:courier courier-0..0

su – courier
cd courier-0.xx.0

export COURIERAUTHCONFIG=/opt/courier/authlib/bin/courierauthconfig
export CFLAGS=”-I/opt/courier/authlib/include -I/opt/courier/unicode/include”
export CPPFLAGS=”-I/opt/courier/authlib/include -I/opt/courier/unicode/include”
export LDFLAGS=”-L/opt/courier/authlib/lib -L/opt/courier/unicode/lib”

./configure \
–prefix=/opt/courier –with-locking-method=fcntl –without-explicitsync \
–with-qdircount=20 –with-random=/dev/urandom \
–without-ispell –disable-autorenamesent –enable-mimetypes

make
make check
exit
make install-strip
make install-configure >upgrade.log

/opt/courier/sbin/showmodules
/opt/courier/sbin/makesmtpaccess

OK. If everything gone OK, the installation stuff was terminated.
The configuration stuff is another complex thing that I cannot cover now here… may be another time.
Now, continue to read installation manual from here: http://www.courier-mta.org/install.html#aliases

This procedure was last tested with courier 0.75.0 on debian 8.4, but should be OK with newer versions too.
The software will be installed in /opt/courier.

I hope that it will help someone.
Ciao, Dino.

21 Feb 10 Scandalo, the fast and Simple clamdscan mail frontend

Hi people.
I’m now talking about a simple GPLv2, C written, small program that work as a very fast clamdscan antivirus frontend.

Scandalo can take a mail on standard input and parse it from viruses, piping it to clamdscan.
It then get the virus status from clamdscan and put a mail header called “X-Virus-Ret” returning the virus scanner status.
It also put a mail header called “X-Virus-stream” returning the first virus name found (if any).

You can then setup a rule on your (say, maildrop) mail filter to pipe the incoming mail to scandalo, and another rule to check the return scanned mail header for viruses.
If a virus was found, you can drop the mail, or put it into a .Virus maildir.

If you have any question, I’m the developer of scandalo.
Scandalo – http://www.tuxweb.it/?section=progetti/scandalo&

Write me a note at dino@tuxweb.it.

Ciao, Dino.

29 Gen 10 Per un buon mailserver

Chiunque ha, o abbia provato ad avere un proprio mailserver per spedire mail in uscita ha potuto costatare personalmente che moltissimi mailserver dall’altra parte del filo hanno dei sistemi di blacklist per cercare di combattere lo spam, e che presto o tardi finiscono con il bloccare temporaneamente il nostro IP, o peggio mandare le nostre mail nella cartella Spam del destinatario.

Sebbene non esista un capitolato standard, dopo qualche anno di combattimento con le mail ho potuto stilare una serie di buone regole per cercare di attenuare la problematica.

Io utilizzo da anni Courier MTA (http://www.courier-mta.org/) e mi trovo veramente bene, ad ogni modo le seguenti regole valgono per qualsiasi mailserver.

Attenendosi alle seguenti regole, sara’ possibile inviare tante mail senza troppi problemi.

1) utilizza NECESSARIAMENTE un IP statico per inviare le mail
2) crea un Reverse PTR record sul DNS per il tuo IP e chiamalo mail.tuodominio.it
3) crea un A record chiamato mail.tuodominio.it sul DNS che punta all’IP
4) crea un MX record per accettare le mail in ingresso/ritorno e fallo puntare a mail.tuodominio.it
5) crea sul DNS il TXT record per il Sender Policy Framework e crea regole che abilitano a spedire posta dal tuo dominio solo dall’IP del mailserver
6) fai utilizzare al tuo MTA una connessione di rete stabile, e soprattutto un DNS stabile e veloce!!
7) crea sul server SMTP un account postmaster@tuodominio.it
8) disabilita il relaying per il tuo mailserver. Se lo devi abilitare, crea degli utenti abilitati al relaying con password robuste e abilita SSL sul server SMTP
9) fai uscire dall’IP del tuo MTA solo le mail originate dal tuo mailserver. Se ad esempio c’e’ un Firewall che fa source NAT in uscita, fai in modo di aprire la porta di destinazione 25 sul firewall verso internet solo ai pacchetti provenienti dal mailserver. Se hai nella tua rete altri client SMTP che creano mail in uscita spegnili, o falli passare necessariamente in relaying per il tuo MTA
10) utilizza se possibile accorgimenti atti a sopprimere i Delivery Status Notification per le mail in ingresso, come ad esempio ritornare errore subito durante la ricezione della mail se un utente non siste o la mail viene bloccata
11) utilizza un sistema antispam come spamassassin e abilita le blacklist IP basate su DNS per tutte le mail in ingresso
12) imposta il tuo “Helo” message sul mailserver affinche’ si esponga sempre come “mail.tuodominio.it”
13) se possibile, per le mail in relaying, configura il tuo mailserver per strippare i “Delivered to” headers. In questo modo gli altri mailserver crederanno che la mail in relaying e’ stata generata dal tuo mailserver.
14) se possibile, quando spedisci le mail, utilizza sempre come mittente un account esistente che corrisponda ad un dominio gestito dal tuo mailserver
15) evita se possibile account non esistenti del tipo “no-replay@tuodominio.it”. Nel caso ti servisse, crea l’account e scarta tutte le mail in ingresso buttandole in “/dev/null”

Queste regole sono secondo me un buon modo per evitare di finire velocemente nelle miliardi di blacklist in giro per il mondo.

Mi raccomando, scrivetemi a dino@tuxweb.it e fatemi sapere se funziona, o mandatemi i vostri suggerimenti con altre regole e io le integrero’.

Ciao, Dino.