/[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.29 Revision 1.30
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.29 2004/03/26 12:47:10 cam Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/virt-mail-howto.xml,v 1.30 2004/04/11 10:52:16 cam 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<author title="Author" > 7<author title="Author" >
8<mail link="antifa@gentoo.org" >Ken Nowack</mail> 8<mail link="antifa@gentoo.org" >Ken Nowack</mail>
9</author> 9</author>
10<author title="Author" > 10<author title="Author" >
11<mail link="ezra@revoltltd.org" >Ezra Gorman</mail> 11<mail link="ezra@revoltltd.org" >Ezra Gorman</mail>
12</author> 12</author>
13<author title="Editor"> 13<author title="Editor">
14<mail link="klasikahl@gentoo.org" >Zack Gilburd</mail> 14<mail link="klasikahl@gentoo.org" >Zack Gilburd</mail>
15</author> 15</author>
16<abstract>This document details how to create a virtual mailhosting system based upon postfix, mysql, courier-imap, and cyrus-sasl. </abstract> 16<abstract>This document details how to create a virtual mailhosting system based upon postfix, mysql, courier-imap, and cyrus-sasl. </abstract>
17<version>1.0.10</version> 17<version>1.0.10</version>
70mydomain = $domain.name 70mydomain = $domain.name
71inet_interfaces = all 71inet_interfaces = all
72mydestination = $myhostname, localhost.$mydomain $mydomain 72mydestination = $myhostname, localhost.$mydomain $mydomain
73mynetworks = my.ip.net.work/24, 127.0.0.0/8 73mynetworks = my.ip.net.work/24, 127.0.0.0/8
74home_mailbox = .maildir/ 74home_mailbox = .maildir/
75local_destination_concurrency_limit = 2 75local_destination_concurrency_limit = 2
76default_destination_concurrency_limit = 10 </pre> 76default_destination_concurrency_limit = 10 </pre>
77<p>Next change the following in <path>/etc/postfix/master.cf</path>. This will turn on verbose output for debugging:</p> 77<p>Next change the following in <path>/etc/postfix/master.cf</path>. This will turn on verbose output for debugging:</p>
78<pre caption="/etc/postfix/master.cf" > 78<pre caption="/etc/postfix/master.cf" >
79# service type private unpriv chroot wakeup maxproc command + args 79# service type private unpriv chroot wakeup maxproc command + args
80# (yes) (yes) (yes) (never) (50) 80# (yes) (yes) (yes) (never) (50)
81# 81#
82========================================================================== 82==========================================================================
83smtp inet n - n - - smtpd -v 83smtp inet n - n - - smtpd -v
84 84
85<codenote>Just add the <c>-v</c> after the smtpd in the above line</codenote> 85<codenote>Just add the "-v" after the smtpd in the above line</codenote>
86</pre> 86</pre>
87<p>Next, edit <path>/etc/mail/aliases</path> to add your local aliases. There should at least be an alias for root like: <c>root: your@email.address</c>.</p> 87<p>Next, edit <path>/etc/mail/aliases</path> to add your local aliases. There should at least be an alias for root like: <c>root: your@email.address</c>.</p>
88<pre caption="Starting postfix for the first time" > 88<pre caption="Starting postfix for the first time" >
89# <i>/usr/bin/newaliases</i> 89# <i>/usr/bin/newaliases</i>
90<codenote>This will install the new aliases. You only need to do this </codenote> 90<codenote>This will install the new aliases. You only need to do this </codenote>
91<codenote>when you update or install aliases.</codenote> 91<codenote>when you update or install aliases.</codenote>
92 92
93# <i>/etc/init.d/postfix start</i> 93# <i>/etc/init.d/postfix start</i>
94</pre> 94</pre>
95<p>Now that postfix is running, fire up your favorite console mail client and send yourself an email. I use <c>mutt</c> for all my console mail. Verify that postfix is delivering mail to local users, once that's done, we're on to the next step.</p> 95<p>Now that postfix is running, fire up your favorite console mail client and send yourself an email. I use <c>mutt</c> for all my console mail. Verify that postfix is delivering mail to local users, once that's done, we're on to the next step.</p>
96<note>I strongly recommend that you verify this basic postfix setup is functioning before you progress to the next step of the howto. </note> 96<note>I strongly recommend that you verify this basic postfix setup is functioning before you progress to the next step of the howto. </note>
97</body> 97</body>
98</section> 98</section>
99</chapter> 99</chapter>
100<chapter> 100<chapter>
284# <i>/etc/init.d/mysql start</i> 284# <i>/etc/init.d/mysql start</i>
285# <i>mysqladmin -u root -p create mailsql</i> 285# <i>mysqladmin -u root -p create mailsql</i>
286# <i>mysql -u root -p mailsql &lt; genericmailsql.sql</i> 286# <i>mysql -u root -p mailsql &lt; genericmailsql.sql</i>
287 287
288# <i>mysql -u root -p mysql</i> 288# <i>mysql -u root -p mysql</i>
289mysql> <i>GRANT SELECT,INSERT,UPDATE,DELETE</i> 289mysql> <i>GRANT SELECT,INSERT,UPDATE,DELETE</i>
290 -> <i>ON mailsql.*</i> 290 -> <i>ON mailsql.*</i>
291 -> <i>TO mailsql@localhost</i> 291 -> <i>TO mailsql@localhost</i>
292 -> <i>IDENTIFIED BY '$password';</i> 292 -> <i>IDENTIFIED BY '$password';</i>
293 293
294 -> <i>quit</i> 294 -> <i>quit</i>
295<codenote>Verify that the new mailsql user can connect to the mysql server.</codenote> 295<codenote>Verify that the new mailsql user can connect to the mysql server.</codenote>
296 296
297# <i>mysql -u mailsql -p mailsql</i> 297# <i>mysql -u mailsql -p mailsql</i>
298</pre> 298</pre>
299
300<p>
299<p>Your new database has default values and tables set up for two domains. The following tables are included: 301Your new database has default values and tables set up for two domains. The following tables are included:
302</p>
303
300 <ul> 304<ul>
301<li>alias - local email alias and mailman alias information.</li> 305<li>alias - local email alias and mailman alias information.</li>
302<li>relocated - relocated user email address maps</li> 306<li>relocated - relocated user email address maps</li>
303<li>transport - default mail transport information for all domains you are hosting</li> 307<li>transport - default mail transport information for all domains you are hosting</li>
304<li>users - all user account information</li> 308<li>users - all user account information</li>
305<li>virtual - virtual domain email alias maps</li> 309<li>virtual - virtual domain email alias maps</li>
306</ul> 310</ul>
307</p> 311
308<pre caption="alias table sample" > 312<pre caption="alias table sample" >
309id alias destination 313id alias destination
3101 root foo@bar.com 3141 root foo@bar.com
3112 postmaster foo@bar.com 3152 postmaster foo@bar.com
312</pre> 316</pre>
313<pre caption="user table sample" > 317<pre caption="user table sample" >
314<codenote>Line wrapped for clarity</codenote> 318<codenote>Line wrapped for clarity</codenote>
315id email clear name uid gid homedir \ 319id email clear name uid gid homedir \
316 maildir quota postfix 320 maildir quota postfix
31710 foo@virt-bar.org $password realname virtid virtid /home/vmail \ 32110 foo@virt-bar.org $password realname virtid virtid /home/vmail \
318 /home/vmail/virt-bar.org/foo/.maildir/ y 322 /home/vmail/virt-bar.org/foo/.maildir/ y
31913 foo@bar.com $password realname localid localid /home/foo \ 32313 foo@bar.com $password realname localid localid /home/foo \
320 /home/foo/.maildir/ y 324 /home/foo/.maildir/ y
321</pre> 325</pre>
322<pre caption="transport table sample" > 326<pre caption="transport table sample" >
328id email destination 332id email destination
3293 root@virt-bar.org other@email.address 3333 root@virt-bar.org other@email.address
330</pre> 334</pre>
331</body> 335</body>
332</section> 336</section>
333</chapter> 337</chapter>
334<chapter> 338<chapter>
335<title>Apache and phpMyAdmin</title> 339<title>Apache and phpMyAdmin</title>
336<section> 340<section>
337<body> 341<body>
338<p>Next we'll set up apache and add an interface to interact with the database more easily. </p> 342<p>Next we'll set up apache and add an interface to interact with the database more easily. </p>
339<pre caption="Setting up apache and phpmyadmin" > 343<pre caption="Setting up apache and phpmyadmin" >
340# <i>emerge apache mod_php phpmyadmin</i> 344# <i>emerge apache mod_php phpmyadmin</i>
341</pre> 345</pre>
342<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://www.csoft.net/docs/micro/htaccess.html.en</uri>.</p> 346<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://www.csoft.net/docs/micro/htaccess.html.en</uri>.</p>
347
348<p>
343<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: 349Now we're going to install the Apache certificates we made previously. The Apache-SSL directives that you need to use the resulting cert are:
350</p>
351
344 <ul> 352<ul>
345<li>SSLCertificateFile /path/to/certs/new.cert.cert</li> 353<li>SSLCertificateFile /path/to/certs/new.cert.cert</li>
346<li>SSLCertificateKeyFile /path/to/certs/new.cert.key</li> 354<li>SSLCertificateKeyFile /path/to/certs/new.cert.key</li>
347</ul> 355</ul>
348</p> 356
349<pre caption="Install Apache SSL certificates" > 357<pre caption="Install Apache SSL certificates" >
350# <i>cp /etc/ssl/misc/new.cert.cert /etc/apache/conf/ssl/</i> 358# <i>cp /etc/ssl/misc/new.cert.cert /etc/apache/conf/ssl/</i>
351# <i>cp /etc/ssl/misc/new.cert.key /etc/apache/conf/ssl/</i> 359# <i>cp /etc/ssl/misc/new.cert.key /etc/apache/conf/ssl/</i>
352# <i>nano -w /etc/apache/conf/vhosts/ssl.default-vhost.conf</i> 360# <i>nano -w /etc/apache/conf/vhosts/ssl.default-vhost.conf</i>
353<codenote>Change the following parameters</codenote> 361<codenote>Change the following parameters</codenote>
354 362
355ServerName host.domain.name 363ServerName host.domain.name
356ServerAdmin your@email.address 364ServerAdmin your@email.address
357SSLCertificateFile /etc/apache/conf/ssl/new.cert.cert 365SSLCertificateFile /etc/apache/conf/ssl/new.cert.cert
358SSLCertificateKeyFile /etc/apache/conf/ssl/new.cert.key 366SSLCertificateKeyFile /etc/apache/conf/ssl/new.cert.key
359 367
360# <i>/etc/init.d/apache restart</i> 368# <i>/etc/init.d/apache restart</i>
361</pre> 369</pre>
362<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> 370<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>
363<p>Next, configure phpMyAdmin.</p> 371<p>Next, configure phpMyAdmin.</p>
782<section> 790<section>
783<title>Step 6: Sometimes only the big guns will give you the information you need: strace.</title> 791<title>Step 6: Sometimes only the big guns will give you the information you need: strace.</title>
784<body> 792<body>
785<p>You should have this installed anyway. This is an invaluable tool for debugging software. You can start commands from the command line with strace and watch all the system calls as they happen. It often dumps a huge amount of information, so you'll either need to watch it realtime as you retry a failed transaction with the mail system, or dump the output to a file for review.</p> 793<p>You should have this installed anyway. This is an invaluable tool for debugging software. You can start commands from the command line with strace and watch all the system calls as they happen. It often dumps a huge amount of information, so you'll either need to watch it realtime as you retry a failed transaction with the mail system, or dump the output to a file for review.</p>
786<pre> 794<pre>
787# <i>emerge strace</i> 795# <i>emerge strace</i>
788# <i>strace $command</i> 796# <i>strace $command</i>
789# <i>strace -p `ps -C $service -o pid=`</i> 797# <i>strace -p `ps -C $service -o pid=`</i>
790</pre> 798</pre>
791</body> 799</body>
792</section> 800</section>
793<section> 801<section>
794<title>Step 7: Research</title> 802<title>Step 7: Research</title>
795<body> 803<body>
796<p>Once you have the information, if you can diagnose and fix the problem, great! If not, you'll probably need to go digging on the net for information that will help you fix it. Here's a list of sites you can check to see if your error has already been resolved. There's also a really good howto on setting up smtp-auth which contains some great debugging ideas.</p> 804<p>Once you have the information, if you can diagnose and fix the problem, great! If not, you'll probably need to go digging on the net for information that will help you fix it. Here's a list of sites you can check to see if your error has already been resolved. There's also a really good howto on setting up smtp-auth which contains some great debugging ideas.</p>
797<p> 805
798<ul> 806<ul>
799<li> 807<li>
800<uri>http://forums.gentoo.org/</uri> - Great forums for gentoo users</li> 808<uri>http://forums.gentoo.org/</uri> - Great forums for gentoo users</li>
801<li> 809<li>
802<uri>http://bugs.gentoo.org/</uri> - Bugs database for gentoo - great place to look for specific errors</li> 810<uri>http://bugs.gentoo.org/</uri> - Bugs database for gentoo - great place to look for specific errors</li>
803<li> 811<li>
804<uri>http://postfix.state-of-mind.de/</uri> - smtp-auth howto</li> 812<uri>http://postfix.state-of-mind.de/</uri> - smtp-auth howto</li>
805<li> 813<li>
806<uri>http://marc.theaimsgroup.com/?l=postfix-users</uri> - Postfix mailing lists - searchable</li> 814<uri>http://marc.theaimsgroup.com/?l=postfix-users</uri> - Postfix mailing lists - searchable</li>
807<li> 815<li>
808<uri>http://sourceforge.net/mailarchive/forum.php?forum_id=6705</uri> - Courier-imap mailing list archives - not searchable</li> 816<uri>http://sourceforge.net/mailarchive/forum.php?forum_id=6705</uri> - Courier-imap mailing list archives - not searchable</li>
809<li> 817<li>
810<uri>http://www.google.com/</uri> - If all else fails, there's always google, which has never failed me</li> 818<uri>http://www.google.com/</uri> - If all else fails, there's always google, which has never failed me</li>
811<li>I also spend a lot of time on irc.freenode.net #gentoo. Irc is a great place to go for help.</li> 819<li>I also spend a lot of time on irc.freenode.net #gentoo. Irc is a great place to go for help.</li>
812</ul> 820</ul>
813</p> 821
814</body> 822</body>
815</section> 823</section>
816</chapter> 824</chapter>
817</guide> 825</guide>
818 826

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

  ViewVC Help
Powered by ViewVC 1.1.20