Ubuntu als Mailserver

Quick and Dirty Postfix-Mailserver mit Plain SMTP-Auth:

# vi /etc/apt/sources.list

deb http://de.archive.ubuntu.com/ubuntu/ dapper universe
deb-src http://de.archive.ubuntu.com/ubuntu/ dapper universe

deb http://security.ubuntu.com/ubuntu dapper-security universe
deb-src http://security.ubuntu.com/ubuntu dapper-security universe
# apt-get install libsasl2 sasl2-bin libsasl2-modules courier-imap courier-pop postgrey postfix mailx

# vi /etc/default/saslauthd

START=yes
PARAMS=”-m /var/spool/postfix/var/run/saslauthd -r”

# mkdir -p /var/spool/postfix/var/run/saslauthd

# vi /etc/postfix/sasl/smtpd.conf

log_level: 2
saslauthd_path: /var/run/saslauthd/mux
pwcheck_method: saslauthd
mech_list: plain login

# touch /etc/postfix/virtual
# touch /etc/postfix/transport
# touch /etc/postfix/canonical
# vi /bin/newmaps

#!/bin/sh
postmap hash:/etc/postfix/virtual
postmap hash:/etc/postfix/canonical
postmap hash:/etc/postfix/transport
/etc/init.d/postfix reload

# chmod +x /bin/newmaps

# vi /etc/postfix/main.cf

virtual_maps = hash:/etc/postfix/virtual
transport_maps = hash:/etc/postfix/transport
canonical_maps = hash:/etc/postfix/canonical

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination reject_unknown_sender_domain reject_unknown_recipient_domain reject_non_fqdn_hostname reject_non_fqdn_sender reject_non_fqdn_recipient check_policy_service inet:127.0.0.1:60000

home_mailbox = Maildir/

# /etc/init.d/postfix restart

SysCP, Postfix und MySQL

Sollte der Postfix meckern:

Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’

editiere man die /etc/mysql/debian-start

echo “Linking mysqld.sock to the postfix-jail.”
if [ -x /var/spool/postfix/var/run/mysqld/mysqld.sock ] ; then
rm /var/spool/postfix/var/run/mysqld/mysqld.sock
fi
ln /var/run/mysqld/mysqld.sock /var/spool/postfix/var/run/mysqld/mysqld.sock

Ubuntu-Server und sphinxsearch

Wird ein deb-Paket des Ubuntu MySQL Servers mit Unterstützung der SPHINX Engine benötigt geht das so:

# cd /usr/src
# wget http://www.sphinxsearch.com/downloads/sphinx-0.9.7-rc2.tar.gz
# tar xvzf sphinx-0.9.7-rc2.tar.gz
# apt-get install libtool debhelper libncurses5-dev libwrap0-dev zlib1g-dev libreadline-dev chrpath automake1.8 automake1.9 doxygen dpatch procps file perl psmisc po-debconf tetex-bin tetex-base tetex-extra gs gawk bison build-essential
# apt-get source mysql-server
# cd /usr/src/mysql-dfsg-5.0-5.0.24a/
# patch -p1 < ../sphinx-0.9.7-rc2/mysqlse/sphinx.5.0.22.diff # vi sql/set_var.cc *** unter csv *** {”have_sphinx”, (char*) &have_sphinx_db, SHOW_HAVE}, # cp -ar ../sphinx-0.9.7-rc2/mysqlse/ sql/sphinx # vi debian/rules *** unter –with-innodb *** –with-sphinx-storage-engine \ # dpkg-buildpackage

Blacklist an Postfix

Hierzu sind unter smtpd_recipient_restrictions z.B. folgende Einträge in der /etc/postfix/main.cf von nöten:

reject_rbl_client bl.spamcop.net
reject_rbl_client dnsbl.sorbs.net

Greylisting mit Postfix

Eine äusserst wirksame Methode um das Mailmüllaufkommen zu reduzieren, mit Postfix unter Debian:

# apt-get install postgrey

Nun in /etc/postfix/main.cf zu smtpd_recipient_restrictions:

check_policy_service inet:127.0.0.1:60000

# /etc/init.d/postfix reload

Gute Unterhaltung!