Académique Documents
Professionnel Documents
Culture Documents
Virtualization Poll
V irtual U s ers A nd
D omains With
P os tfix, C ourier
A nd M ySQ L
(Fedora 8 ) (9 9 0 .6
M B) (1 1 /1 5
/2 0 0 7 )
V M ware I mage
I mport G uide
L is t of all V M ware
I mages
Free Support
P aid Support
Navigation
H owtos
L inux
C entO S
D ebian
Fedora
Kernel
M andriva
P C LinuxO S
SuSE
U buntu
A pac he
Bac kup
C ontrol P anels
1 of 12 11/30/09 12:06
Virtual Users And Domains With Postfix, Courier A... http://www.howtoforge.com/virtual-users-and-domai...
DNS
D es ktop
E mail
A nti-Spam/V irus
P os tfix
P roc mail
Sendmail
FT P
H igh-A vailability
L ighttpd
M onitoring
M ySQ L
P rogramming
C /C ++
P HP
Samba
Sec urity
A nti-Spam/V irus
V irtualization
O ther
FreeBSD
C ommerc ial
M ini-H owtos
Forums
C ontribute
Subs c ription
L ogin
Site M ap/RSS Feeds
User login
U s ername:
P as s word:
Remember M e?
Ads by Google
Free Domains
Linux OS
Install Linux
Good Domains
Who's online
T here are c urrently 9 us ers and 2 7 6 3 gues ts online.
2 of 12 11/30/09 12:06
Virtual Users And Domains With Postfix, Courier A... http://www.howtoforge.com/virtual-users-and-domai...
HowtoForge Forums
Sell C vv G ood and
fres h, pleas e
purc has e my :X
s ell C vv G ood and
fres h, pleas e
purc has e my :X
how to run
inotifywait
bac kground
Res tarting O penBSD
Sec ure Shell
s erver s s hd
L inux ldap bind
windows ad
L dap from windows
to linux
pos tfix/s quirrelma
il with plugin ...
G odaddy and
N ames ervers
H ow to Run a V ideo
at the s tart
unattended?
L oc al T es ting
Server Setup
News
D is tro Review: O penSU SE 1 1 .2
KD E C ommunity Forums A nnounc e the C ontinuation of Klas s room
D RM C hange C ontinues T o C aus e D ebate
T he P erfec t D es ktop - Fedora 1 2 i6 8 6 (G N O M E )
Stream mus ic wireles s ely us ing P uls eA udio s erver
M us ic A lbum C overs A nd P ic ture P reviews A s Folder T humbnails I n N autilus
L inux M int 8 final releas ed
Finding files and doc uments with Rec oll
When O pen Sourc e M eets C los ed M inds
Strange I deas A bout Freedom of Speec h
more
Recent comments
boot problem after ins tall php5 pakage
1 4 hours 5 3 min ago
T hanks man
1 5 hours 1 0 s ec ago
s quiremail not working
1 5 hours 2 5 min ago
3 of 12 11/30/09 12:06
Virtual Users And Domains With Postfix, Courier A... http://www.howtoforge.com/virtual-users-and-domai...
Newsletter
Subscribe to
HowtoForge
Newsletter
and s tay informed
about our lates t
H O WT O s and
projec ts .
enter email address
Syndicate
You are here: Home » Howtos » Linux » Fedora » Virtual Users And Domains With Postfix, Courier And MySQL (Fedora 8)
Virtual Users And Domains With Postfix, Courier And MySQL (Fedora 8)
4 of 12 11/30/09 12:06
Virtual Users And Domains With Postfix, Courier A... http://www.howtoforge.com/virtual-users-and-domai...
OsiriX PRO
with FDA-cle a ra nce a nd suppo rt
R SNA No rth Building #8903
w w w .aycan.com
PostgreSQL Solutions
P o stgre SQ L T ra ining, Suppo rt
R e plica tio n, High-Ava ila bility
w w w .postgresql-support.de
5 of 12 11/30/09 12:06
Virtual Users And Domains With Postfix, Courier A... http://www.howtoforge.com/virtual-users-and-domai...
This tutorial is Copyright (c) 2007 by Falko Timme. I t is derived from a tutorial from Chris toph Haas which
you can find at http://workaround.org. You are free to us e this tutorial under the Creative Commons licens e
2.5 or any later vers ion.
T his doc ument des c ribes how to ins tall a mail s erver bas ed on P os tfix that is bas ed on virtual us ers
and domains , i.e. us ers and domains that are in a M ySQ L databas e. I 'll als o demons trate the
ins tallation and c onfiguration of C ourier (C ourier-P O P 3 , C ourier- I M A P ), s o that C ourier c an
authentic ate agains t the s ame M ySQ L databas e P os tfix us es .
T he res ulting P os tfix s erver is c apable of SMTP-A UTH and TLS and quot a (quota is not built into
P os tfix by default, I 'll s how how to patc h your P os tfix appropriately). P as s words are s tored in
encrypt ed form in the databas e (mos t doc uments I found were dealing with plain text pas s words
whic h is a s ec urity ris k). I n addition to that, this tutorial c overs the ins tallation of A mavisd,
SpamA ssassin and ClamA V s o that emails will be s c anned for s pam and virus es .
T he advantage of s uc h a "virtual" s etup (virtual us ers and domains in a M ySQ L databas e) is that it is
far more performant than a s etup that is bas ed on "real" s ys tem us ers . With this virtual s etup your
mail s erver c an handle thous ands of domains and us ers . Bes ides , it is eas ier to adminis trate bec aus e
you only have to deal with the M ySQ L databas e when you add new us ers /domains or edit exis ting
ones . N o more pos tmap c ommands to c reate db files , no more reloading of P os tfix, etc . For the
adminis tration of the M ySQ L databas e you c an us e web bas ed tools like phpM yA dmin whic h will als o
be ins talled in this howto. T he third advantage is that us ers have an email addres s as us er name
(ins tead of a us er name + an email addres s ) whic h is eas ier to unders tand and keep in mind.
T his tutorial is bas ed on Fedora 8 (i3 8 6 ). Y ou s hould already have s et up a bas ic Fedora s ys tem, as
des c ribed here: http://www.howtoforge.c om/fedora- 8 - s erver- lamp- email- dns - ftp- is pc onfig and
http://www.howtoforge.c om/fedora- 8 - s erver- lamp- email- dns - ftp- is pc onfig- p2 . P lus , you s hould make
s ure that the firewall is off (at leas t for now) and that SELinux is disabled (this is important! ), as s hown
in the c hapters s ix and s even on http://www.howtoforge.c om/fedora- 8 - s erver- lamp- email- dns - ftp-
is pc onfig- p3 .
T his howto is meant as a prac tic al guide; it does not c over the theoretic al bac kgrounds . T hey are
treated in a lot of other doc uments in the web.
T his doc ument c omes without warranty of any kind! I want to s ay that this is not the only way of
s etting up s uc h a s ys tem. T here are many ways of ac hieving this goal but this is the way I take. I do
not is s ue any guarantee that this will work for you!
O ur hos tname in this example is server1.example.com, and it has the I P addres s 192.168.0.100, s o we
c hange /etc/hosts as follows :
vi /etc/hosts
6 of 12 11/30/09 12:06
Virtual Users And Domains With Postfix, Courier A... http://www.howtoforge.com/virtual-users-and-domai...
yum update
7 of 12 11/30/09 12:06
Virtual Users And Domains With Postfix, Courier A... http://www.howtoforge.com/virtual-users-and-domai...
T his c an all be ins talled with one s ingle c ommand (inc luding the pac kages we need to build C ourier-
I M A P ):
yum install ntp httpd mysql-server php php-mysql php-mbstring rpm-build gcc mysql-devel
openssl-devel cyrus-sasl-devel pkgconfig zlib-devel phpMyAdmin pcre-devel openldap-devel
postgresql-devel expect libtool-ltdl-devel openldap-servers libtool gdbm-devel pam-devel
gamin-devel
U nfortunately there are no rpm pac kages for C ourier- I M A P , C ourier- A uthlib, and M aildrop, therefore
we have to ins tall them as des c ribed in this tutorial: H ow T o I ns tall c ourier- imap, c ourier- authlib,
A nd maildrop O n Fedora, RedH at, C entO S
We have to get the P os tfix s ourc e rpm, patc h it with the quota patc h, build a new P os tfix rpm pac kage
and ins tall it.
cd /usr/src
wget http://ftp-stud.fht-esslingen.de/pub/Mirrors/fedora/linux/releases/8/Fedora/source/SRPMS
/postfix-2.4.5-2.fc8.src.rpm
rpm -ivh postfix-2.4.5-2.fc8.src.rpm
cd /usr/src/redhat/SOURCES
wget http://vda.sourceforge.net/VDA/postfix-2.4.5-vda-ng.patch.gz
gunzip postfix-2.4.5-vda-ng.patch.gz
cd /usr/src/redhat/SPECS/
vi postfix.spec
C hange %define MYSQL 0 to %define MYSQL 1, add Patch0: postfix-2.4.5-vda-ng.patch to the # Patches
s tanza, and finally add %patch0 -p1 -b .vda-ng to the %setup -q s tanza:
8 of 12 11/30/09 12:06
Virtual Users And Domains With Postfix, Courier A... http://www.howtoforge.com/virtual-users-and-domai...
[...]
%define MYSQL 1
[...]
# Patches
Patch0: postfix-2.4.5-vda-ng.patch
Patch1: postfix-2.1.1-config.patch
Patch3: postfix-alternatives.patch
Patch6: postfix-2.1.1-obsolete.patch
Patch7: postfix-2.1.5-aliases.patch
Patch8: postfix-large-fs.patch
Patch9: postfix-2.4.0-cyrus.patch
Patch10: postfix-2.4.5-open_define.patch
[...]
%prep
T hen we build our new P os tfix rpm pac kage with quota and M ySQ L s upport:
cd /usr/src/redhat/RPMS/i386
T he c ommand
ls -l
[root@server1 i386]# ls -l
total 11604
-rw-r--r-- 1 root root 3899179 2007-11-13 22:26 postfix-2.4.5-2.fc8.i386.rpm
-rw-r--r-- 1 root root 7907114 2007-11-13 22:26 postfix-debuginfo-2.4.5-2.fc8.i386.rpm
-rw-r--r-- 1 root root 50804 2007-11-13 22:26 postfix-pflogsumm-2.4.5-2.fc8.i386.rpm
[root@server1 i386]#
(I n c as e you have problems c reating the P os tfix rpm pac kage, you c an download mine from here.)
9 of 12 11/30/09 12:06
Virtual Users And Domains With Postfix, Courier A... http://www.howtoforge.com/virtual-users-and-domai...
Start M ySQ L :
N ow we c onfigure phpM yA dmin. We c hange the A pac he c onfiguration s o that phpM yA dmin allows
c onnec tions not jus t from loc alhos t (by c ommenting out the <Directory /usr/share/phpMyAdmin/>
s tanza):
vi /etc/httpd/conf.d/phpMyAdmin.conf
10 of 12 11/30/09 12:06
Virtual Users And Domains With Postfix, Courier A... http://www.howtoforge.com/virtual-users-and-domai...
Pleas e do not us e the comment function to as k for help! I f you need help, pleas e us e our forum.
Comments will be publis hed after adminis trator approval.
selinux
Submitted by Slawek (not registered) on Wed, 2008-09-17 09:16.
cyrus-sasl missing
Submitted by jpieper (registered user) on Wed, 2008-08-27 19:19.
11 of 12 11/30/09 12:06
Virtual Users And Domains With Postfix, Courier A... http://www.howtoforge.com/virtual-users-and-domai...
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
12 of 12 11/30/09 12:06