Академический Документы
Профессиональный Документы
Культура Документы
I have recently installed Postfix on a server following WorkAround.org ISPMail Tutorial on Debian
Wheezy Linux 7. Officially as you can see on their website there is no official guide still for Debian
Wheezy yet. Therefore my only option was to follow ISPMail tutorial using Postfix 2.7 (Debian
Squeeze).
It was quite a struggle to adapt tutorial for Squeeze deb to Wheezy and it took me an overall time of
about of week (each day spending few hours trying to make various components of tutorial) work. But
finally I managed to install it. This is how this article got born in hope that in future it will help others
have a decent Postfix install on Wheezy..
For those unfamiliar with Workaround.org's ISPMail Postfix Tutorial it is pretty much standard step-bystep installation guide for dummies similar to QmailRocks.org or Thibs QmailRocks Updated
Installation Guide.
In Other words Workaround.org is probably the best Postfix full featured install tutorial currently
online as of time of writting this post. Workaround.org is great for people who want to run full
featured;
1 / 12
So here we go:
a) Install Postfix / MySQL / phpmyadmin and Postfix support for MySQL mail storage deb packs
2 / 12
apt-get update
apt-get upgrade
apt-get install --yes mysql-client mysql-server dovecot-common dovecot-imapd dovecot-pop3d postfix libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl telnet mailutils
b) Install deb packages for Dovecot and Imap Support as well as Roundcube and / or Squirrelmail for
Webmail support
squirrelmail
apt-get install --yes dovecot-pop3d dovecot-imapd dovecot-lmtpd
3 / 12
Next step is toconnect to MySQL as root via MySQL CLI or PhpMyadmin and CREATE new user
"mailuser" and new database "mailserver", then create basic structure for "mailserver" database - i.e. sql
tables ("virtual_domains", virtual_users", virtual_aliases")
These user and database is used laters by Dovecot server to connect and fetch emails from MySQL on
user request via POP3 or IMAP. I've taken all the SQL requests and from Workaround.org's site and
placed them in one SQL file:
create-postfix-mysql-user-database.sql.
Below is mysql cli query to import it. If you prefer more user friendliness do it via PhpMyAdmin with a
copy / paste from file or with PhpMyAdmin import ...
wget -q http://www.pc-freak.net/files/postfix/create-postfix-mysql-user-database.sql
mysql -u root -p
4 / 12
Next its necessary configure some users and create directories where Dovecot will store its configuration files. Dovecot requires to create its custom files for each existing users in MySQL database. Therefore whenever user receives or sends e-mail or is simply created Dovecot also creates a user
# ls -al /var/vmail/mail-domain.org/test/mail/
total 20
5 / 12
Allow mail users to fetch emails using POP3 or IMAP protocol with Outlook / Thunderbird whatever pop3 client
4. Create self-signed SSL certificate for Postfix mail and Dovecot pop3 server
6 / 12
openssl req -new -x509 -days 3650 -nodes -out /etc/ssl/certs/dovecot.pem -keyout /etc/ssl/private/dovecot.pem
chmod o= /etc/ssl/private/dovecot.pem
/etc/init.d/dovecot restart
openssl req -new -x509 -days 3650 -nodes -out /etc/ssl/certs/postfix.pem -keyout /etc/ssl/private/postfix.pem
chmod o= /etc/ssl/private/postfix.pem
To reduce viruses it is a must nowadays to install Antivirus in Qmail I used qmail-scanner (perl script) frontend to Clamav Antivirus to check for Viruses and some messed up e-mails. In Postfix just like in Sendmail, tool that does the same is amavisd-new. There are some configuration files to do,
but as its time consuming to do changes one by one I prefer moving old /etc/amavis/ to /etc/amavis-bak/ and download and untar archive with already set proper configs
mv /etc/amavis /etc/amavis-old
7 / 12
wget http://www.pc-freak.net/files/postfix/amavis-config-debian-wheezy-7.tar.gz
...
.....
/etc/init.d/amavis start
Amavisd is meant to communicate in two port numbers with Postfix. Postfix passes Input in one (10024) and Output - Scanned File Status in (10025). Thus for normal amavis operation this two ports has to be showing as listening on localhost, e.g.:
tcp
0 127.0.0.1:10024
0.0.0.0:*
LISTEN
13957/amavisd-new (
tcp
0 127.0.0.1:10025
0.0.0.0:*
LISTEN
9007/master
6. Placing Dovecot working (properly configured) config files for Debian Wheezy
8 / 12
mv /etc/postfix /etc/postfix-old
cd /etc/
wget -q http://www.pc-freak.net/files/postfix/postfix-configs-debian-wheezy.tar.gz
... .....
9 / 12
myhostname = example-mail.org
myhostname = pc-freak.net
I find it also useful to remove from SMTP after connect banner reporting that Postfix is running on Debian in main.cf change:
to
10 / 12
Configuring Dovecot is not an easy task in Debian Linux Squeeze and Lenny, on Postfix ISPMail guide there is a special tutorial for each as there is none yet for Debian Wheezy. It took me long to figure it out how to translate from old config settings for Wheezy's Dovecot 2.1.7-7. Configuration files
places has changed for some clarity in Dovecot 2.1.7-7. So many of the Workaround.rog's Squeeze Tutorial suggested changes in /etc/dovecot/dovecot.conf are to be made in files under /etc/dovecot/conf.d
Therefore quickest way to have working Dovecot is to move default config dir /etc/dovecot to /etc/dovecot-old and place tuned configs:
cd /etc/
wget -q http://www.pc-freak.net/files/postfix/dovecot-configs-debian-wheezy.tar.gz
...
....
/etc/init.d/dovecot restart
quit
Connection closed.
11 / 12
Well this is the end my friend :) You should now have a properly running Postfix + Dovecot + Virtual Domains
in SQL. Please drop me a thank you comment if it worked for you. If it doesn't drop a comment so I can integrate
it and improve this tutorial. Happy Hacking ;)
12 / 12
Powered by TCPDF (www.tcpdf.org)