| 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.56 2007/07/20 09:09:04 nightmorph Exp $ --> |
2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/virt-mail-howto.xml,v 1.60 2008/09/28 20:29:25 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 | |
| … | |
… | |
| 24 | <abstract> |
24 | <abstract> |
| 25 | This document details how to create a virtual mailhosting system based upon |
25 | This document details how to create a virtual mailhosting system based upon |
| 26 | postfix, mysql, courier-imap, and cyrus-sasl. |
26 | postfix, mysql, courier-imap, and cyrus-sasl. |
| 27 | </abstract> |
27 | </abstract> |
| 28 | |
28 | |
| 29 | <version>1.4</version> |
29 | <version>1.7</version> |
| 30 | <date>2007-07-20</date> |
30 | <date>2008-09-28</date> |
| 31 | |
|
|
| 32 | <!-- |
|
|
| 33 | Contents |
|
|
| 34 | |
|
|
| 35 | I. Introduction |
|
|
| 36 | II. Postfix Basics |
|
|
| 37 | III. Courier-imap |
|
|
| 38 | IV. Cyrus-sasl |
|
|
| 39 | V. SSL Certificates for Postfix and Apache |
|
|
| 40 | VI. Adding SSL and SASL support to Postfix |
|
|
| 41 | VII. MySQL |
|
|
| 42 | VIII. Apache and phpMyAdmin |
|
|
| 43 | IX. The vmail user |
|
|
| 44 | X. Configuring MySQL Authentication and vhosts |
|
|
| 45 | XI. Squirrelmail |
|
|
| 46 | XII. Mailman |
|
|
| 47 | XIII. Content Filtering and Anti-Virus |
|
|
| 48 | XIV. Wrap Up |
|
|
| 49 | XV. Troubleshooting |
|
|
| 50 | --> |
|
|
| 51 | |
31 | |
| 52 | <chapter> |
32 | <chapter> |
| 53 | <title>Introduction</title> |
33 | <title>Introduction</title> |
| 54 | <section> |
34 | <section> |
| 55 | <body> |
35 | <body> |
| … | |
… | |
| 88 | needs. Consider investigating <uri>http://www.qmail.org/</uri> and |
68 | needs. Consider investigating <uri>http://www.qmail.org/</uri> and |
| 89 | <uri>http://www.exim.org/</uri> to explore your options. |
69 | <uri>http://www.exim.org/</uri> to explore your options. |
| 90 | </p> |
70 | </p> |
| 91 | |
71 | |
| 92 | <p> |
72 | <p> |
| 93 | The following packages are used in this setup: apache, courier-imap, courier-authlib |
73 | The following packages are used in this setup: apache, courier-imap, |
| 94 | postfix, mod_php, phpmyadmin, squirrelmail, cyrus-sasl, mysql, php, and |
74 | courier-authlib postfix, mod_php, phpmyadmin, squirrelmail, cyrus-sasl, mysql, |
| 95 | mailman. |
75 | php, and mailman. |
| 96 | </p> |
76 | </p> |
| 97 | |
77 | |
| 98 | <p> |
78 | <p> |
| 99 | Make sure to turn on the following USE variables in <path>/etc/make.conf</path> |
79 | Make sure to turn on the following USE variables in <path>/etc/make.conf</path> |
| 100 | before compiling the packages: <c>USE="mysql imap libwww maildir |
80 | before compiling the packages: <c>USE="mysql imap libwww maildir |
| … | |
… | |
| 182 | |
162 | |
| 183 | <pre caption="Starting postfix for the first time"> |
163 | <pre caption="Starting postfix for the first time"> |
| 184 | # <i>/usr/bin/newaliases</i> |
164 | # <i>/usr/bin/newaliases</i> |
| 185 | <comment>(This will install the new aliases. You only need to do this |
165 | <comment>(This will install the new aliases. You only need to do this |
| 186 | when you update or install aliases.)</comment> |
166 | when you update or install aliases.)</comment> |
| 187 | |
167 | |
| 188 | # <i>/etc/init.d/postfix start</i> |
168 | # <i>/etc/init.d/postfix start</i> |
| 189 | </pre> |
169 | </pre> |
| 190 | |
170 | |
| 191 | <p> |
171 | <p> |
| 192 | Now that postfix is running, fire up your favorite console mail client and send |
172 | Now that postfix is running, fire up your favorite console mail client and send |
| … | |
… | |
| 256 | <section> |
236 | <section> |
| 257 | <body> |
237 | <body> |
| 258 | |
238 | |
| 259 | <p> |
239 | <p> |
| 260 | Next we're going to install cyrus-sasl. Sasl is going to play the role of |
240 | Next we're going to install cyrus-sasl. Sasl is going to play the role of |
| 261 | actually passing your auth variables to courier-auth, which will in turn pass that |
241 | actually passing your auth variables to courier-auth, which will in turn pass |
| 262 | information to mysql for authentication of smtp users. For this howto, we'll |
242 | that information to mysql for authentication of smtp users. For this howto, |
| 263 | not even try to verify that sasl is working until mysql is set up and contains |
243 | we'll not even try to verify that sasl is working until mysql is set up and |
| 264 | a test user. Which is fine since we'll be authenticating against mysql in the |
244 | contains a test user. Which is fine since we'll be authenticating against |
| 265 | end anyway. |
245 | mysql in the end anyway. |
| 266 | </p> |
246 | </p> |
| 267 | |
247 | |
| 268 | <pre caption="Configuring and installing the cyrus-sasl ebuild"> |
248 | <pre caption="Configuring and installing the cyrus-sasl ebuild"> |
| 269 | # <i>emerge cyrus-sasl</i> |
249 | # <i>emerge cyrus-sasl</i> |
| 270 | </pre> |
250 | </pre> |
| … | |
… | |
| 356 | smtpd_sasl_local_domain appends a domain name to clients using |
336 | smtpd_sasl_local_domain appends a domain name to clients using |
| 357 | smtp-auth. Make sure it's blank or your user names will get |
337 | smtp-auth. Make sure it's blank or your user names will get |
| 358 | mangled by postfix and be unable to auth.)</comment> |
338 | mangled by postfix and be unable to auth.)</comment> |
| 359 | |
339 | |
| 360 | smtpd_recipient_restrictions = |
340 | smtpd_recipient_restrictions = |
| 361 | permit_sasl_authenticated, |
341 | permit_sasl_authenticated, |
| 362 | permit_mynetworks, |
342 | permit_mynetworks, |
| 363 | reject_unauth_destination |
343 | reject_unauth_destination |
| 364 | |
|
|
| 365 | |
344 | |
| 366 | <comment>(The next two options enable outgoing encryption.)</comment> |
345 | <comment>(The next two options enable outgoing encryption.)</comment> |
| 367 | smtp_use_tls = yes |
346 | smtp_use_tls = yes |
| 368 | smtp_tls_note_starttls_offer = yes |
347 | smtp_tls_note_starttls_offer = yes |
| 369 | smtpd_use_tls = yes |
348 | smtpd_use_tls = yes |
| … | |
… | |
| 382 | # <i>postfix reload</i> |
361 | # <i>postfix reload</i> |
| 383 | </pre> |
362 | </pre> |
| 384 | |
363 | |
| 385 | <p> |
364 | <p> |
| 386 | Now we're going to verify that the config's we added were picked up by postfix. |
365 | Now we're going to verify that the config's we added were picked up by postfix. |
|
|
366 | For this we are going to use <c>telnet</c> (provided by for instance |
|
|
367 | <c>net-misc/netkit-telnetd</c>) although you can also use <c>nc</c> (provided by |
|
|
368 | <c>net-analyzer/netcat</c>): |
| 387 | </p> |
369 | </p> |
| 388 | |
370 | |
| 389 | <pre caption="Verifying sasl and tls support"> |
371 | <pre caption="Verifying sasl and tls support"> |
| 390 | # <i>telnet localhost 25</i> |
372 | # <i>telnet localhost 25</i> |
| 391 | |
373 | |
| … | |
… | |
| 419 | </body> |
401 | </body> |
| 420 | </section> |
402 | </section> |
| 421 | </chapter> |
403 | </chapter> |
| 422 | |
404 | |
| 423 | <chapter> |
405 | <chapter> |
|
|
406 | <title>The vmail user</title> |
|
|
407 | <section> |
|
|
408 | <body> |
|
|
409 | |
|
|
410 | <p> |
|
|
411 | Before we set up our virtual mailhosting environment, we create a functional |
|
|
412 | user under which the virtual mailboxes will be hosted. For clarity's sake we |
|
|
413 | will call this <e>vmail</e>: |
|
|
414 | </p> |
|
|
415 | |
|
|
416 | <pre caption="Adding the vmail user"> |
|
|
417 | # <i>adduser -d /home/vmail -s /bin/false -m vmail</i> |
|
|
418 | </pre> |
|
|
419 | |
|
|
420 | <p> |
|
|
421 | So now you've set up the vmail account. You can create multiple accounts if you |
|
|
422 | want (to keep some structure in your set of virtual mail accounts). The user id, |
|
|
423 | group id and home dirs are referenced in the MySQL tables. |
|
|
424 | </p> |
|
|
425 | |
|
|
426 | <p> |
|
|
427 | Next to the user account we also need to create the location where the mailboxes |
|
|
428 | will reside: |
|
|
429 | </p> |
|
|
430 | |
|
|
431 | <pre caption="Creating mailboxes"> |
|
|
432 | # <i>mkdir -p /home/vmail/virt-domain.com/foo</i> |
|
|
433 | # <i>chown -R vmail:vmail /home/vmail/virt-domain.com</i> |
|
|
434 | # <i>maildirmake /home/vmail/virt-domain.com/foo/.maildir</i> |
|
|
435 | </pre> |
|
|
436 | |
|
|
437 | </body> |
|
|
438 | </section> |
|
|
439 | </chapter> |
|
|
440 | |
|
|
441 | <chapter> |
| 424 | <title>MySQL</title> |
442 | <title>MySQL</title> |
| 425 | <section> |
443 | <section> |
| 426 | <body> |
444 | <body> |
| 427 | |
445 | |
| 428 | <p> |
446 | <p> |
| … | |
… | |
| 434 | <pre caption="Installing and configuring MySQL"> |
452 | <pre caption="Installing and configuring MySQL"> |
| 435 | # <i>emerge mysql</i> |
453 | # <i>emerge mysql</i> |
| 436 | |
454 | |
| 437 | # <i>/usr/bin/mysql_install_db</i> |
455 | # <i>/usr/bin/mysql_install_db</i> |
| 438 | <comment>(After this command runs follow the onscreen directions |
456 | <comment>(After this command runs follow the onscreen directions |
| 439 | for adding a root password with mysql, |
457 | for adding a root password with mysql, otherwise your db will |
| 440 | not mysqladmin, otherwise your db will be wide open.)</comment> |
458 | be wide open.)</comment> |
| 441 | |
459 | |
| 442 | # <i>/etc/init.d/mysql start</i> |
460 | # <i>/etc/init.d/mysql start</i> |
| 443 | # <i>mysqladmin -u root -p create mailsql</i> |
461 | # <i>mysqladmin -u root -p create mailsql</i> |
| 444 | # <i>mysql -u root -p mailsql < genericmailsql.sql</i> |
462 | # <i>mysql -u root -p mailsql < genericmailsql.sql</i> |
| 445 | |
|
|
| 446 | # <i>mysql -u root -p mysql</i> |
463 | # <i>mysql -u root -p mysql</i> |
| 447 | mysql> <i>GRANT SELECT,INSERT,UPDATE,DELETE</i> |
464 | mysql> <i>GRANT SELECT,INSERT,UPDATE,DELETE</i> |
| 448 | -> <i>ON mailsql.*</i> |
465 | -> <i>ON mailsql.*</i> |
| 449 | -> <i>TO mailsql@localhost</i> |
466 | -> <i>TO mailsql@localhost</i> |
| 450 | -> <i>IDENTIFIED BY '$password';</i> |
467 | -> <i>IDENTIFIED BY '$password';</i> |
| 451 | Query OK, 0 rows affected (0.02 sec) |
468 | Query OK, 0 rows affected (0.02 sec) |
| 452 | |
469 | |
| 453 | mysql> <i>FLUSH PRIVILEGES;</i> |
470 | mysql> <i>FLUSH PRIVILEGES;</i> |
| 454 | Query OK, 0 rows affected (0.00 sec) |
471 | Query OK, 0 rows affected (0.00 sec) |
| 455 | |
472 | |
| … | |
… | |
| 474 | <li>users - all user account information</li> |
491 | <li>users - all user account information</li> |
| 475 | <li>virtual - virtual domain email alias maps</li> |
492 | <li>virtual - virtual domain email alias maps</li> |
| 476 | </ul> |
493 | </ul> |
| 477 | |
494 | |
| 478 | <pre caption="alias table sample"> |
495 | <pre caption="alias table sample"> |
| 479 | id alias destination |
496 | id alias destination |
| 480 | 1 root foo@bar.com |
497 | 1 root foo@bar.com |
| 481 | 2 postmaster foo@bar.com |
498 | 2 postmaster foo@bar.com |
| 482 | </pre> |
499 | </pre> |
| 483 | |
500 | |
| 484 | <pre caption="user table sample"> |
501 | <pre caption="user table sample"> |
| 485 | <comment>(Line wrapped for clarity.)</comment> |
502 | <comment>(Line wrapped for clarity.)</comment> |
| 486 | id email clear name uid gid homedir \ |
503 | id email clear name uid gid homedir \ |
| 487 | maildir quota postfix |
504 | maildir quota postfix |
| 488 | 10 foo@virt-bar.org $password realname virtid virtid /home/vmail \ |
505 | 10 foo@virt-domain.com $password realname virtid virtid /home/vmail \ |
| 489 | /home/vmail/virt-bar.org/foo/.maildir/ y |
506 | /home/vmail/virt-domain.com/foo/.maildir/ y |
| 490 | 13 foo@bar.com $password realname localid localid /home/foo \ |
507 | 13 foo@bar.com $password realname localid localid /home/foo \ |
| 491 | /home/foo/.maildir/ y |
508 | /home/foo/.maildir/ y |
| 492 | </pre> |
509 | </pre> |
| 493 | |
510 | |
| 494 | <p> |
511 | <p> |
| 495 | The values of the <c>virtid</c> uid and gid should be those of the <c>vmail</c> |
512 | The values of the <c>virtid</c> uid and gid should be those of the <c>vmail</c> |
| 496 | user and group. |
513 | user and group. |
| 497 | </p> |
514 | </p> |
| 498 | |
515 | |
| 499 | <pre caption="transport table sample"> |
516 | <pre caption="transport table sample"> |
| 500 | id domain destination |
517 | id domain destination |
| 501 | 1 bar.com local: |
518 | 1 bar.com local: |
| 502 | 2 virt-bar.org virtual: |
519 | 2 virt-domain.com virtual: |
| 503 | </pre> |
520 | </pre> |
| 504 | |
521 | |
| 505 | <pre caption="virtual table sample"> |
522 | <pre caption="virtual table sample"> |
| 506 | id email destination |
523 | id email destination |
| 507 | 3 root@virt-bar.org other@email.address |
524 | 3 root@virt-domain.com other@email.address |
| 508 | </pre> |
525 | </pre> |
| 509 | |
526 | |
| 510 | </body> |
527 | </body> |
| 511 | </section> |
528 | </section> |
| 512 | </chapter> |
529 | </chapter> |
| … | |
… | |
| 552 | |
569 | |
| 553 | <pre caption="Install Apache SSL certificates"> |
570 | <pre caption="Install Apache SSL certificates"> |
| 554 | # <i>cp /etc/ssl/misc/new.cert.cert /etc/apache2/ssl/</i> |
571 | # <i>cp /etc/ssl/misc/new.cert.cert /etc/apache2/ssl/</i> |
| 555 | # <i>cp /etc/ssl/misc/new.cert.key /etc/apache2/ssl/</i> |
572 | # <i>cp /etc/ssl/misc/new.cert.key /etc/apache2/ssl/</i> |
| 556 | # <i>cd /etc/apache2/vhosts.d</i> |
573 | # <i>cd /etc/apache2/vhosts.d</i> |
| 557 | <comment>(Check if you have an ssl-vhost template already. |
574 | <comment>(Check if you have an ssl-vhost template already. |
| 558 | Copy that one instead of the default_vhost if that is the case)</comment> |
575 | Copy that one instead of the default_vhost if that is the case)</comment> |
| 559 | # <i>cp 00_default_vhost.conf ssl-vhost.conf</i> |
576 | # <i>cp 00_default_vhost.conf ssl-vhost.conf</i> |
| 560 | # <i>nano -w ssl-vhost.conf</i> |
577 | # <i>nano -w ssl-vhost.conf</i> |
| 561 | |
578 | |
| 562 | <comment>(Change the following parameters)</comment> |
579 | <comment>(Change the following parameters)</comment> |
| … | |
… | |
| 612 | accurate. For instance, make sure the local user's home dir exists and that the |
629 | accurate. For instance, make sure the local user's home dir exists and that the |
| 613 | correct uid/gid values are in place. The maildirs should be created |
630 | correct uid/gid values are in place. The maildirs should be created |
| 614 | automatically by postfix when the user receives their first email. So, in |
631 | automatically by postfix when the user receives their first email. So, in |
| 615 | general, it's a good idea to send a "Welcome" mail to a new user after you |
632 | general, it's a good idea to send a "Welcome" mail to a new user after you |
| 616 | setup their account to make sure the .maildir gets created. |
633 | setup their account to make sure the .maildir gets created. |
| 617 | </p> |
|
|
| 618 | |
|
|
| 619 | </body> |
|
|
| 620 | </section> |
|
|
| 621 | </chapter> |
|
|
| 622 | |
|
|
| 623 | <chapter> |
|
|
| 624 | <title>The vmail user</title> |
|
|
| 625 | <section> |
|
|
| 626 | <body> |
|
|
| 627 | |
|
|
| 628 | <p> |
|
|
| 629 | At this point you may be wondering what user and directory to use for virtual |
|
|
| 630 | mail users, and rightly so. Let's set that up. |
|
|
| 631 | </p> |
|
|
| 632 | |
|
|
| 633 | <pre caption="Adding the vmail user"> |
|
|
| 634 | # <i>adduser -d /home/vmail -s /bin/false -m vmail</i> |
|
|
| 635 | </pre> |
|
|
| 636 | |
|
|
| 637 | <p> |
|
|
| 638 | So now you've set up the vmail account. You can create multiple accounts if you |
|
|
| 639 | want (to keep some structure in your set of virtual mail accounts). The user id, |
|
|
| 640 | group id and home dirs are referenced in the MySQL tables. |
|
|
| 641 | </p> |
634 | </p> |
| 642 | |
635 | |
| 643 | </body> |
636 | </body> |
| 644 | </section> |
637 | </section> |
| 645 | </chapter> |
638 | </chapter> |
| … | |
… | |
| 688 | |
681 | |
| 689 | <pre caption="/etc/postfix/mysql-aliases.cf"> |
682 | <pre caption="/etc/postfix/mysql-aliases.cf"> |
| 690 | # <i>nano -w /etc/postfix/mysql-aliases.cf</i> |
683 | # <i>nano -w /etc/postfix/mysql-aliases.cf</i> |
| 691 | # mysql-aliases.cf |
684 | # mysql-aliases.cf |
| 692 | |
685 | |
| 693 | user = mailsql |
686 | user = mailsql |
| 694 | password = $password |
687 | password = $password |
| 695 | dbname = mailsql |
688 | dbname = mailsql |
| 696 | table = alias |
689 | table = alias |
| 697 | select_field = destination |
690 | select_field = destination |
| 698 | where_field = alias |
691 | where_field = alias |
| 699 | hosts = unix:/var/run/mysqld/mysqld.sock |
692 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 700 | </pre> |
693 | </pre> |
| 701 | |
694 | |
| 702 | <pre caption="/etc/postfix/mysql-relocated.cf"> |
695 | <pre caption="/etc/postfix/mysql-relocated.cf"> |
| 703 | # <i>nano -w /etc/postfix/mysql-relocated.cf</i> |
696 | # <i>nano -w /etc/postfix/mysql-relocated.cf</i> |
| 704 | # mysql-relocated.cf |
697 | # mysql-relocated.cf |
| 705 | |
698 | |
| 706 | user = mailsql |
699 | user = mailsql |
| 707 | password = $password |
700 | password = $password |
| 708 | dbname = mailsql |
701 | dbname = mailsql |
| 709 | table = relocated |
702 | table = relocated |
| 710 | select_field = destination |
703 | select_field = destination |
| 711 | where_field = email |
704 | where_field = email |
| 712 | hosts = unix:/var/run/mysqld/mysqld.sock |
705 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 713 | </pre> |
706 | </pre> |
| 714 | |
707 | |
| 715 | <pre caption="/etc/postfix/mysql-transport.cf (optional)"> |
708 | <pre caption="/etc/postfix/mysql-transport.cf (optional)"> |
| 716 | # <i>nano -w /etc/postfix/mysql-transport.cf</i> |
709 | # <i>nano -w /etc/postfix/mysql-transport.cf</i> |
| 717 | # mysql-transport.cf |
710 | # mysql-transport.cf |
| 718 | |
711 | |
| 719 | user = mailsql |
712 | user = mailsql |
| 720 | password = $password |
713 | password = $password |
| 721 | dbname = mailsql |
714 | dbname = mailsql |
| 722 | table = transport |
715 | table = transport |
| 723 | select_field = destination |
716 | select_field = destination |
| 724 | where_field = domain |
717 | where_field = domain |
| 725 | hosts = unix:/var/run/mysqld/mysqld.sock |
718 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 726 | </pre> |
719 | </pre> |
| 727 | |
720 | |
| 728 | <pre caption="/etc/postfix/mysql-virtual-gid.cf (optional)"> |
721 | <pre caption="/etc/postfix/mysql-virtual-gid.cf (optional)"> |
| 729 | # <i>nano -w /etc/postfix/mysql-virtual-gid.cf</i> |
722 | # <i>nano -w /etc/postfix/mysql-virtual-gid.cf</i> |
| 730 | # mysql-virtual-gid.cf |
723 | # mysql-virtual-gid.cf |
| 731 | |
724 | |
| 732 | user = mailsql |
725 | user = mailsql |
| 733 | password = $password |
726 | password = $password |
| 734 | dbname = mailsql |
727 | dbname = mailsql |
| 735 | table = users |
728 | table = users |
| 736 | select_field = gid |
729 | select_field = gid |
| 737 | where_field = email |
730 | where_field = email |
| 738 | additional_conditions = and postfix = 'y' |
731 | additional_conditions = and postfix = 'y' |
| 739 | hosts = unix:/var/run/mysqld/mysqld.sock |
732 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 740 | </pre> |
733 | </pre> |
| 741 | |
734 | |
| 742 | <pre caption="/etc/postfix/mysql-virtual-maps.cf"> |
735 | <pre caption="/etc/postfix/mysql-virtual-maps.cf"> |
| 743 | # <i>nano -w /etc/postfix/mysql-virtual-maps.cf</i> |
736 | # <i>nano -w /etc/postfix/mysql-virtual-maps.cf</i> |
| 744 | #myql-virtual-maps.cf |
737 | # mysql-virtual-maps.cf |
| 745 | |
738 | |
| 746 | user = mailsql |
739 | user = mailsql |
| 747 | password = $password |
740 | password = $password |
| 748 | dbname = mailsql |
741 | dbname = mailsql |
| 749 | table = users |
742 | table = users |
| 750 | select_field = maildir |
743 | select_field = maildir |
| 751 | where_field = email |
744 | where_field = email |
| 752 | additional_conditions = and postfix = 'y' |
745 | additional_conditions = and postfix = 'y' |
| 753 | hosts = unix:/var/run/mysqld/mysqld.sock |
746 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 754 | </pre> |
747 | </pre> |
| 755 | |
748 | |
| 756 | <pre caption="/etc/postfix/mysql-virtual-uid.cf (optional)"> |
749 | <pre caption="/etc/postfix/mysql-virtual-uid.cf (optional)"> |
| … | |
… | |
| 760 | user = mailsql |
753 | user = mailsql |
| 761 | password = $password |
754 | password = $password |
| 762 | dbname = mailsql |
755 | dbname = mailsql |
| 763 | table = users |
756 | table = users |
| 764 | select_field = uid |
757 | select_field = uid |
| 765 | where_field = email |
758 | where_field = email |
| 766 | additional_conditions = and postfix = 'y' |
759 | additional_conditions = and postfix = 'y' |
| 767 | hosts = unix:/var/run/mysqld/mysqld.sock |
760 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 768 | </pre> |
761 | </pre> |
| 769 | |
762 | |
| 770 | <pre caption="/etc/postfix/mysql-virtual.cf"> |
763 | <pre caption="/etc/postfix/mysql-virtual.cf"> |
| 771 | # <i>nano -w /etc/postfix/mysql-virtual.cf</i> |
764 | # <i>nano -w /etc/postfix/mysql-virtual.cf</i> |
| 772 | # mysql-virtual.cf |
765 | # mysql-virtual.cf |
| 773 | |
766 | |
| 774 | user = mailsql |
767 | user = mailsql |
| 775 | password = $password |
768 | password = $password |
| 776 | dbname = mailsql |
769 | dbname = mailsql |
| 777 | table = virtual |
770 | table = virtual |
| 778 | select_field = destination |
771 | select_field = destination |
| 779 | where_field = email |
772 | where_field = email |
| 780 | hosts = unix:/var/run/mysqld/mysqld.sock |
773 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 781 | </pre> |
774 | </pre> |
| 782 | |
775 | |
| 783 | <p> |
776 | <p> |
| 784 | Lastly, edit <path>/etc/postfix/main.cf</path> one more time. |
777 | Lastly, edit <path>/etc/postfix/main.cf</path> one more time. |
| 785 | </p> |
778 | </p> |
| … | |
… | |
| 792 | |
785 | |
| 793 | local_transport = local |
786 | local_transport = local |
| 794 | local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname |
787 | local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname |
| 795 | |
788 | |
| 796 | virtual_transport = virtual |
789 | virtual_transport = virtual |
| 797 | <comment>(The domains listed by the mydestination should not be listed in |
790 | <comment>(The domains listed by the mydestination should not be listed in |
| 798 | the virtual_mailbox_domains parameter)</comment> |
791 | the virtual_mailbox_domains parameter)</comment> |
| 799 | virtual_mailbox_domains = virt-bar.com, $other-virtual-domain.com |
792 | virtual_mailbox_domains = virt-domain.com, $other-virtual-domain.com |
| 800 | |
793 | |
| 801 | virtual_minimum_uid = 1000 |
794 | virtual_minimum_uid = 1000 |
| 802 | <comment>(Substitute $vmail-gid with the GID of the vmail group)</comment> |
795 | <comment>(Substitute $vmail-gid with the GID of the vmail group)</comment> |
| 803 | virtual_gid_maps = static:$vmail-gid |
796 | virtual_gid_maps = static:$vmail-gid |
| 804 | virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf |
797 | virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf |
| … | |
… | |
| 895 | </pre> |
888 | </pre> |
| 896 | |
889 | |
| 897 | <pre caption="mailman config: mm_cfg.py"> |
890 | <pre caption="mailman config: mm_cfg.py"> |
| 898 | # <i>nano -w /usr/local/mailman/Mailman/mm_cfg.py</i> |
891 | # <i>nano -w /usr/local/mailman/Mailman/mm_cfg.py</i> |
| 899 | MTA = "Postfix" |
892 | MTA = "Postfix" |
| 900 | POSTFIX_STYLE_VIRTUAL_DOMAINS = ['virt-domain.com', 'virt.domain2.com'] |
893 | POSTFIX_STYLE_VIRTUAL_DOMAINS = ['virt-domain.com', 'virt.domain2.com'] |
| 901 | add_virtualhost('www.virt.domain.com', 'virt.domain.com') |
894 | add_virtualhost('www.virt.domain.com', 'virt.domain.com') |
| 902 | add_virtualhost('www.virt.domain2.com', 'virt.domain2.com') |
895 | add_virtualhost('www.virt.domain2.com', 'virt.domain2.com') |
| 903 | <comment>(This is required for your virtual domains for mailman to function.)</comment> |
896 | <comment>(This is required for your virtual domains for mailman to function.)</comment> |
| 904 | </pre> |
897 | </pre> |
| 905 | |
898 | |
| 906 | <pre caption="And last but not least"> |
899 | <pre caption="And last but not least"> |
| 907 | <comment>(Once that's finished, add your first list.)</comment> |
900 | <comment>(Once that's finished, add your first list.)</comment> |
| 908 | |
901 | |
| 909 | # <i>su mailman</i> |
902 | # <i>su mailman</i> |
| 910 | # <i>cd ~</i> |
903 | # <i>cd ~</i> |
| 911 | # <i>./bin/newlist test</i> |
904 | # <i>./bin/newlist --urlhost='www.virt-domain.com' --emailhost='virt-domain.com' test</i> |
| 912 | Enter the email of the person running the list: <i>your@email.address</i> |
905 | Enter the email of the person running the list: <i>your@email.address</i> |
| 913 | Initial test password: |
906 | Initial test password: |
| 914 | Hit enter to continue with test owner notification... |
907 | Hit enter to continue with test owner notification... |
| 915 | <comment>(Virtual domain lists may be specified with |
908 | <comment>(Virtual domain lists may also be specified with |
| 916 | list@domain.com style list names.)</comment> |
909 | list@domain.com style list names.)</comment> |
| 917 | # <i>./bin/genaliases</i> |
910 | # <i>./bin/genaliases</i> |
| 918 | <comment>(Now that your aliases have been generated, |
911 | <comment>(Now that your aliases have been generated, |
| 919 | verify that they were added successfully.)</comment> |
912 | verify that they were added successfully.)</comment> |
| 920 | |
913 | |
| 921 | # <i>nano -w data/aliases</i> |
914 | # <i>nano -w data/aliases</i> |
| 922 | # STANZA START: test |
915 | # STANZA START: test |
| 923 | # CREATED: |
916 | # CREATED: |
| 924 | test: "|/var/mailman/mail/mailman post test" |
917 | test: "|/usr/local/mailman/mail/mailman post test" |
| 925 | test-admin: "|/var/mailman/mail/mailman admin test" |
918 | test-admin: "|/usr/local/mailman/mail/mailman admin test" |
| 926 | test-bounces: "|/var/mailman/mail/mailman bounces test" |
919 | test-bounces: "|/usr/local/mailman/mail/mailman bounces test" |
| 927 | test-confirm: "|/var/mailman/mail/mailman confirm test" |
920 | test-confirm: "|/usr/local/mailman/mail/mailman confirm test" |
| 928 | test-join: "|/var/mailman/mail/mailman join test" |
921 | test-join: "|/usr/local/mailman/mail/mailman join test" |
| 929 | test-leave: "|/var/mailman/mail/mailman leave test" |
922 | test-leave: "|/usr/local/mailman/mail/mailman leave test" |
| 930 | test-owner: "|/var/mailman/mail/mailman owner test" |
923 | test-owner: "|/usr/local/mailman/mail/mailman owner test" |
| 931 | test-request: "|/var/mailman/mail/mailman request test" |
924 | test-request: "|/usr/local/mailman/mail/mailman request test" |
| 932 | test-subscribe: "|/var/mailman/mail/mailman subscribe test" |
925 | test-subscribe: "|/usr/local/mailman/mail/mailman subscribe test" |
| 933 | test-unsubscribe: "|/var/mailman/mail/mailman unsubscribe test" |
926 | test-unsubscribe: "|/usr/local/mailman/mail/mailman unsubscribe test" |
| 934 | # STANZA END: test |
927 | # STANZA END: test |
| 935 | |
928 | |
| 936 | <comment>(Create the required mailman list)</comment> |
929 | <comment>(Create the required mailman list)</comment> |
| 937 | # <i>./bin/newlist mailman</i> |
930 | # <i>./bin/newlist mailman</i> |
| 938 | # <i>./bin/genaliases</i> |
931 | # <i>./bin/genaliases</i> |
| … | |
… | |
| 950 | owner_request_special = no |
943 | owner_request_special = no |
| 951 | recipient_delimiter = + |
944 | recipient_delimiter = + |
| 952 | <comment>(Read README.POSTFIX.gz for details on this.)</comment> |
945 | <comment>(Read README.POSTFIX.gz for details on this.)</comment> |
| 953 | |
946 | |
| 954 | alias_maps = |
947 | alias_maps = |
| 955 | hash:/usr/local/mailman/data/aliases, |
948 | hash:/usr/local/mailman/data/aliases, |
| 956 | mysql:/etc/postfix/mysql-aliases.cf |
949 | mysql:/etc/postfix/mysql-aliases.cf |
| 957 | |
950 | |
| 958 | virtual_alias_maps = |
951 | virtual_alias_maps = |
| 959 | hash:/usr/local/mailman/data/virtual-mailman, |
952 | hash:/usr/local/mailman/data/virtual-mailman, |
| 960 | mysql:/etc/postfix/mysql-virtual.cf |
953 | mysql:/etc/postfix/mysql-virtual.cf |
| 961 | <comment>(This adds mailman alias file support to postfix |
954 | <comment>(This adds mailman alias file support to postfix |
| 962 | You may of course use the mysql tables for this, |
955 | You may of course use the mysql tables for this, |
| 963 | but I hate doing that by hand. Also, if you are not |
956 | but I hate doing that by hand. Also, if you are not |
| 964 | using virtual domains, adding the virtual alias maps |
957 | using virtual domains, adding the virtual alias maps |
| 965 | to postfix may cause problems, be warned.)</comment> |
958 | to postfix may cause problems, be warned.)</comment> |
| … | |
… | |
| 1203 | <li> |
1196 | <li> |
| 1204 | <uri>http://www.google.com/</uri> - If all else fails, there's always |
1197 | <uri>http://www.google.com/</uri> - If all else fails, there's always |
| 1205 | google, which has never failed me |
1198 | google, which has never failed me |
| 1206 | </li> |
1199 | </li> |
| 1207 | <li> |
1200 | <li> |
| 1208 | I also spend a lot of time on irc.freenode.net #gentoo. Irc is a great |
1201 | I also spend a lot of time on <uri |
| 1209 | place to go for help. |
1202 | link="irc://irc.gentoo.org/gentoo">#gentoo</uri>. IRC is a great place to go |
|
|
1203 | for help. |
| 1210 | </li> |
1204 | </li> |
| 1211 | </ul> |
1205 | </ul> |
| 1212 | |
1206 | |
| 1213 | </body> |
1207 | </body> |
| 1214 | </section> |
1208 | </section> |