/[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.11 Revision 1.12
31XIV. Wrap Up 31XIV. Wrap Up
32XV. Troubleshooting 32XV. Troubleshooting
33 33
34--><chapter> 34--><chapter>
35<title>Introduction</title> 35<title>Introduction</title>
36<body> 36<body>
37<p>For most gentoo users, a simple mail client and fetchmail will do. However, if you're hosting a domain with your system, you'll need a full blown MTA (Mail Transfer Agent). And if you're hosting multiple domains, then you'll definitely need something more robust to handle all of the email for your users. This system was designed to be an elegant solution to that problem.</p> 37<p>For most gentoo users, a simple mail client and fetchmail will do. However, if you're hosting a domain with your system, you'll need a full blown MTA (Mail Transfer Agent). And if you're hosting multiple domains, then you'll definitely need something more robust to handle all of the email for your users. This system was designed to be an elegant solution to that problem.</p>
38<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> 38<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>
39<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> 39<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>
40<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> 40<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>
41<p>The following packages are used in this setup: 41<p>The following packages are used in this setup:
42 42
43 apache, courier-imap, pam_mysql, postfix, mod_php, mod_ssl, phpmyadmin, squirrelmail, cyrus-sasl, mysql, php, and mailman.</p> 43 apache, courier-imap, pam_mysql, postfix, mod_php, mod_ssl, phpmyadmin, squirrelmail, cyrus-sasl, mysql, php, and mailman.</p>
44<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> 44<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>
45<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> 45<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>
46<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>
46<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> 47<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>
47<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> 48<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>
48<note>It is recommended that you read this entire document and familiarize yourself with all the steps before attempting the install. If you run into problems with any of the steps, check the troubleshooting guide at the end of this document. Also, not all the referenced packages are necessary, this set up is very flexible. For instance, if you do not desire a web interface, feel free to skip the squirrelmail section.</note> 49<note>It is recommended that you read this entire document and familiarize yourself with all the steps before attempting the install. If you run into problems with any of the steps, check the troubleshooting guide at the end of this document. Also, not all the referenced packages are necessary, this set up is very flexible. For instance, if you do not desire a web interface, feel free to skip the squirrelmail section.</note>
49</body> 50</body>
50</chapter> 51</chapter>
51<chapter> 52<chapter>
52<title>Postfix Basics</title> 53<title>Postfix Basics</title>
53<body> 54<body>
54<pre caption="Install postfix" ># <i>emerge postfix</i> 55<pre caption="Install postfix" ># <i>emerge postfix</i>
55</pre> 56</pre>
56<warn>Verify that you have not installed any other MTA, such as ssmtp, exim, or qmail, or you will surely have BIG problems.</warn> 57<warn>Verify that you have not installed any other MTA, such as ssmtp, exim, or qmail, or you will surely have BIG problems.</warn>
57<p>After postfix is installed, it's time to configure it. Change the following options in <path>/etc/postfix/main.cf</path>:</p> 58<p>After postfix is installed, it's time to configure it. Change the following options in <path>/etc/postfix/main.cf</path>:</p>
58<pre caption="/etc/postfix/main.cf" > 59<pre caption="/etc/postfix/main.cf" >
59 myhostname = $host.domain.name 60 myhostname = $host.domain.name
60 mydomain = $domain.name 61 mydomain = $domain.name
543<codenote>I like to add a link to the htdocs space for a shorter url.</codenote> 544<codenote>I like to add a link to the htdocs space for a shorter url.</codenote>
544 545
545 # <i>ln -s /home/httpd/htdocs/squirrelmail/ /home/httpd/htdocs/mail</i> 546 # <i>ln -s /home/httpd/htdocs/squirrelmail/ /home/httpd/htdocs/mail</i>
546 # <i>cd /home/httpd/htdocs/mail/conf</i> 547 # <i>cd /home/httpd/htdocs/mail/conf</i>
547 # <i>./conf.pl</i> 548 # <i>./conf.pl</i>
548<codenote>Change your Organization, Server, and Folder settings for squirrelmail.</codenote> 549<codenote>Change your Organization, Server, and Folder settings for squirrelmail.</codenote>
549<codenote>Now you should be able to login to squirrelmail, again - with your full email address,</codenote> 550<codenote>Now you should be able to login to squirrelmail, again - with your full email address,</codenote>
550<codenote>and use your new webmail setup.</codenote> 551<codenote>and use your new webmail setup.</codenote>
551</pre> 552</pre>
552</body> 553</body>
553</chapter> 554</chapter>
554<chapter> 555<chapter>
555<title>Mailman</title> 556<title>Mailman</title>
556<body> 557<body>
557<p>Last step: mailman. The new version of mailman has very nice virtual domain support, which is why I use it, not to mention it's really a great package. To get this package installed and working correctly for virtual domains is going to require a bit of hacking. I really recommend reading all of the mailman documentation, including README.POSTFIX.gz, to understand what's being done here.</p> 558<p>Last step: mailman. The new version of mailman has very nice virtual domain support, which is why I use it, not to mention it's really a great package. To get this package installed and working correctly for virtual domains is going to require a bit of hacking. I really recommend reading all of the mailman documentation, including README.POSTFIX.gz, to understand what's being done here.</p>
559<p>One further note, current versions of mailman install to /usr/local/mailman. If you're like me and wish to change the default install location, it can be overridden in the ebuild filoe by changing the INSTALLDIR variable.</p>
558<pre caption="/usr/portage/net-mail/mailman/mailman-$ver.ebuild"> 560<pre caption="/usr/portage/net-mail/mailman/mailman-$ver.ebuild">
559 # <i>nano -w /usr/portage/net-mail/mailman/mailman-$ver.ebuild</i> 561 # <i>nano -w /usr/portage/net-mail/mailman/mailman-$ver.ebuild</i>
560 MAILGID="280" 562 MAILGID="280"
561 <codenote>Set MAILGID to the mailman group instead of nobody</codenote> 563 <codenote>Set MAILGID to the mailman group instead of nobody</codenote>
562 <codenote>This is needed for postfix integration</codenote> 564 <codenote>This is needed for postfix integration</codenote>
563</pre> 565</pre>
564<pre> 566<pre>
565 # <i>emerge mailman</i> 567 # <i>emerge mailman</i>
566<codenote>This package is currently masked as well, so you'll need to unmask it or give </codenote> 568<codenote>This package is currently masked as well, so you'll need to unmask it or give </codenote>
567<codenote>emerge an explicit path to the ebuild. Once it's installed, follow the directions</codenote> 569<codenote>emerge an explicit path to the ebuild. Once it's installed, follow the directions</codenote>
568<codenote>in the README.gentoo.gz</codenote> 570<codenote>in the README.gentoo.gz *except* do not add your aliases to /etc/mail/aliases.</codenote>
571<codenote>We will instead be linking the entire alias db into postfix.</codenote>
569 572
570 # <i>zless /usr/share/doc/mailman-$ver/README.gentoo.gz</i> 573 # <i>zless /usr/share/doc/mailman-$ver/README.gentoo.gz</i>
574</pre>
575<pre caption="Setting defaults: Mailman/Defaults.py">
576 # <i> nano -w /var/mailman/Mailman/Defaults.py</i>
577<codenote>Change the values below to reflect your primary domain, virtuals will be set next.</codenote>
578 DEFAULT_EMAIL_HOST = 'domain.com'
579 DEFAULT_URL_HOST = 'www.domain.com'
571</pre> 580</pre>
572<pre caption="mailman config: mm_cfg.py"> 581<pre caption="mailman config: mm_cfg.py">
573 # <i>nano -w /var/mailman/Mailman/mm_cfg.py</i> 582 # <i>nano -w /var/mailman/Mailman/mm_cfg.py</i>
574 MTA = "Postfix" 583 MTA = "Postfix"
575 POSTFIX_STYLE_VIRTUAL_DOMAINS = ['virt-domain.com', 'virt.domain2.com'] 584 POSTFIX_STYLE_VIRTUAL_DOMAINS = ['virt-domain.com', 'virt.domain2.com']
576 add_virtualhost('www.virt.domain.com', 'virt.domain.com') 585 add_virtualhost('www.virt.domain.com', 'virt.domain.com')
577 add_virtualhost('www.virt.domain2.com', 'virt.domain2.com') 586 add_virtualhost('www.virt.domain2.com', 'virt.domain2.com')
578<codenote>This is required for your virtual domains for mailman to function.</codenote> 587<codenote>This is required for your virtual domains for mailman to function.</codenote>
579</pre> 588</pre>
580<pre> 589<pre>
581<codenote>Once that's finished, add your first list.</codenote> 590<codenote>Once that's finished, add your first list.</codenote>
582 591
583 # <i>su mailman</i> 592 # <i>su mailman</i>
584 # <i>cd ~</i> 593 # <i>cd ~</i>
585 # <i>bin/newlist test</i> 594 # <i>bin/newlist test</i>
615<pre caption="Adding mailman alias support to postfix"> 624<pre caption="Adding mailman alias support to postfix">
616 # <i>nano -w /etc/postfix/main.cf</i> 625 # <i>nano -w /etc/postfix/main.cf</i>
617 owner_request_special = no 626 owner_request_special = no
618 recipient_delimiter = + 627 recipient_delimiter = +
619 <codenote>Read README.POSTFIX.gz for details on this</codenote> 628 <codenote>Read README.POSTFIX.gz for details on this</codenote>
620 629
621 alias_maps = 630 alias_maps =
622 hash:/var/mailman/data/aliases, 631 hash:/var/mailman/data/aliases,
623 mysql:/etc/postfix/mysql-aliases.cf 632 mysql:/etc/postfix/mysql-aliases.cf
624 633
625 virtual_alias_maps = 634 virtual_alias_maps =
626 hash:/var/mailman/data/virtual-mailman, 635 hash:/var/mailman/data/virtual-mailman,
627 mysql:/etc/postfix/mysql-virtual.cf 636 mysql:/etc/postfix/mysql-virtual.cf
628 <codenote>This adds mailman alias file support to postfix</codenote> 637 <codenote>This adds mailman alias file support to postfix</codenote>
629 <codenote>You may of course use the mysql tables for this,</codenote> 638 <codenote>You may of course use the mysql tables for this,</codenote>
630 <codenote>but I hate doing that by hand.</codenote> 639 <codenote>but I hate doing that by hand. Also, if you are not</codenote> <codenote>using virtual domains, adding the virtual alias maps</codenote>
640 <codenote>to postfix may cause problems, be warned.</codenote>
631</pre> 641</pre>
632<p> You should now be able to setup mailing lists for any domain on your box. Last note on this, make sure you run all mailman commands as the user mailman (<c>su mailman</c>) or else the permissions will be wrong and you'll have to fix them. Read the mailman doc's for more information on setting up and managing mailman lists.</p> 642<p> You should now be able to setup mailing lists for any domain on your box. Last note on this, make sure you run all mailman commands as the user mailman (<c>su mailman</c>) or else the permissions will be wrong and you'll have to fix them. Read the mailman doc's for more information on setting up and managing mailman lists.</p>
633</body> 643</body>
634</chapter> 644</chapter>
635<chapter> 645<chapter>
636<title>Content Filtering and Anti-Virus</title> 646<title>Content Filtering and Anti-Virus</title>
637<body><p>Coming soon...it would be done already but I need some perl help and testing to make it so. If you'd like to volunteer for that, please email me.</p></body> 647<body><p>Coming soon...it would be done already but I need some perl help and testing to make it so. If you'd like to volunteer for that, please email me.</p></body>
638</chapter> 648</chapter>
639<chapter> 649<chapter>
640<title>Wrap Up</title> 650<title>Wrap Up</title>
641<body> 651<body>
642<p>Ok, you're all set, edit <path>/etc/postfix/master.cf</path> and turn off verbose mode for production use. You'll probably also want to add the services to your startup routine to make sure everything comes back up on a reboot. Make sure to add all the services you're using - apache, mysql, saslauthd, postfix, courier-imapd, courier-imapd-ssl, courier-pop3d, and courier-pop3d-ssl are all up to your decision on what access you want to provide. I generally have all the services enabled.</p> 652<p>Ok, you're all set, edit <path>/etc/postfix/master.cf</path> and turn off verbose mode for production use. You'll probably also want to add the services to your startup routine to make sure everything comes back up on a reboot. Make sure to add all the services you're using - apache, mysql, saslauthd, postfix, courier-imapd, courier-imapd-ssl, courier-pop3d, and courier-pop3d-ssl are all up to your decision on what access you want to provide. I generally have all the services enabled.</p>
643<pre caption="Wrap up" > 653<pre caption="Wrap up" >
644 # <i>postfix reload</i> 654 # <i>postfix reload</i>
645 # <i>rc-update add $service default</i> 655 # <i>rc-update add $service default</i>

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20