/[gentoo]/xml/htdocs/doc/en/virt-mail-howto.xml
Gentoo

Diff of /xml/htdocs/doc/en/virt-mail-howto.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.52 Revision 1.53
1<?xml version='1.0' encoding='UTF-8'?> 1<?xml version='1.0' encoding='UTF-8'?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/virt-mail-howto.xml,v 1.52 2006/07/04 00:21:20 rane Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/virt-mail-howto.xml,v 1.53 2006/09/04 08:49:44 nightmorph Exp $ -->
3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4 4
5<guide link="/doc/en/virt-mail-howto.xml"> 5<guide link="/doc/en/virt-mail-howto.xml">
6<title>Virtual Mailhosting System with Postfix Guide</title> 6<title>Virtual Mailhosting System with Postfix Guide</title>
7 7
8<author title="Author"> 8<author title="Author">
9 <mail link="antifa@gentoo.org">Ken Nowack</mail> 9 <mail link="antifa@gentoo.org">Ken Nowack</mail>
10</author> 10</author>
11<author title="Author"> 11<author title="Author">
12 <mail link="ezra@revoltltd.org">Ezra Gorman</mail> 12 <mail link="ezra@revoltltd.org">Ezra Gorman</mail>
13</author> 13</author>
14<author title="Editor"> 14<author title="Editor">
15 <mail link="klasikahl@gentoo.org">Zack Gilburd</mail> 15 <mail link="klasikahl@gentoo.org">Zack Gilburd</mail>
16</author> 16</author>
17<author title="Editor"> 17<author title="Editor">
18 <mail link="seather@scygro.za.net">Scygro</mail> 18 <mail link="seather@scygro.za.net">Scygro</mail>
19</author> 19</author>
20 20
21<abstract> 21<abstract>
22This document details how to create a virtual mailhosting system based upon 22This document details how to create a virtual mailhosting system based upon
23postfix, mysql, courier-imap, and cyrus-sasl. 23postfix, mysql, courier-imap, and cyrus-sasl.
24</abstract> 24</abstract>
25 25
26<version>1.1</version> 26<version>1.2</version>
27<date>2006-07-04</date> 27<date>2006-09-04</date>
28 28
29<!-- 29<!--
30Contents 30Contents
31 31
32I. Introduction 32I. Introduction
33II. Postfix Basics 33II. Postfix Basics
34III. Courier-imap 34III. Courier-imap
35IV. Cyrus-sasl 35IV. Cyrus-sasl
36V. SSL Certificates for Postfix and Apache 36V. SSL Certificates for Postfix and Apache
37VI. Adding SSL and SASL support to Postfix 37VI. Adding SSL and SASL support to Postfix
38VII. MySQL 38VII. MySQL
39VIII. Apache and phpMyAdmin 39VIII. Apache and phpMyAdmin
40IX. The vmail user 40IX. The vmail user
41X. Configuring MySQL Authentication and vhosts 41X. Configuring MySQL Authentication and vhosts
42XI. Squirrelmail 42XI. Squirrelmail
146<title>Postfix Basics</title> 146<title>Postfix Basics</title>
147<section> 147<section>
148<body> 148<body>
149 149
150<pre caption="Install postfix"> 150<pre caption="Install postfix">
151# <i>emerge postfix</i> 151# <i>emerge postfix</i>
152</pre> 152</pre>
153 153
154<warn> 154<warn>
155Verify that you have not installed any other MTA, such as ssmtp, exim, or 155Verify that you have not installed any other MTA, such as ssmtp, exim, or
156qmail, or you will surely have BIG problems. 156qmail, or you will surely have BIG problems.
157</warn> 157</warn>
158 158
159<p> 159<p>
160After postfix is installed, it's time to configure it. Change the following 160After postfix is installed, it's time to configure it. Change the following
161options in <path>/etc/postfix/main.cf</path>: 161options in <path>/etc/postfix/main.cf</path>. Remember to replace
162<c>$variables</c> with your own names.
162</p> 163</p>
163 164
164<pre caption="/etc/postfix/main.cf"> 165<pre caption="/etc/postfix/main.cf">
165myhostname = $host.domain.name 166myhostname = $host.domain.name
166mydomain = $domain.name 167mydomain = $domain.name
167inet_interfaces = all 168inet_interfaces = all
168mydestination = $myhostname, localhost.$mydomain $mydomain 169mydestination = $myhostname, localhost.$mydomain $mydomain
169mynetworks = my.ip.net.work/24, 127.0.0.0/8 170mynetworks = my.ip.net.work/24, 127.0.0.0/8
170home_mailbox = .maildir/ 171home_mailbox = .maildir/
171local_destination_concurrency_limit = 2 172local_destination_concurrency_limit = 2
172default_destination_concurrency_limit = 10 173default_destination_concurrency_limit = 10
173</pre> 174</pre>
174 175
175<p> 176<p>
176Next change the following in <path>/etc/postfix/master.cf</path>. This will 177Next change the following in <path>/etc/postfix/master.cf</path>. This will
599$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname 600$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname
600$cfg['Servers'][$i]['controluser'] = 'mailsql'; // MySQL control user settings 601$cfg['Servers'][$i]['controluser'] = 'mailsql'; // MySQL control user settings
601 // (this user must have read-only 602 // (this user must have read-only
602$cfg['Servers'][$i]['controlpass'] = '$password'; // access to the "mysql/user" 603$cfg['Servers'][$i]['controlpass'] = '$password'; // access to the "mysql/user"
603 // and "mysql/db" tables) 604 // and "mysql/db" tables)
604$cfg['Servers'][$i]['user'] = 'mailsql'; // MySQL user 605$cfg['Servers'][$i]['user'] = 'mailsql'; // MySQL user
605$cfg['Servers'][$i]['password'] = '$password'; // MySQL password 606$cfg['Servers'][$i]['password'] = '$password'; // MySQL password
606</pre> 607</pre>
607 608
608<p> 609<p>
609Now enter the phpmyadmin page and browse the tables. You'll want to add in your 610Now enter the phpmyadmin page and browse the tables. You'll want to add in your
610local aliases, edit your user table to add a test user, and change your 611local aliases, edit your user table to add a test user, and change your
611transport table to add information about your domains. The default values 612transport table to add information about your domains. The default values
612supplied with the dumpfile should be a sufficient guide to what values need to 613supplied with the dumpfile should be a sufficient guide to what values need to
613go where. Make sure that if you put information in the database that it is 614go where. Make sure that if you put information in the database that it is
614accurate. For instance, make sure the local users home dir exists and that the 615accurate. For instance, make sure the local user's home dir exists and that the
615correct uid/gid values are in place. The maildirs should be created 616correct uid/gid values are in place. The maildirs should be created
616automatically by postfix when the user receives their first email. So, in 617automatically by postfix when the user receives their first email. So, in
617general, it's a good idea to send a "Welcome" mail to a new user 618general, it's a good idea to send a "Welcome" mail to a new user after you
618after you setup their account to make sure the .maildir gets created. 619setup their account to make sure the .maildir gets created.
619</p> 620</p>
620 621
621</body> 622</body>
622</section> 623</section>
623</chapter> 624</chapter>
624 625
625<chapter> 626<chapter>
626<title>The vmail user</title> 627<title>The vmail user</title>
627<section> 628<section>
628<body> 629<body>
629 630
630<p> 631<p>
631At this point you may be wondering what user and directory to use for virtual 632At this point you may be wondering what user and directory to use for virtual
632mail users, and rightly so. Let's set that up. 633mail users, and rightly so. Let's set that up.
633</p> 634</p>
634 635
635<pre caption="Adding the vmail user"> 636<pre caption="Adding the vmail user">
636# <i>adduser -d /home/vmail -s /bin/false vmail</i> 637# <i>adduser -d /home/vmail -s /bin/false vmail</i>
637# <i>uid=`cat /etc/passwd | grep vmail | cut -f 3 -d :`</i> 638# <i>uid=`cat /etc/passwd | grep vmail | cut -f 3 -d :`</i>
638# <i>groupadd -g $uid vmail</i> 639# <i>groupadd -g $uid vmail</i>
639# <i>mkdir /home/vmail</i> 640# <i>mkdir /home/vmail</i>
640# <i>chown vmail: /home/vmail</i> 641# <i>chown vmail: /home/vmail</i>
641</pre> 642</pre>
642 643
643<p> 644<p>
644So now when you're setting up vmail accounts, use the vmail uid, gid, and 645So now when you're setting up vmail accounts, use the vmail uid, gid, and
645homedir. When you're setting up local accounts, use that users uid, gid, and 646homedir. When you're setting up local accounts, use that user's uid, gid, and
646homedir. We've been meaning to create a php admin page for this setup but 647homedir. We've been meaning to create a php admin page for this setup but
647haven't gotten around to it yet, as phpmyadmin generally works fine for us. 648haven't gotten around to it yet, as phpmyadmin generally works fine for us.
648</p> 649</p>
649 650
650</body> 651</body>
651</section> 652</section>
652</chapter> 653</chapter>
653 654
654<chapter> 655<chapter>
655<title>Configuring MySQL Authentication and vhosts</title> 656<title>Configuring MySQL Authentication and vhosts</title>
656<section> 657<section>
657<body> 658<body>
658 659
659<p> 660<p>
660Next we'll reconfigure our authentication to use the mailsql database in 661Next we'll reconfigure our authentication to use the mailsql database in
675<comment>(Make sure the following line is commented out since we're storing plaintext.)</comment> 676<comment>(Make sure the following line is commented out since we're storing plaintext.)</comment>
676#MYSQL_CRYPT_PWFIELD crypt 677#MYSQL_CRYPT_PWFIELD crypt
677MYSQL_CLEAR_PWFIELD clear 678MYSQL_CLEAR_PWFIELD clear
678MYSQL_UID_FIELD uid 679MYSQL_UID_FIELD uid
679MYSQL_GID_FIELD gid 680MYSQL_GID_FIELD gid
680MYSQL_LOGIN_FIELD email 681MYSQL_LOGIN_FIELD email
681MYSQL_HOME_FIELD homedir 682MYSQL_HOME_FIELD homedir
682MYSQL_NAME_FIELD name 683MYSQL_NAME_FIELD name
683MYSQL_MAILDIR_FIELD maildir 684MYSQL_MAILDIR_FIELD maildir
684 685
685# <i>/etc/init.d/courier-authlib restart</i> 686# <i>/etc/init.d/courier-authlib restart</i>
686# <i>/etc/init.d/saslauthd restart</i> 687# <i>/etc/init.d/saslauthd restart</i>
687</pre> 688</pre>
688 689
689<p> 690<p>
690We're almost there I promise! Next, set up the rest of the necessary config's 691We're almost there, I promise! Next, set up the rest of the necessary configs
691for postfix to interract with the database for all it's other transport needs. 692for postfix to interract with the database for all its other transport needs.
693Remember to replace each value with the name of your own user, user id,
694password, alias, email address, and so on.
692</p> 695</p>
693 696
694<pre caption="/etc/postfix/mysql-aliases.cf"> 697<pre caption="/etc/postfix/mysql-aliases.cf">
695# <i>nano -w /etc/postfix/mysql-aliases.cf</i> 698# <i>nano -w /etc/postfix/mysql-aliases.cf</i>
696# mysql-aliases.cf 699# mysql-aliases.cf
697 700
698user = mailsql 701user = mailsql
699password = $password 702password = $password
700dbname = mailsql 703dbname = mailsql
701table = alias 704table = alias
702select_field = destination 705select_field = destination
703where_field = alias 706where_field = alias
704hosts = unix:/var/run/mysqld/mysqld.sock 707hosts = unix:/var/run/mysqld/mysqld.sock
705</pre> 708</pre>
706 709
874<chapter> 877<chapter>
875<title>Mailman</title> 878<title>Mailman</title>
876<section> 879<section>
877<body> 880<body>
878 881
879<p> 882<p>
880Last step: mailman. The new version of mailman has very nice virtual domain 883Last step: mailman. The new version of mailman has very nice virtual domain
881support, which is why I use it, not to mention it's really a great package. To 884support, which is why I use it, not to mention it's really a great package. To
882get this package installed and working correctly for virtual domains is going 885get this package installed and working correctly for virtual domains is going
883to require a bit of hacking. I really recommend reading all of the mailman 886to require a bit of hacking. I really recommend reading all of the mailman
884documentation, including README.POSTFIX.gz, to understand what's being done 887documentation, including README.POSTFIX.gz, to understand what's being done
885here. 888here.
886</p> 889</p>
887 890
888<p> 891<p>
889One further note, current versions of mailman install to /usr/local/mailman. If 892One further note, current versions of mailman install to
890you're like me and wish to change the default install location, it can be 893<path>/usr/local/mailman</path>. If you're like me and wish to change the
891overridden in the ebuild file by changing the INSTALLDIR variable. 894default install location, it can be overridden in the ebuild file by changing
895the INSTALLDIR variable.
892</p> 896</p>
893 897
894<pre caption="Install mailman"> 898<pre caption="Install mailman">
895# <i>emerge mailman</i> 899# <i>emerge mailman</i>
896</pre> 900</pre>
897 901
898<pre caption="Setting defaults: Mailman/Defaults.py"> 902<pre caption="Setting defaults: Mailman/Defaults.py">
899# <i> nano -w /var/mailman/Mailman/Defaults.py</i> 903# <i> nano -w /var/mailman/Mailman/Defaults.py</i>
900<comment>(Change the values below to reflect your primary domain, virtuals will be set next.)</comment> 904<comment>(Change the values below to reflect your primary domain, virtuals will be set next.)</comment>
901DEFAULT_EMAIL_HOST = 'domain.com' 905DEFAULT_EMAIL_HOST = 'domain.com'
902DEFAULT_URL_HOST = 'www.domain.com' 906DEFAULT_URL_HOST = 'www.domain.com'
903</pre> 907</pre>
904 908
905<pre caption="mailman config: mm_cfg.py"> 909<pre caption="mailman config: mm_cfg.py">
906# <i>nano -w /var/mailman/Mailman/mm_cfg.py</i> 910# <i>nano -w /var/mailman/Mailman/mm_cfg.py</i>

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.20