/[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.16 Revision 1.21
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.21 2003/12/07 18:21:26 pylon Exp $ -->
2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 4
4<guide link=" /doc/en/virt-mail-howto.xml" > 5<guide link=" /doc/en/virt-mail-howto.xml" >
5<title>Virtual Mailhosting System Guide</title> 6<title>Virtual Mailhosting System Guide</title>
6<author title="Author" > 7<author title="Author" >
8</author> 9</author>
9<author title="Author" > 10<author title="Author" >
10<mail link="ezra@revoltltd.org" >Ezra Gorman</mail> 11<mail link="ezra@revoltltd.org" >Ezra Gorman</mail>
11</author> 12</author>
12<abstract>This document details how to create a virtual mailhosting system based upon postfix, mysql, courier-imap, and cyrus-sasl. </abstract> 13<abstract>This document details how to create a virtual mailhosting system based upon postfix, mysql, courier-imap, and cyrus-sasl. </abstract>
13<version>1.0.2</version> 14<version>1.0.6</version>
14<date>7 Aug 2003</date> 15<date>December 7, 2003</date>
15<!-- 16<!--
16 17
17Contents 18Contents
18 19
19I. Introduction 20I. Introduction
39<p>A virtual mail system needs to be able to handle email for numerous domains with multiple users over a variety of interfaces. This presents some issues that must be dealt with. For instance, what if you have two users on different domains that want the same user name? If you are providing imap access and smtp-auth, how do combine the various authentication daemons into a single system? How do you provide security for the numerous components that comprise the system? How do you manage it all?</p> 40<p>A virtual mail system needs to be able to handle email for numerous domains with multiple users over a variety of interfaces. This presents some issues that must be dealt with. For instance, what if you have two users on different domains that want the same user name? If you are providing imap access and smtp-auth, how do combine the various authentication daemons into a single system? How do you provide security for the numerous components that comprise the system? How do you manage it all?</p>
40<p>This howto will show you how to set up with a mail system capable of handling mail for as many domains as your hardware can handle, supports virtual mail users that don't require shell accounts, has domain specific user names, can authenticate web, imap, smtp, and pop3 clients against a single database, utilizes ssl for transport layer security, has a web interface, can handle mailing lists for any domain on the machine, and is controlled by a nice, central and easy mysql database. </p> 41<p>This howto will show you how to set up with a mail system capable of handling mail for as many domains as your hardware can handle, supports virtual mail users that don't require shell accounts, has domain specific user names, can authenticate web, imap, smtp, and pop3 clients against a single database, utilizes ssl for transport layer security, has a web interface, can handle mailing lists for any domain on the machine, and is controlled by a nice, central and easy mysql database. </p>
41<p>There are quite a variety of ways to go about setting up a virtual mailhosting system. With so may options, another may be the best choice for your specific needs. Consider investigating <uri>http://www.qmail.org/</uri> and <uri>http://www.exim.org/</uri> to explore your options. </p> 42<p>There are quite a variety of ways to go about setting up a virtual mailhosting system. With so may options, another may be the best choice for your specific needs. Consider investigating <uri>http://www.qmail.org/</uri> and <uri>http://www.exim.org/</uri> to explore your options. </p>
42<p>The following packages are used in this setup: 43<p>The following packages are used in this setup:
43 44
44 apache, courier-imap, pam_mysql, postfix, mod_php, mod_ssl, phpmyadmin, squirrelmail, cyrus-sasl, mysql, php, and mailman.</p> 45 apache, courier-imap, pam_mysql, postfix, mod_php, phpmyadmin, squirrelmail, cyrus-sasl, mysql, php, and mailman.</p>
45<p>Make sure to turn on the following USE variables in <path>/etc/make.conf</path> before compiling the packages: <c>USE=&quot;mysql imap libwww maildir sasl ssl&quot;</c>. Otherwise you will most likely have to recompile things to get the support you need for all the protocols. Further, it's a good idea to turn off any other mail and network variables, like ipv6.</p> 46<p>Make sure to turn on the following USE variables in <path>/etc/make.conf</path> before compiling the packages: <c>USE=&quot;mysql imap libwww maildir sasl ssl&quot;</c>. Otherwise you will most likely have to recompile things to get the support you need for all the protocols. Further, it's a good idea to turn off any other mail and network variables, like ipv6.</p>
46<impo>This howto was written for postfix-2.0.x. If you are using postfix &lt; 2 some of the variables in this document will be different. It is recommended that you upgrade. Some other packages included in this howto are version sensitive as well. You are advised to read the documentation included with packages if you run into issues with this.</impo> 47<impo>This howto was written for postfix-2.0.x. If you are using postfix &lt; 2 some of the variables in this document will be different. It is recommended that you upgrade. Some other packages included in this howto are version sensitive as well. You are advised to read the documentation included with packages if you run into issues with this.</impo>
47<impo>This document uses apache-1.3.x. Apache-2 has been marked stable in portage. However there are still a number of issues with php integration. Until php support in apache-2.0.x is marked stable, this guide will continue to use the 1.3.x version.</impo> 48<impo>This document uses apache-1.3.x. Apache-2 has been marked stable in portage. However there are still a number of issues with php integration. Until php support in apache-2.0.x is marked stable, this guide will continue to use the 1.3.x version.</impo>
48<impo>You need a domain name to run a public mail server, or at least an MX record for a domain. Ideally you would have control of at least two domains to take advantage of your new virtual domain functionality.</impo> 49<impo>You need a domain name to run a public mail server, or at least an MX record for a domain. Ideally you would have control of at least two domains to take advantage of your new virtual domain functionality.</impo>
49<impo>Make sure <path>/etc/hostname</path> is set to the right hostname for your mail server. Verify your hostname is set correctly with <c>hostname</c>. Also verify that there are no conflicting entries in <path>/etc/hosts</path>.</impo> 50<impo>Make sure <path>/etc/hostname</path> is set to the right hostname for your mail server. Verify your hostname is set correctly with <c>hostname</c>. Also verify that there are no conflicting entries in <path>/etc/hosts</path>.</impo>
315<chapter> 316<chapter>
316<title>Apache and phpMyAdmin</title> 317<title>Apache and phpMyAdmin</title>
317<body> 318<body>
318<p>Next we'll set up apache and add an interface to interact with the database more easily. </p> 319<p>Next we'll set up apache and add an interface to interact with the database more easily. </p>
319<pre caption="Setting up apache and phpmyadmin" > 320<pre caption="Setting up apache and phpmyadmin" >
320# <i>emerge apache mod_php mod_ssl phpmyadmin</i> 321# <i>emerge apache mod_php phpmyadmin</i>
321</pre> 322</pre>
322<p>There are plenty of guides out there about how to set up apache with php. Like this one: <uri>http://www.linuxguruz.org/z.php?id=31</uri>. There are also numerous posts on <uri>http://forums.gentoo.org</uri> detailing how to solve problems with the installation (search for 'apache php'). So, that said, I'm not going to cover it here. Set up the apache and php installs, then continue with this howto. Now, a word for the wise: .htaccess the directory that you put phpmyadmin in. If you do not do this, search engine spiders will come along and index the page which in turn will mean that anyone will be able to find your phpmyadmin page via google and in turn be able to come change your database however they want which is <e>BAD!</e> There are many howtos on this including: <uri>http://docs.csoft.net/micro/black-htaccess.html</uri>.</p> 323<p>There are plenty of guides out there about how to set up apache with php. Like this one: <uri>http://www.linuxguruz.org/z.php?id=31</uri>. There are also numerous posts on <uri>http://forums.gentoo.org</uri> detailing how to solve problems with the installation (search for 'apache php'). So, that said, I'm not going to cover it here. Set up the apache and php installs, then continue with this howto. Now, a word for the wise: .htaccess the directory that you put phpmyadmin in. If you do not do this, search engine spiders will come along and index the page which in turn will mean that anyone will be able to find your phpmyadmin page via google and in turn be able to come change your database however they want which is <e>BAD!</e> There are many howtos on this including: <uri>http://docs.csoft.net/micro/black-htaccess.html</uri>.</p>
323<p>Now we're going to install the Apache certificates we made previously. The Apache-SSL directives that you need to use the resulting cert are: 324<p>Now we're going to install the Apache certificates we made previously. The Apache-SSL directives that you need to use the resulting cert are:
324 <ul> 325 <ul>
325<li>SSLCertificateFile /path/to/certs/new.cert.cert</li> 326<li>SSLCertificateFile /path/to/certs/new.cert.cert</li>
340# <i>/etc/init.d/apache restart</i> 341# <i>/etc/init.d/apache restart</i>
341</pre> 342</pre>
342<note>If you have an existing apache install, you'll likely have to perform a full server reboot to install your new certificates. Check your logs to verify apache restarted successfully.</note> 343<note>If you have an existing apache install, you'll likely have to perform a full server reboot to install your new certificates. Check your logs to verify apache restarted successfully.</note>
343<p>Next, configure phpMyAdmin.</p> 344<p>Next, configure phpMyAdmin.</p>
344<pre caption="Configuring phpMyAdmin" > 345<pre caption="Configuring phpMyAdmin" >
345# <i>nano -w /home/httpd/htdocs/phpmyadmin/config.inc.php</i> 346# <i>nano -w /var/www/localhost/htdocs/phpmyadmin/config.inc.php</i>
346<codenote>Change the following parameters</codenote> 347<codenote>Change the following parameters</codenote>
347 348
348$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname 349$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname
349$cfg['Servers'][$i]['controluser'] = 'mailsql'; // MySQL control user settings 350$cfg['Servers'][$i]['controluser'] = 'mailsql'; // MySQL control user settings
350 // (this user must have read-only 351 // (this user must have read-only
373<chapter> 374<chapter>
374<title>Configuring MySQL Authentication and vhosts</title> 375<title>Configuring MySQL Authentication and vhosts</title>
375<body> 376<body>
376<p>Next we'll reconfigure our authentication to use the mailsql database in courier-imap and postfix. In all of the following examples, replace $password with the password you set for the mailsql mysql user.</p> 377<p>Next we'll reconfigure our authentication to use the mailsql database in courier-imap and postfix. In all of the following examples, replace $password with the password you set for the mailsql mysql user.</p>
377<pre> 378<pre>
378# <i>emerge /usr/portage/sys-libs/pam_mysql/pam_mysql-$currentversion.ebuild</i> 379# <i>emerge pam_mysql</i>
379<codenote>This package is currently masked so you'll have to give it an explicit path </codenote>
380<codenote>or unmask the package. This is subject to change when the package is unmasked</codenote>
381<codenote>in the portage tree.</codenote>
382
383# <i>nano -w /etc/pam.d/imap</i> 380# <i>nano -w /etc/pam.d/imap</i>
384<codenote>Comment out the existing auth lines and add the following as shown.</codenote> 381<codenote>Comment out the existing auth lines and add the following as shown.</codenote>
385 382
386#auth required pam_nologin.so 383#auth required pam_nologin.so
387#auth required pam_stack.so service=system-auth 384#auth required pam_stack.so service=system-auth
388#account required pam_stack.so service=system-auth 385#account required pam_stack.so service=system-auth
389#session required pam_stack.so service=system-auth 386#session required pam_stack.so service=system-auth
390 387
391auth optional pam_mysql.so server=localhost db=mailsql user=mailsql \ 388auth optional pam_mysql.so host=localhost db=mailsql user=mailsql \
392 passwd=$password table=users usercolumn=email passwdcolumn=clear crypt=0 389 passwd=$password table=users usercolumn=email passwdcolumn=clear crypt=0
393account required pam_mysql.so server=localhost db=mailsql user=mailsql \ 390account required pam_mysql.so host=localhost db=mailsql user=mailsql \
394 passwd=$password table=users usercolumn=email passwdcolumn=clear crypt=0 391 passwd=$password table=users usercolumn=email passwdcolumn=clear crypt=0
395 392
396# <i>nano -w /etc/pam.d/pop3</i> 393# <i>nano -w /etc/pam.d/pop3</i>
397# <i>nano -w /etc/pam.d/smtp</i> 394# <i>nano -w /etc/pam.d/smtp</i>
398<codenote>Make the same changes to the pop3 and smtp files</codenote> 395<codenote>Make the same changes to the pop3 and smtp files</codenote>
545<body> 542<body>
546<pre> 543<pre>
547# <i>emerge squirrelmail</i> 544# <i>emerge squirrelmail</i>
548<codenote>I like to add a link to the htdocs space for a shorter url.</codenote> 545<codenote>I like to add a link to the htdocs space for a shorter url.</codenote>
549 546
550# <i>ln -s /home/httpd/htdocs/squirrelmail/ /home/httpd/htdocs/mail</i> 547# <i>ln -s /var/www/localhost/htdocs/squirrelmail/ /var/www/localhost/htdocs/mail</i>
551# <i>cd /home/httpd/htdocs/mail/conf</i> 548# <i>cd /var/www/localhost/htdocs/mail/conf</i>
552# <i>./conf.pl</i> 549# <i>./conf.pl</i>
553<codenote>Change your Organization, Server, and Folder settings for squirrelmail.</codenote> 550<codenote>Change your Organization, Server, and Folder settings for squirrelmail.</codenote>
554<codenote>Now you should be able to login to squirrelmail, again - with your full email address,</codenote> 551<codenote>Now you should be able to login to squirrelmail, again - with your full email address,</codenote>
555<codenote>and use your new webmail setup.</codenote> 552<codenote>and use your new webmail setup.</codenote>
556</pre> 553</pre>

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.20