A- A A+

Sendmail con Google Apps

tag  sendmail  google  mta  smarthost 

10/01/2012

Ecco come configurare sendmail

Vi proponiamo questa breve guida su come configurare Sendmail con Google Apps, su server Debian.

Prima di tutto verifichiamo che l'installazione di sendmail comprenda i moduli TLS (encryption) e SASL (authentication). Per fare questo lanciamo da console il comando

/usr/sbin/sendmail -d0.1 -bv root

Se sendamail non è ancora installato invece eseguite per procedere con l'installazione:

install sendmail sendmail-cf m4

Installiamo quindi cyrus-sasl:

$wget http://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-2.1.21.tar.gz
tar -xzf cyrus-sasl-2.1.21.tar.gz
cd cyrus-sasl-2.1.21
./configure --disable-digest CFLAGS=-DOPENSSL_DISABLE_OLD_DES_SUPPORT
cp mac/libdes/public/des.h .
make
make install

mv /usr/lib/sasl2 /usr/lib/sasl2.orig
ln -s /usr/local/lib/sasl2 /usr/lib/sasl2

Procediamo con la creazione dei certificati:

mkdir /etc/mail/certs
cd certs
openssl req -new -x509 -keyout cakey.pem -out cacert.pem -days 3650 
openssl req -nodes -new -x509 -keyout sendmail.pem -out sendmail.pem -days 3650

A questo punto lanciare questi comandi

cd /etc/mail
hostname -f > genericsdomain
touch genericstable
makemap -r hash genericstable.db < genericstable
mv sendmail.mc sendmail.mc.original
wget http://pbxinaflash.net/source/sendmail/sendmail.mc.gmail
# If the above file is no longer available I've uploaded a mirror here
# wget http://network-13.com/sendmail.mc.gmail
cp sendmail.mc.gmail sendmail.mc

Editare sendmail.mc come segue:

nano sendmail.mc
-include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
+include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
+define(`CERT_DIR', `/etc/mail/certs')
+define(`confSERVER_CERT', `CERT_DIR/sendmail.pem')
+define(`confSERVER_KEY', `CERT_DIR/sendmail.pem')
+define(`confCLIENT_CERT', `CERT_DIR/sendmail.pem')
+define(`confCLIENT_KEY', `CERT_DIR/sendmail.pem')

+define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')

+MASQUERADE_AS(`li190-119.members.linode.com')dnl
-MASQUERADE_AS(`dyndns.org')dnl

+dnl MASQUERADE_DOMAIN(li190-119.members.linode.com)dnl
-dnl MASQUERADE_DOMAIN(dyndns.org)dnl

Lanciamo poi:

m4 sendmail.mc > sendmail.cf

Procediamo poi la modifica del file client-info:

mkdir -p auth
chmod 700 auth
cd auth
nano client-info
AuthInfo:smtp.gmail.com "U:smmsp" "I:user_id" "P:password" "M:PLAIN"
AuthInfo:smtp.gmail.com:587 "U:smmsp" "I:user_id" "P:password" "M:PLAIN"
# Replace  user_id with your gmail username without @gmail.com
# If you're using google apps then enter your full email address user@yourdomain.com
# Replace password with your own gmail/google apps password
# Save your changes (Ctrl-X, Y, then Enter)
chmod 600 client-info
makemap -r hash client-info.db < client-info
cd ..
make

Commenti







I commenti somo moderati dall'amministratore del sito, l'email non sara' visibile sul sito.