| 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.50 2006/04/09 07:42:45 fox2mike Exp $ --> |
|
|
| 3 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
2 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
|
|
3 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/virt-mail-howto.xml,v 1.64 2012/07/24 12:12:51 swift Exp $ --> |
| 4 | |
4 | |
| 5 | <guide link="/doc/en/virt-mail-howto.xml"> |
5 | <guide> |
| 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> |
| … | |
… | |
| 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 | <author title="Editor"> |
|
|
21 | <mail link="swift@gentoo.org">Sven Vermeulen</mail> |
|
|
22 | </author> |
|
|
23 | <author title="Editor"> |
|
|
24 | <mail link="nightmorph"/> |
|
|
25 | </author> |
| 20 | |
26 | |
| 21 | <abstract> |
27 | <abstract> |
| 22 | This document details how to create a virtual mailhosting system based upon |
28 | This document details how to create a virtual mailhosting system based upon |
| 23 | postfix, mysql, courier-imap, and cyrus-sasl. |
29 | postfix, mysql, courier-imap, and cyrus-sasl. |
| 24 | </abstract> |
30 | </abstract> |
| 25 | |
31 | |
| 26 | <version>1.0.27</version> |
32 | <version>4</version> |
| 27 | <date>2006-04-09</date> |
33 | <date>2012-07-24</date> |
| 28 | |
|
|
| 29 | <!-- |
|
|
| 30 | Contents |
|
|
| 31 | |
|
|
| 32 | I. Introduction |
|
|
| 33 | II. Postfix Basics |
|
|
| 34 | III. Courier-imap |
|
|
| 35 | IV. Cyrus-sasl |
|
|
| 36 | V. SSL Certificates for Postfix and Apache |
|
|
| 37 | VI. Adding SSL and SASL support to Postfix |
|
|
| 38 | VII. MySQL |
|
|
| 39 | VIII. Apache and phpMyAdmin |
|
|
| 40 | IX. The vmail user |
|
|
| 41 | X. Configuring MySQL Authentication and vhosts |
|
|
| 42 | XI. Squirrelmail |
|
|
| 43 | XII. Mailman |
|
|
| 44 | XIII. Content Filtering and Anti-Virus |
|
|
| 45 | XIV. Wrap Up |
|
|
| 46 | XV. Troubleshooting |
|
|
| 47 | --> |
|
|
| 48 | |
34 | |
| 49 | <chapter> |
35 | <chapter> |
| 50 | <title>Introduction</title> |
36 | <title>Introduction</title> |
| 51 | <section> |
37 | <section> |
| 52 | <body> |
38 | <body> |
| 53 | |
39 | |
| 54 | <p> |
40 | <p> |
| 55 | For most gentoo users, a simple mail client and fetchmail will do. However, if |
41 | For most Gentoo users, a simple mail client and fetchmail will do. However, if |
| 56 | you're hosting a domain with your system, you'll need a full blown MTA (Mail |
42 | you're hosting a domain with your system, you'll need a full blown MTA (Mail |
| 57 | Transfer Agent). And if you're hosting multiple domains, then you'll definitely |
43 | Transfer Agent). And if you're hosting multiple domains, then you'll definitely |
| 58 | need something more robust to handle all of the email for your users. This |
44 | need something more robust to handle all of the email for your users. This |
| 59 | system was designed to be an elegant solution to that problem. |
45 | system was designed to be an elegant solution to that problem. |
| 60 | </p> |
46 | </p> |
| … | |
… | |
| 85 | needs. Consider investigating <uri>http://www.qmail.org/</uri> and |
71 | needs. Consider investigating <uri>http://www.qmail.org/</uri> and |
| 86 | <uri>http://www.exim.org/</uri> to explore your options. |
72 | <uri>http://www.exim.org/</uri> to explore your options. |
| 87 | </p> |
73 | </p> |
| 88 | |
74 | |
| 89 | <p> |
75 | <p> |
| 90 | The following packages are used in this setup: apache, courier-imap, courier-authlib |
76 | The following packages are used in this setup: apache, courier-imap, |
| 91 | postfix, mod_php, phpmyadmin, squirrelmail, cyrus-sasl, mysql, php, and |
77 | courier-authlib postfix, mod_php, phpmyadmin, squirrelmail, cyrus-sasl, mysql, |
| 92 | mailman. |
78 | php, and mailman. |
| 93 | </p> |
|
|
| 94 | |
|
|
| 95 | <p> |
79 | </p> |
|
|
80 | |
|
|
81 | <p> |
| 96 | Make sure to turn on the following USE variables in <path>/etc/make.conf</path> |
82 | Make sure to turn on the following USE variables in <path>/etc/portage/make.conf</path> |
| 97 | before compiling the packages: <c>USE="mysql imap libwww maildir |
83 | before compiling the packages: <c>USE="mysql imap libwww maildir |
| 98 | sasl ssl"</c>. Otherwise you will most likely have to recompile things to |
84 | sasl ssl"</c>. Otherwise you will most likely have to recompile things to |
| 99 | get the support you need for all the protocols. Further, it's a good idea to |
85 | get the support you need for all the protocols. Further, it's a good idea to |
| 100 | turn off any other mail and network variables, like ipv6. |
86 | turn off any other mail and network variables, like ipv6. |
| 101 | </p> |
87 | </p> |
| 102 | |
|
|
| 103 | <impo> |
|
|
| 104 | This howto was written for postfix-2.0.x. If you are using postfix < 2 some |
|
|
| 105 | of the variables in this document will be different. It is recommended that you |
|
|
| 106 | upgrade. Some other packages included in this howto are version sensitive as |
|
|
| 107 | well. You are advised to read the documentation included with packages if you |
|
|
| 108 | run into issues with this. |
|
|
| 109 | </impo> |
|
|
| 110 | |
|
|
| 111 | <impo> |
|
|
| 112 | This document uses apache-1.3.x. Apache-2 has been marked stable in portage. |
|
|
| 113 | However there are still a number of issues with php integration. Until php |
|
|
| 114 | support in apache-2.0.x is marked stable, this guide will continue to use the |
|
|
| 115 | 1.3.x version. |
|
|
| 116 | </impo> |
|
|
| 117 | |
88 | |
| 118 | <impo> |
89 | <impo> |
| 119 | You need a domain name to run a public mail server, or at least an MX record |
90 | You need a domain name to run a public mail server, or at least an MX record |
| 120 | for a domain. Ideally you would have control of at least two domains to take |
91 | for a domain. Ideally you would have control of at least two domains to take |
| 121 | advantage of your new virtual domain functionality. |
92 | advantage of your new virtual domain functionality. |
| 122 | </impo> |
93 | </impo> |
| 123 | |
94 | |
| 124 | <impo> |
95 | <impo> |
| 125 | Make sure <path>/etc/hostname</path> is set to the right hostname for your mail |
96 | Make sure <path>/etc/conf.d/hostname</path> is set to the right hostname for |
| 126 | server. Verify your hostname is set correctly with <c>hostname</c>. Also |
97 | your mail server. You can apply any changes you make to this file by running |
| 127 | verify that there are no conflicting entries in <path>/etc/hosts</path>. |
98 | <c>/etc/init.d/hostname restart</c>. Verify your hostname is set correctly with |
|
|
99 | <c>hostname</c>. Also verify that there are no conflicting entries in |
|
|
100 | <path>/etc/hosts</path>. |
| 128 | </impo> |
101 | </impo> |
| 129 | |
102 | |
| 130 | <note> |
103 | <note> |
| 131 | It is recommended that you read this entire document and familiarize yourself |
104 | It is recommended that you read this entire document and familiarize yourself |
| 132 | with all the steps before attempting the install. If you run into problems with |
105 | with all the steps before attempting the install. If you run into problems with |
| … | |
… | |
| 149 | # <i>emerge postfix</i> |
122 | # <i>emerge postfix</i> |
| 150 | </pre> |
123 | </pre> |
| 151 | |
124 | |
| 152 | <warn> |
125 | <warn> |
| 153 | Verify that you have not installed any other MTA, such as ssmtp, exim, or |
126 | Verify that you have not installed any other MTA, such as ssmtp, exim, or |
| 154 | qmail, or you will surely have BIG problems. |
127 | netqmail, or you will surely have BIG problems. |
| 155 | </warn> |
128 | </warn> |
| 156 | |
129 | |
| 157 | <p> |
130 | <p> |
| 158 | After postfix is installed, it's time to configure it. Change the following |
131 | After postfix is installed, it's time to configure it. Change the following |
| 159 | options in <path>/etc/postfix/main.cf</path>: |
132 | options in <path>/etc/postfix/main.cf</path>. Remember to replace |
|
|
133 | <c>$variables</c> with your own names. |
| 160 | </p> |
134 | </p> |
| 161 | |
135 | |
| 162 | <pre caption="/etc/postfix/main.cf"> |
136 | <pre caption="/etc/postfix/main.cf"> |
| 163 | myhostname = $host.domain.name |
137 | myhostname = $host.domain.name |
| 164 | mydomain = $domain.name |
138 | mydomain = $domain.name |
| … | |
… | |
| 191 | |
165 | |
| 192 | <pre caption="Starting postfix for the first time"> |
166 | <pre caption="Starting postfix for the first time"> |
| 193 | # <i>/usr/bin/newaliases</i> |
167 | # <i>/usr/bin/newaliases</i> |
| 194 | <comment>(This will install the new aliases. You only need to do this |
168 | <comment>(This will install the new aliases. You only need to do this |
| 195 | when you update or install aliases.)</comment> |
169 | when you update or install aliases.)</comment> |
| 196 | |
170 | |
| 197 | # <i>/etc/init.d/postfix start</i> |
171 | # <i>/etc/init.d/postfix start</i> |
| 198 | </pre> |
172 | </pre> |
| 199 | |
173 | |
| 200 | <p> |
174 | <p> |
| 201 | Now that postfix is running, fire up your favorite console mail client and send |
175 | Now that postfix is running, fire up your favorite console mail client and send |
| … | |
… | |
| 243 | # <i>/etc/init.d/courier-pop3d-ssl start</i> |
217 | # <i>/etc/init.d/courier-pop3d-ssl start</i> |
| 244 | </pre> |
218 | </pre> |
| 245 | |
219 | |
| 246 | <p> |
220 | <p> |
| 247 | Start up your favorite mail client and verify that all connections you've |
221 | Start up your favorite mail client and verify that all connections you've |
| 248 | started work for receiving and sending mail. Now that the basics work, we're |
222 | started work for receiving and sending mail. Of course, you won't be able to log |
| 249 | going to do a whole bunch of stuff at once to get the rest of the system |
223 | on to any of the services because authentication hasn't been configured yet, but |
| 250 | running. Again, please verify that what we've installed already works before |
224 | it is wise to check if the connections themselves work or not. |
| 251 | progressing. |
225 | </p> |
|
|
226 | |
|
|
227 | <p> |
|
|
228 | Now that the basics work, we're going to do a whole bunch of stuff at once to |
|
|
229 | get the rest of the system running. Again, please verify that what we've |
|
|
230 | installed already works before progressing. |
| 252 | </p> |
231 | </p> |
| 253 | |
232 | |
| 254 | </body> |
233 | </body> |
| 255 | </section> |
234 | </section> |
| 256 | </chapter> |
235 | </chapter> |
| … | |
… | |
| 260 | <section> |
239 | <section> |
| 261 | <body> |
240 | <body> |
| 262 | |
241 | |
| 263 | <p> |
242 | <p> |
| 264 | Next we're going to install cyrus-sasl. Sasl is going to play the role of |
243 | Next we're going to install cyrus-sasl. Sasl is going to play the role of |
| 265 | actually passing your auth variables to courier-auth, which will in turn pass that |
244 | actually passing your auth variables to courier-auth, which will in turn pass |
| 266 | information to mysql for authentication of smtp users. For this howto, we'll |
245 | that information to mysql for authentication of smtp users. For this howto, |
| 267 | not even try to verify that sasl is working until mysql is set up and contains |
246 | we'll not even try to verify that sasl is working until mysql is set up and |
| 268 | a test user. Which is fine since we'll be authenticating against mysql in the |
247 | contains a test user. Which is fine since we'll be authenticating against |
| 269 | end anyway. |
248 | mysql in the end anyway. |
| 270 | </p> |
249 | </p> |
| 271 | |
250 | |
| 272 | <pre caption="Configuring and installing the cyrus-sasl ebuild"> |
251 | <pre caption="Configuring and installing the cyrus-sasl ebuild"> |
| 273 | # <i>emerge cyrus-sasl</i> |
252 | # <i>emerge cyrus-sasl</i> |
| 274 | </pre> |
253 | </pre> |
| … | |
… | |
| 313 | emailAddress_default. |
292 | emailAddress_default. |
| 314 | |
293 | |
| 315 | <comment>(If the variables are not already present, just add them in a sensible place.)</comment> |
294 | <comment>(If the variables are not already present, just add them in a sensible place.)</comment> |
| 316 | |
295 | |
| 317 | # <i>cd misc</i> |
296 | # <i>cd misc</i> |
| 318 | # <i>nano -w CA.pl</i> |
297 | # <i>./CA.pl -newreq-nodes</i> |
| 319 | <comment>(We need to add -nodes to the # create a certificate and |
|
|
| 320 | #create a certificate request code in order to let our new ssl |
|
|
| 321 | certs be loaded without a password. Otherwise when you |
|
|
| 322 | reboot your ssl certs will not be available.)</comment> |
|
|
| 323 | |
|
|
| 324 | # create a certificate |
|
|
| 325 | system ("$REQ -new -nodes -x509 -keyout newreq.pem -out newreq.pem $DAYS"); |
|
|
| 326 | |
|
|
| 327 | # create a certificate request |
|
|
| 328 | system ("$REQ -new -nodes -keyout newreq.pem -out newreq.pem $DAYS"); |
|
|
| 329 | |
|
|
| 330 | # <i>./CA.pl -newca</i> |
298 | # <i>./CA.pl -newca</i> |
| 331 | # <i>./CA.pl -newreq</i> |
|
|
| 332 | # <i>./CA.pl -sign</i> |
299 | # <i>./CA.pl -sign</i> |
| 333 | # <i>cp newcert.pem /etc/postfix</i> |
300 | # <i>cp newcert.pem /etc/postfix</i> |
| 334 | # <i>cp newreq.pem /etc/postfix</i> |
301 | # <i>cp newkey.pem /etc/postfix</i> |
| 335 | # <i>cp demoCA/cacert.pem /etc/postfix</i> |
302 | # <i>cp demoCA/cacert.pem /etc/postfix</i> |
| 336 | <comment>(Now we do the same thing for apache.)</comment> |
303 | <comment>(Now we do the same thing for apache.)</comment> |
| 337 | |
304 | |
| 338 | # <i>openssl req -new > new.cert.csr</i> |
305 | # <i>openssl req -new > new.cert.csr</i> |
| 339 | # <i>openssl rsa -in privkey.pem -out new.cert.key</i> |
306 | # <i>openssl rsa -in privkey.pem -out new.cert.key</i> |
| … | |
… | |
| 359 | |
326 | |
| 360 | <pre caption="/etc/postfix/main.cf"> |
327 | <pre caption="/etc/postfix/main.cf"> |
| 361 | # <i>nano -w /etc/postfix/main.cf</i> |
328 | # <i>nano -w /etc/postfix/main.cf</i> |
| 362 | |
329 | |
| 363 | smtpd_sasl_auth_enable = yes |
330 | smtpd_sasl_auth_enable = yes |
| 364 | smtpd_sasl2_auth_enable = yes |
|
|
| 365 | smtpd_sasl_security_options = noanonymous |
331 | smtpd_sasl_security_options = noanonymous |
| 366 | broken_sasl_auth_clients = yes |
332 | broken_sasl_auth_clients = yes |
| 367 | smtpd_sasl_local_domain = |
333 | smtpd_sasl_local_domain = |
| 368 | |
334 | |
| 369 | <comment>(The broken_sasl_auth_clients option and the login auth method |
335 | <comment>(The broken_sasl_auth_clients option and the login auth method |
| … | |
… | |
| 372 | smtpd_sasl_local_domain appends a domain name to clients using |
338 | smtpd_sasl_local_domain appends a domain name to clients using |
| 373 | smtp-auth. Make sure it's blank or your user names will get |
339 | smtp-auth. Make sure it's blank or your user names will get |
| 374 | mangled by postfix and be unable to auth.)</comment> |
340 | mangled by postfix and be unable to auth.)</comment> |
| 375 | |
341 | |
| 376 | smtpd_recipient_restrictions = |
342 | smtpd_recipient_restrictions = |
| 377 | permit_sasl_authenticated, |
343 | permit_sasl_authenticated, |
| 378 | permit_mynetworks, |
344 | permit_mynetworks, |
| 379 | reject_unauth_destination |
345 | reject_unauth_destination |
| 380 | |
|
|
| 381 | |
346 | |
| 382 | <comment>(The next two options enable outgoing encryption.)</comment> |
347 | <comment>(The next two options enable outgoing encryption.)</comment> |
| 383 | smtp_use_tls = yes |
348 | smtp_use_tls = yes |
| 384 | smtp_tls_note_starttls_offer = yes |
349 | smtp_tls_note_starttls_offer = yes |
| 385 | smtpd_use_tls = yes |
350 | smtpd_use_tls = yes |
| 386 | #smtpd_tls_auth_only = yes |
351 | #smtpd_tls_auth_only = yes |
| 387 | smtpd_tls_key_file = /etc/postfix/newreq.pem |
352 | smtpd_tls_key_file = /etc/postfix/newkey.pem |
| 388 | smtpd_tls_cert_file = /etc/postfix/newcert.pem |
353 | smtpd_tls_cert_file = /etc/postfix/newcert.pem |
| 389 | smtpd_tls_CAfile = /etc/postfix/cacert.pem |
354 | smtpd_tls_CAfile = /etc/postfix/cacert.pem |
| 390 | smtpd_tls_loglevel = 3 |
355 | smtpd_tls_loglevel = 3 |
| 391 | smtpd_tls_received_header = yes |
356 | smtpd_tls_received_header = yes |
| 392 | smtpd_tls_session_cache_timeout = 3600s |
357 | smtpd_tls_session_cache_timeout = 3600s |
| … | |
… | |
| 398 | # <i>postfix reload</i> |
363 | # <i>postfix reload</i> |
| 399 | </pre> |
364 | </pre> |
| 400 | |
365 | |
| 401 | <p> |
366 | <p> |
| 402 | Now we're going to verify that the config's we added were picked up by postfix. |
367 | Now we're going to verify that the config's we added were picked up by postfix. |
|
|
368 | For this we are going to use <c>telnet</c> (provided by for instance |
|
|
369 | <c>net-misc/netkit-telnetd</c>) although you can also use <c>nc</c> (provided by |
|
|
370 | <c>net-analyzer/netcat</c>): |
| 403 | </p> |
371 | </p> |
| 404 | |
372 | |
| 405 | <pre caption="Verifying sasl and tls support"> |
373 | <pre caption="Verifying sasl and tls support"> |
| 406 | # <i>telnet localhost 25</i> |
374 | # <i>telnet localhost 25</i> |
| 407 | |
375 | |
| … | |
… | |
| 435 | </body> |
403 | </body> |
| 436 | </section> |
404 | </section> |
| 437 | </chapter> |
405 | </chapter> |
| 438 | |
406 | |
| 439 | <chapter> |
407 | <chapter> |
|
|
408 | <title>The vmail user</title> |
|
|
409 | <section> |
|
|
410 | <body> |
|
|
411 | |
|
|
412 | <p> |
|
|
413 | Before we set up our virtual mailhosting environment, we create a functional |
|
|
414 | user under which the virtual mailboxes will be hosted. For clarity's sake we |
|
|
415 | will call this <e>vmail</e>: |
|
|
416 | </p> |
|
|
417 | |
|
|
418 | <pre caption="Adding the vmail user"> |
|
|
419 | # <i>useradd -d /home/vmail -s /bin/false -m vmail</i> |
|
|
420 | </pre> |
|
|
421 | |
|
|
422 | <p> |
|
|
423 | So now you've set up the vmail account. You can create multiple accounts if you |
|
|
424 | want (to keep some structure in your set of virtual mail accounts). The user id, |
|
|
425 | group id and home dirs are referenced in the MySQL tables. |
|
|
426 | </p> |
|
|
427 | |
|
|
428 | <p> |
|
|
429 | Next to the user account we also need to create the location where the mailboxes |
|
|
430 | will reside: |
|
|
431 | </p> |
|
|
432 | |
|
|
433 | <pre caption="Creating mailboxes"> |
|
|
434 | # <i>mkdir -p /home/vmail/virt-domain.com/foo</i> |
|
|
435 | # <i>chown -R vmail:vmail /home/vmail/virt-domain.com</i> |
|
|
436 | # <i>maildirmake /home/vmail/virt-domain.com/foo/.maildir</i> |
|
|
437 | </pre> |
|
|
438 | |
|
|
439 | </body> |
|
|
440 | </section> |
|
|
441 | </chapter> |
|
|
442 | |
|
|
443 | <chapter> |
| 440 | <title>MySQL</title> |
444 | <title>MySQL</title> |
| 441 | <section> |
445 | <section> |
| 442 | <body> |
446 | <body> |
| 443 | |
447 | |
| 444 | <p> |
448 | <p> |
| … | |
… | |
| 450 | <pre caption="Installing and configuring MySQL"> |
454 | <pre caption="Installing and configuring MySQL"> |
| 451 | # <i>emerge mysql</i> |
455 | # <i>emerge mysql</i> |
| 452 | |
456 | |
| 453 | # <i>/usr/bin/mysql_install_db</i> |
457 | # <i>/usr/bin/mysql_install_db</i> |
| 454 | <comment>(After this command runs follow the onscreen directions |
458 | <comment>(After this command runs follow the onscreen directions |
| 455 | for adding a root password with mysql, |
459 | for adding a root password with mysql, otherwise your db will |
| 456 | not mysqladmin, otherwise your db will be wide open.)</comment> |
460 | be wide open.)</comment> |
| 457 | |
461 | |
| 458 | # <i>/etc/init.d/mysql start</i> |
462 | # <i>/etc/init.d/mysql start</i> |
| 459 | # <i>mysqladmin -u root -p create mailsql</i> |
463 | # <i>mysqladmin -u root -p create mailsql</i> |
| 460 | # <i>mysql -u root -p mailsql < genericmailsql.sql</i> |
464 | # <i>mysql -u root -p mailsql < genericmailsql.sql</i> |
| 461 | |
|
|
| 462 | # <i>mysql -u root -p mysql</i> |
465 | # <i>mysql -u root -p mysql</i> |
| 463 | mysql> <i>GRANT SELECT,INSERT,UPDATE,DELETE</i> |
466 | mysql> <i>GRANT SELECT,INSERT,UPDATE,DELETE</i> |
| 464 | -> <i>ON mailsql.*</i> |
467 | -> <i>ON mailsql.*</i> |
| 465 | -> <i>TO mailsql@localhost</i> |
468 | -> <i>TO mailsql@localhost</i> |
| 466 | -> <i>IDENTIFIED BY '$password';</i> |
469 | -> <i>IDENTIFIED BY '$password';</i> |
| 467 | Query OK, 0 rows affected (0.02 sec) |
470 | Query OK, 0 rows affected (0.02 sec) |
| 468 | |
471 | |
| 469 | mysql> <i>FLUSH PRIVILEGES;</i> |
472 | mysql> <i>FLUSH PRIVILEGES;</i> |
| 470 | Query OK, 0 rows affected (0.00 sec) |
473 | Query OK, 0 rows affected (0.00 sec) |
| 471 | |
474 | |
| … | |
… | |
| 490 | <li>users - all user account information</li> |
493 | <li>users - all user account information</li> |
| 491 | <li>virtual - virtual domain email alias maps</li> |
494 | <li>virtual - virtual domain email alias maps</li> |
| 492 | </ul> |
495 | </ul> |
| 493 | |
496 | |
| 494 | <pre caption="alias table sample"> |
497 | <pre caption="alias table sample"> |
| 495 | id alias destination |
498 | id alias destination |
| 496 | 1 root foo@bar.com |
499 | 1 root foo@bar.com |
| 497 | 2 postmaster foo@bar.com |
500 | 2 postmaster foo@bar.com |
| 498 | </pre> |
501 | </pre> |
| 499 | |
502 | |
| 500 | <pre caption="user table sample"> |
503 | <pre caption="user table sample"> |
| 501 | <comment>(Line wrapped for clarity.)</comment> |
504 | <comment>(Line wrapped for clarity.)</comment> |
| 502 | id email clear name uid gid homedir \ |
505 | id email clear name uid gid homedir \ |
| 503 | maildir quota postfix |
506 | maildir quota postfix |
| 504 | 10 foo@virt-bar.org $password realname virtid virtid /home/vmail \ |
507 | 10 foo@virt-domain.com $password realname virtid virtid /home/vmail \ |
| 505 | /home/vmail/virt-bar.org/foo/.maildir/ y |
508 | /home/vmail/virt-domain.com/foo/.maildir/ y |
| 506 | 13 foo@bar.com $password realname localid localid /home/foo \ |
509 | 13 foo@bar.com $password realname localid localid /home/foo \ |
| 507 | /home/foo/.maildir/ y |
510 | /home/foo/.maildir/ y |
| 508 | </pre> |
511 | </pre> |
| 509 | |
512 | |
| 510 | <p> |
513 | <p> |
| 511 | The values of the <c>virtid</c> uid and gid should be those of the <c>vmail</c> |
514 | The values of the <c>virtid</c> uid and gid should be those of the <c>vmail</c> |
| 512 | user and group. |
515 | user and group. |
| 513 | </p> |
516 | </p> |
| 514 | |
517 | |
| 515 | <pre caption="transport table sample"> |
518 | <pre caption="transport table sample"> |
| 516 | id domain destination |
519 | id domain destination |
| 517 | 1 bar.com local: |
520 | 1 bar.com local: |
| 518 | 2 virt-bar.org virtual: |
521 | 2 virt-domain.com virtual: |
| 519 | </pre> |
522 | </pre> |
| 520 | |
523 | |
| 521 | <pre caption="virtual table sample"> |
524 | <pre caption="virtual table sample"> |
| 522 | id email destination |
525 | id email destination |
| 523 | 3 root@virt-bar.org other@email.address |
526 | 3 root@virt-domain.com other@email.address |
| 524 | </pre> |
527 | </pre> |
| 525 | |
528 | |
| 526 | </body> |
529 | </body> |
| 527 | </section> |
530 | </section> |
| 528 | </chapter> |
531 | </chapter> |
| … | |
… | |
| 536 | Next we'll set up apache and add an interface to interact with the database |
539 | Next we'll set up apache and add an interface to interact with the database |
| 537 | more easily. |
540 | more easily. |
| 538 | </p> |
541 | </p> |
| 539 | |
542 | |
| 540 | <pre caption="Setting up apache and phpmyadmin"> |
543 | <pre caption="Setting up apache and phpmyadmin"> |
| 541 | # <i>emerge apache mod_php phpmyadmin</i> |
544 | # <i>emerge apache phpmyadmin</i> |
| 542 | </pre> |
545 | </pre> |
| 543 | |
546 | |
| 544 | <p> |
547 | <p> |
| 545 | There are plenty of guides out there about how to set up apache with php. Like |
548 | There are plenty of guides out there about how to set up apache with php, |
| 546 | this one: <uri>http://www.linuxguruz.org/z.php?id=31</uri>. There are also |
549 | including guides provided by the <uri link="/proj/en/php/">Gentoo PHP |
|
|
550 | Project</uri>. There are also numerous posts on |
| 547 | numerous posts on <uri>http://forums.gentoo.org</uri> detailing how to solve |
551 | <uri>http://forums.gentoo.org</uri> detailing how to solve problems with the |
| 548 | problems with the installation (search for 'apache php'). So, that said, I'm |
552 | installation. So, that said, we're not going to cover it here. Set up the |
| 549 | not going to cover it here. Set up the apache and php installs, then continue |
553 | apache and php installs, then continue with this howto. Now, a word for the |
| 550 | with this howto. Now, a word for the wise: .htaccess the directory that you put |
554 | wise: .htaccess the directory that you put phpmyadmin in. If you do not do this, |
| 551 | phpmyadmin in. If you do not do this, search engine spiders will come along and |
555 | search engine spiders will come along and index the page which in turn will mean |
| 552 | index the page which in turn will mean that anyone will be able to find your |
556 | that anyone will be able to find your phpmyadmin page via google and in turn be |
| 553 | phpmyadmin page via google and in turn be able to come change your database |
557 | able to come change your database however they want which is <e>BAD!</e> There |
| 554 | however they want which is <e>BAD!</e> There are many howtos on this |
558 | are many howtos on this including: |
| 555 | including: <uri>http://www.csoft.net/docs/micro/htaccess.html.en</uri>. |
559 | <uri>http://www.csoft.net/docs/micro/htaccess.html.en</uri>. |
| 556 | </p> |
560 | </p> |
| 557 | |
561 | |
| 558 | <p> |
562 | <p> |
| 559 | Now we're going to install the Apache certificates we made previously. The |
563 | Now we're going to install the Apache certificates we made previously. The |
| 560 | Apache-SSL directives that you need to use the resulting cert are: |
564 | Apache-SSL directives that you need to use the resulting cert are: |
| … | |
… | |
| 564 | <li>SSLCertificateFile /path/to/certs/new.cert.cert</li> |
568 | <li>SSLCertificateFile /path/to/certs/new.cert.cert</li> |
| 565 | <li>SSLCertificateKeyFile /path/to/certs/new.cert.key</li> |
569 | <li>SSLCertificateKeyFile /path/to/certs/new.cert.key</li> |
| 566 | </ul> |
570 | </ul> |
| 567 | |
571 | |
| 568 | <pre caption="Install Apache SSL certificates"> |
572 | <pre caption="Install Apache SSL certificates"> |
| 569 | # <i>cp /etc/ssl/misc/new.cert.cert /etc/apache/conf/ssl/</i> |
573 | # <i>cp /etc/ssl/misc/new.cert.cert /etc/apache2/ssl/</i> |
| 570 | # <i>cp /etc/ssl/misc/new.cert.key /etc/apache/conf/ssl/</i> |
574 | # <i>cp /etc/ssl/misc/new.cert.key /etc/apache2/ssl/</i> |
| 571 | # <i>nano -w /etc/apache/conf/vhosts/ssl.default-vhost.conf</i> |
575 | # <i>cd /etc/apache2/vhosts.d</i> |
|
|
576 | <comment>(Check if you have an ssl-vhost template already. |
|
|
577 | Copy that one instead of the default_vhost if that is the case)</comment> |
|
|
578 | # <i>cp 00_default_vhost.conf ssl-vhost.conf</i> |
|
|
579 | # <i>nano -w ssl-vhost.conf</i> |
| 572 | |
580 | |
| 573 | <comment>(Change the following parameters)</comment> |
581 | <comment>(Change the following parameters)</comment> |
|
|
582 | NameVirtualHost host.domain.name:443 |
| 574 | |
583 | |
|
|
584 | <VirtualHost host.domain.name:443> |
| 575 | ServerName host.domain.name |
585 | ServerName host.domain.name |
| 576 | ServerAdmin your@email.address |
586 | ServerAdmin your@email.address |
|
|
587 | |
|
|
588 | DocumentRoot "/var/www/localhost/htdocs/phpmyadmin"; |
|
|
589 | <Directory "/var/www/localhost/htdocs/phpmyadmin"> |
|
|
590 | ... |
|
|
591 | </Directory> |
|
|
592 | |
| 577 | SSLCertificateFile /etc/apache/conf/ssl/new.cert.cert |
593 | SSLCertificateFile /etc/apache2/ssl/new.cert.cert |
| 578 | SSLCertificateKeyFile /etc/apache/conf/ssl/new.cert.key |
594 | SSLCertificateKeyFile /etc/apache2/ssl/new.cert.key |
|
|
595 | SSLEngine on |
|
|
596 | ... |
|
|
597 | </VirtualHost> |
| 579 | |
598 | |
|
|
599 | # <i>nano -w /etc/conf.d/apache2</i> |
|
|
600 | <comment>(Add -D SSL -D PHP5 to the APACHE2_OPTS)</comment> |
|
|
601 | |
| 580 | # <i>/etc/init.d/apache restart</i> |
602 | # <i>/etc/init.d/apache2 restart</i> |
| 581 | </pre> |
603 | </pre> |
| 582 | |
|
|
| 583 | <note> |
|
|
| 584 | If you have an existing apache install, you'll likely have to perform a full |
|
|
| 585 | server reboot to install your new certificates. Check your logs to verify |
|
|
| 586 | apache restarted successfully. |
|
|
| 587 | </note> |
|
|
| 588 | |
604 | |
| 589 | <p> |
605 | <p> |
| 590 | Next, configure phpMyAdmin. |
606 | Next, configure phpMyAdmin. |
| 591 | </p> |
607 | </p> |
| 592 | |
608 | |
| 593 | <pre caption="Configuring phpMyAdmin"> |
609 | <pre caption="Configuring phpMyAdmin"> |
| 594 | # <i>nano -w /var/www/localhost/htdocs/phpmyadmin/config.inc.php</i> |
610 | # <i>cd /var/www/localhost/htdocs/phpmyadmin</i> |
|
|
611 | # <i>cp config.sample.inc.php config.inc.php</i> |
|
|
612 | # <i>nano -w config.inc.php</i> |
| 595 | <comment>(Change the following parameters.)</comment> |
613 | <comment>(Change the following parameters.)</comment> |
|
|
614 | $cfg['blowfish_secret'] = 'someverysecretpassphraze'; |
| 596 | |
615 | |
| 597 | $cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname |
616 | $cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname |
| 598 | $cfg['Servers'][$i]['controluser'] = 'mailsql'; // MySQL control user settings |
617 | $cfg['Servers'][$i]['controluser'] = 'mailsql'; // MySQL control user settings |
| 599 | // (this user must have read-only |
618 | // (this user must have read-only |
| 600 | $cfg['Servers'][$i]['controlpass'] = '$password'; // access to the "mysql/user" |
619 | $cfg['Servers'][$i]['controlpass'] = '$password'; // access to the "mysql/user" |
| … | |
… | |
| 607 | Now enter the phpmyadmin page and browse the tables. You'll want to add in your |
626 | Now enter the phpmyadmin page and browse the tables. You'll want to add in your |
| 608 | local aliases, edit your user table to add a test user, and change your |
627 | local aliases, edit your user table to add a test user, and change your |
| 609 | transport table to add information about your domains. The default values |
628 | transport table to add information about your domains. The default values |
| 610 | supplied with the dumpfile should be a sufficient guide to what values need to |
629 | supplied with the dumpfile should be a sufficient guide to what values need to |
| 611 | go where. Make sure that if you put information in the database that it is |
630 | go where. Make sure that if you put information in the database that it is |
| 612 | accurate. For instance, make sure the local users home dir exists and that the |
631 | 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 |
632 | 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 |
633 | 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 |
634 | general, it's a good idea to send a "Welcome" mail to a new user after you |
| 616 | after you setup their account to make sure the .maildir gets created. |
635 | 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 vmail</i> |
|
|
| 635 | # <i>uid=`cat /etc/passwd | grep vmail | cut -f 3 -d :`</i> |
|
|
| 636 | # <i>groupadd -g $uid vmail</i> |
|
|
| 637 | # <i>mkdir /home/vmail</i> |
|
|
| 638 | # <i>chown vmail: /home/vmail</i> |
|
|
| 639 | </pre> |
|
|
| 640 | |
|
|
| 641 | <p> |
|
|
| 642 | So now when you're setting up vmail accounts, use the vmail uid, gid, and |
|
|
| 643 | homedir. When you're setting up local accounts, use that users uid, gid, and |
|
|
| 644 | homedir. We've been meaning to create a php admin page for this setup but |
|
|
| 645 | haven't gotten around to it yet, as phpmyadmin generally works fine for us. |
|
|
| 646 | </p> |
636 | </p> |
| 647 | |
637 | |
| 648 | </body> |
638 | </body> |
| 649 | </section> |
639 | </section> |
| 650 | </chapter> |
640 | </chapter> |
| … | |
… | |
| 683 | # <i>/etc/init.d/courier-authlib restart</i> |
673 | # <i>/etc/init.d/courier-authlib restart</i> |
| 684 | # <i>/etc/init.d/saslauthd restart</i> |
674 | # <i>/etc/init.d/saslauthd restart</i> |
| 685 | </pre> |
675 | </pre> |
| 686 | |
676 | |
| 687 | <p> |
677 | <p> |
| 688 | We're almost there I promise! Next, set up the rest of the necessary config's |
678 | We're almost there, I promise! Next, set up the rest of the necessary configs |
| 689 | for postfix to interract with the database for all it's other transport needs. |
679 | for postfix to interract with the database for all its other transport needs. |
|
|
680 | Remember to replace each value with the name of your own user, user id, |
|
|
681 | password, alias, email address, and so on. |
| 690 | </p> |
682 | </p> |
| 691 | |
683 | |
| 692 | <pre caption="/etc/postfix/mysql-aliases.cf"> |
684 | <pre caption="/etc/postfix/mysql-aliases.cf"> |
| 693 | # <i>nano -w /etc/postfix/mysql-aliases.cf</i> |
685 | # <i>nano -w /etc/postfix/mysql-aliases.cf</i> |
| 694 | # mysql-aliases.cf |
686 | # mysql-aliases.cf |
| 695 | |
687 | |
| 696 | user = mailsql |
688 | user = mailsql |
| 697 | password = $password |
689 | password = $password |
| 698 | dbname = mailsql |
690 | dbname = mailsql |
| 699 | table = alias |
691 | table = alias |
| 700 | select_field = destination |
692 | select_field = destination |
| 701 | where_field = alias |
693 | where_field = alias |
| 702 | hosts = unix:/var/run/mysqld/mysqld.sock |
694 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 703 | </pre> |
695 | </pre> |
| 704 | |
696 | |
| 705 | <pre caption="/etc/postfix/mysql-relocated.cf"> |
697 | <pre caption="/etc/postfix/mysql-relocated.cf"> |
| 706 | # <i>nano -w /etc/postfix/mysql-relocated.cf</i> |
698 | # <i>nano -w /etc/postfix/mysql-relocated.cf</i> |
| 707 | # mysql-relocated.cf |
699 | # mysql-relocated.cf |
| 708 | |
700 | |
| 709 | user = mailsql |
701 | user = mailsql |
| 710 | password = $password |
702 | password = $password |
| 711 | dbname = mailsql |
703 | dbname = mailsql |
| 712 | table = relocated |
704 | table = relocated |
| 713 | select_field = destination |
705 | select_field = destination |
| 714 | where_field = email |
706 | where_field = email |
| 715 | hosts = unix:/var/run/mysqld/mysqld.sock |
707 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 716 | </pre> |
708 | </pre> |
| 717 | |
709 | |
| 718 | <pre caption="/etc/postfix/mysql-transport.cf (optional)"> |
710 | <pre caption="/etc/postfix/mysql-transport.cf (optional)"> |
| 719 | # <i>nano -w /etc/postfix/mysql-transport.cf</i> |
711 | # <i>nano -w /etc/postfix/mysql-transport.cf</i> |
| 720 | # mysql-transport.cf |
712 | # mysql-transport.cf |
| 721 | |
713 | |
| 722 | user = mailsql |
714 | user = mailsql |
| 723 | password = $password |
715 | password = $password |
| 724 | dbname = mailsql |
716 | dbname = mailsql |
| 725 | table = transport |
717 | table = transport |
| 726 | select_field = destination |
718 | select_field = destination |
| 727 | where_field = domain |
719 | where_field = domain |
| 728 | hosts = unix:/var/run/mysqld/mysqld.sock |
720 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 729 | </pre> |
721 | </pre> |
| 730 | |
722 | |
| 731 | <pre caption="/etc/postfix/mysql-virtual-gid.cf (optional)"> |
723 | <pre caption="/etc/postfix/mysql-virtual-gid.cf (optional)"> |
| 732 | # <i>nano -w /etc/postfix/mysql-virtual-gid.cf</i> |
724 | # <i>nano -w /etc/postfix/mysql-virtual-gid.cf</i> |
| 733 | #myql-virtual-gid.cf |
725 | # mysql-virtual-gid.cf |
| 734 | |
726 | |
| 735 | user = mailsql |
727 | user = mailsql |
| 736 | password = $password |
728 | password = $password |
| 737 | dbname = mailsql |
729 | dbname = mailsql |
| 738 | table = users |
730 | table = users |
| 739 | select_field = gid |
731 | select_field = gid |
| 740 | where_field = email |
732 | where_field = email |
| 741 | additional_conditions = and postfix = 'y' |
733 | additional_conditions = and postfix = 'y' |
| 742 | hosts = unix:/var/run/mysqld/mysqld.sock |
734 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 743 | </pre> |
735 | </pre> |
| 744 | |
736 | |
| 745 | <pre caption="/etc/postfix/mysql-virtual-maps.cf"> |
737 | <pre caption="/etc/postfix/mysql-virtual-maps.cf"> |
| 746 | # <i>nano -w /etc/postfix/mysql-virtual-maps.cf</i> |
738 | # <i>nano -w /etc/postfix/mysql-virtual-maps.cf</i> |
| 747 | #myql-virtual-maps.cf |
739 | # mysql-virtual-maps.cf |
| 748 | |
740 | |
| 749 | user = mailsql |
741 | user = mailsql |
| 750 | password = $password |
742 | password = $password |
| 751 | dbname = mailsql |
743 | dbname = mailsql |
| 752 | table = users |
744 | table = users |
| 753 | select_field = maildir |
745 | select_field = maildir |
| 754 | where_field = email |
746 | where_field = email |
| 755 | additional_conditions = and postfix = 'y' |
747 | additional_conditions = and postfix = 'y' |
| 756 | hosts = unix:/var/run/mysqld/mysqld.sock |
748 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 757 | </pre> |
749 | </pre> |
| 758 | |
750 | |
| 759 | <pre caption="/etc/postfix/mysql-virtual-uid.cf (optional)"> |
751 | <pre caption="/etc/postfix/mysql-virtual-uid.cf (optional)"> |
| … | |
… | |
| 763 | user = mailsql |
755 | user = mailsql |
| 764 | password = $password |
756 | password = $password |
| 765 | dbname = mailsql |
757 | dbname = mailsql |
| 766 | table = users |
758 | table = users |
| 767 | select_field = uid |
759 | select_field = uid |
| 768 | where_field = email |
760 | where_field = email |
| 769 | additional_conditions = and postfix = 'y' |
761 | additional_conditions = and postfix = 'y' |
| 770 | hosts = unix:/var/run/mysqld/mysqld.sock |
762 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 771 | </pre> |
763 | </pre> |
| 772 | |
764 | |
| 773 | <pre caption="/etc/postfix/mysql-virtual.cf"> |
765 | <pre caption="/etc/postfix/mysql-virtual.cf"> |
| 774 | # <i>nano -w /etc/postfix/mysql-virtual.cf</i> |
766 | # <i>nano -w /etc/postfix/mysql-virtual.cf</i> |
| 775 | # mysql-virtual.cf |
767 | # mysql-virtual.cf |
| 776 | |
768 | |
| 777 | user = mailsql |
769 | user = mailsql |
| 778 | password = $password |
770 | password = $password |
| 779 | dbname = mailsql |
771 | dbname = mailsql |
| 780 | table = virtual |
772 | table = virtual |
| 781 | select_field = destination |
773 | select_field = destination |
| 782 | where_field = email |
774 | where_field = email |
| 783 | hosts = unix:/var/run/mysqld/mysqld.sock |
775 | hosts = unix:/var/run/mysqld/mysqld.sock |
| 784 | </pre> |
776 | </pre> |
| 785 | |
777 | |
| 786 | <p> |
778 | <p> |
| 787 | Lastly, edit <path>/etc/postfix/main.cf</path> one more time. |
779 | Lastly, edit <path>/etc/postfix/main.cf</path> one more time. |
| 788 | </p> |
780 | </p> |
| 789 | |
781 | |
| 790 | <pre caption="/etc/postfix/main.cf"> |
782 | <pre caption="/etc/postfix/main.cf"> |
| 791 | # <i>nano -w /etc/postfix/main.cf</i> |
783 | # <i>nano -w /etc/postfix/main.cf</i> |
|
|
784 | <comment>(Ensure that there are no other alias_maps definitions)</comment> |
| 792 | alias_maps = mysql:/etc/postfix/mysql-aliases.cf |
785 | alias_maps = mysql:/etc/postfix/mysql-aliases.cf |
| 793 | relocated_maps = mysql:/etc/postfix/mysql-relocated.cf |
786 | relocated_maps = mysql:/etc/postfix/mysql-relocated.cf |
| 794 | |
787 | |
| 795 | local_transport = local |
788 | local_transport = local |
| 796 | local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname |
789 | local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname |
| 797 | |
790 | |
| 798 | virtual_transport = virtual |
791 | virtual_transport = virtual |
| 799 | virtual_mailbox_domains = |
792 | <comment>(The domains listed by the mydestination should not be listed in |
| 800 | virt-bar.com, |
793 | the virtual_mailbox_domains parameter)</comment> |
| 801 | $other-virtual-domain.com |
794 | virtual_mailbox_domains = virt-domain.com, $other-virtual-domain.com |
| 802 | |
795 | |
| 803 | virtual_minimum_uid = 1000 |
796 | virtual_minimum_uid = 1000 |
|
|
797 | <comment>(Substitute $vmail-gid with the GID of the vmail group)</comment> |
| 804 | virtual_gid_maps = static:$vmail-gid |
798 | virtual_gid_maps = static:$vmail-gid |
| 805 | virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf |
799 | virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf |
| 806 | virtual_alias_maps = mysql:/etc/postfix/mysql-virtual.cf |
800 | virtual_alias_maps = mysql:/etc/postfix/mysql-virtual.cf |
|
|
801 | <comment>(Substitute $vmail-uid with the UID of the vmail user)</comment> |
| 807 | virtual_uid_maps = static:$vmail-uid |
802 | virtual_uid_maps = static:$vmail-uid |
| 808 | virtual_mailbox_base = / |
803 | virtual_mailbox_base = / |
| 809 | #virtual_mailbox_limit = |
804 | #virtual_mailbox_limit = |
| 810 | </pre> |
805 | </pre> |
| 811 | |
806 | |
| … | |
… | |
| 881 | to require a bit of hacking. I really recommend reading all of the mailman |
876 | to require a bit of hacking. I really recommend reading all of the mailman |
| 882 | documentation, including README.POSTFIX.gz, to understand what's being done |
877 | documentation, including README.POSTFIX.gz, to understand what's being done |
| 883 | here. |
878 | here. |
| 884 | </p> |
879 | </p> |
| 885 | |
880 | |
| 886 | <p> |
|
|
| 887 | One further note, current versions of mailman install to /usr/local/mailman. If |
|
|
| 888 | you're like me and wish to change the default install location, it can be |
|
|
| 889 | overridden in the ebuild file by changing the INSTALLDIR variable. |
|
|
| 890 | </p> |
|
|
| 891 | |
|
|
| 892 | <pre caption="Install mailman"> |
881 | <pre caption="Install mailman"> |
| 893 | # <i>emerge mailman</i> |
882 | # <i>emerge mailman</i> |
| 894 | </pre> |
883 | </pre> |
| 895 | |
884 | |
| 896 | <pre caption="Setting defaults: Mailman/Defaults.py"> |
885 | <pre caption="Setting defaults: Mailman/Defaults.py"> |
| 897 | # <i> nano -w /var/mailman/Mailman/Defaults.py</i> |
886 | # <i> nano -w /usr/local/mailman/Mailman/Defaults.py</i> |
| 898 | <comment>(Change the values below to reflect your primary domain, virtuals will be set next.)</comment> |
887 | <comment>(Change the values below to reflect your primary domain, virtuals will be set next.)</comment> |
| 899 | DEFAULT_EMAIL_HOST = 'domain.com' |
888 | DEFAULT_EMAIL_HOST = 'domain.com' |
| 900 | DEFAULT_URL_HOST = 'www.domain.com' |
889 | DEFAULT_URL_HOST = 'www.domain.com' |
| 901 | </pre> |
890 | </pre> |
| 902 | |
891 | |
| 903 | <pre caption="mailman config: mm_cfg.py"> |
892 | <pre caption="mailman config: mm_cfg.py"> |
| 904 | # <i>nano -w /var/mailman/Mailman/mm_cfg.py</i> |
893 | # <i>nano -w /usr/local/mailman/Mailman/mm_cfg.py</i> |
| 905 | MTA = "Postfix" |
894 | MTA = "Postfix" |
| 906 | POSTFIX_STYLE_VIRTUAL_DOMAINS = ['virt-domain.com', 'virt.domain2.com'] |
895 | POSTFIX_STYLE_VIRTUAL_DOMAINS = ['virt-domain.com', 'virt.domain2.com'] |
| 907 | add_virtualhost('www.virt.domain.com', 'virt.domain.com') |
896 | add_virtualhost('www.virt.domain.com', 'virt.domain.com') |
| 908 | add_virtualhost('www.virt.domain2.com', 'virt.domain2.com') |
897 | add_virtualhost('www.virt.domain2.com', 'virt.domain2.com') |
| 909 | <comment>(This is required for your virtual domains for mailman to function.)</comment> |
898 | <comment>(This is required for your virtual domains for mailman to function.)</comment> |
| 910 | </pre> |
899 | </pre> |
| 911 | |
900 | |
| 912 | <pre caption="And last but not least"> |
901 | <pre caption="And last but not least"> |
| 913 | <comment>(Once that's finished, add your first list.)</comment> |
902 | <comment>(Once that's finished, add your first list.)</comment> |
| 914 | |
903 | |
| 915 | # <i>su mailman</i> |
904 | # <i>su mailman</i> |
| 916 | # <i>cd ~</i> |
905 | # <i>cd ~</i> |
| 917 | # <i>bin/newlist test</i> |
906 | # <i>./bin/newlist --urlhost='www.virt-domain.com' --emailhost='virt-domain.com' test</i> |
| 918 | Enter the email of the person running the list: <i>your@email.address</i> |
907 | Enter the email of the person running the list: <i>your@email.address</i> |
| 919 | Initial test password: |
908 | Initial test password: |
| 920 | Hit enter to continue with test owner notification... |
909 | Hit enter to continue with test owner notification... |
| 921 | <comment>(Virtual domain lists may be specified with |
910 | <comment>(Virtual domain lists may also be specified with |
| 922 | list@domain.com style list names.)</comment> |
911 | list@domain.com style list names.)</comment> |
| 923 | # <i>bin/genaliases</i> |
912 | # <i>./bin/genaliases</i> |
| 924 | <comment>(Now that your aliases have been generated, |
913 | <comment>(Now that your aliases have been generated, |
| 925 | verify that they were added successfully.)</comment> |
914 | verify that they were added successfully.)</comment> |
| 926 | |
915 | |
| 927 | # <i>nano -w data/aliases</i> |
916 | # <i>nano -w data/aliases</i> |
| 928 | # STANZA START: test |
917 | # STANZA START: test |
| 929 | # CREATED: |
918 | # CREATED: |
| 930 | test: "|/var/mailman/mail/mailman post test" |
919 | test: "|/usr/local/mailman/mail/mailman post test" |
| 931 | test-admin: "|/var/mailman/mail/mailman admin test" |
920 | test-admin: "|/usr/local/mailman/mail/mailman admin test" |
| 932 | test-bounces: "|/var/mailman/mail/mailman bounces test" |
921 | test-bounces: "|/usr/local/mailman/mail/mailman bounces test" |
| 933 | test-confirm: "|/var/mailman/mail/mailman confirm test" |
922 | test-confirm: "|/usr/local/mailman/mail/mailman confirm test" |
| 934 | test-join: "|/var/mailman/mail/mailman join test" |
923 | test-join: "|/usr/local/mailman/mail/mailman join test" |
| 935 | test-leave: "|/var/mailman/mail/mailman leave test" |
924 | test-leave: "|/usr/local/mailman/mail/mailman leave test" |
| 936 | test-owner: "|/var/mailman/mail/mailman owner test" |
925 | test-owner: "|/usr/local/mailman/mail/mailman owner test" |
| 937 | test-request: "|/var/mailman/mail/mailman request test" |
926 | test-request: "|/usr/local/mailman/mail/mailman request test" |
| 938 | test-subscribe: "|/var/mailman/mail/mailman subscribe test" |
927 | test-subscribe: "|/usr/local/mailman/mail/mailman subscribe test" |
| 939 | test-unsubscribe: "|/var/mailman/mail/mailman unsubscribe test" |
928 | test-unsubscribe: "|/usr/local/mailman/mail/mailman unsubscribe test" |
| 940 | # STANZA END: test |
929 | # STANZA END: test |
|
|
930 | |
|
|
931 | <comment>(Create the required mailman list)</comment> |
|
|
932 | # <i>./bin/newlist mailman</i> |
|
|
933 | # <i>./bin/genaliases</i> |
|
|
934 | |
|
|
935 | <comment>(Return to the root user)</comment> |
|
|
936 | # <i>exit</i> |
| 941 | |
937 | |
| 942 | # <i>/etc/init.d/mailman start</i> |
938 | # <i>/etc/init.d/mailman start</i> |
| 943 | # <i>rc-update add mailman default</i> |
939 | # <i>rc-update add mailman default</i> |
| 944 | <comment>(To start mailman at once and on every reboot.)</comment> |
940 | <comment>(To start mailman at once and on every reboot.)</comment> |
| 945 | </pre> |
941 | </pre> |
| … | |
… | |
| 949 | owner_request_special = no |
945 | owner_request_special = no |
| 950 | recipient_delimiter = + |
946 | recipient_delimiter = + |
| 951 | <comment>(Read README.POSTFIX.gz for details on this.)</comment> |
947 | <comment>(Read README.POSTFIX.gz for details on this.)</comment> |
| 952 | |
948 | |
| 953 | alias_maps = |
949 | alias_maps = |
| 954 | hash:/var/mailman/data/aliases, |
950 | hash:/usr/local/mailman/data/aliases, |
| 955 | mysql:/etc/postfix/mysql-aliases.cf |
951 | mysql:/etc/postfix/mysql-aliases.cf |
| 956 | |
952 | |
| 957 | virtual_alias_maps = |
953 | virtual_alias_maps = |
| 958 | hash:/var/mailman/data/virtual-mailman, |
954 | hash:/usr/local/mailman/data/virtual-mailman, |
| 959 | mysql:/etc/postfix/mysql-virtual.cf |
955 | mysql:/etc/postfix/mysql-virtual.cf |
| 960 | <comment>(This adds mailman alias file support to postfix |
956 | <comment>(This adds mailman alias file support to postfix |
| 961 | You may of course use the mysql tables for this, |
957 | You may of course use the mysql tables for this, |
| 962 | but I hate doing that by hand. Also, if you are not |
958 | but I hate doing that by hand. Also, if you are not |
| 963 | using virtual domains, adding the virtual alias maps |
959 | using virtual domains, adding the virtual alias maps |
| 964 | to postfix may cause problems, be warned.)</comment> |
960 | to postfix may cause problems, be warned.)</comment> |
| … | |
… | |
| 1084 | sure it's using the current version. Some of the components will dump their |
1080 | sure it's using the current version. Some of the components will dump their |
| 1085 | current config's to you, like postfix. |
1081 | current config's to you, like postfix. |
| 1086 | </p> |
1082 | </p> |
| 1087 | |
1083 | |
| 1088 | <pre caption="Some services can dump their current config"> |
1084 | <pre caption="Some services can dump their current config"> |
| 1089 | # <i>apachectl fullstatus</i> (needs lynx installed) |
1085 | # <i>apache2ctl fullstatus</i> (needs lynx installed) |
| 1090 | # <i>apachectl configtest</i> (checks config sanity) |
1086 | # <i>apache2ctl configtest</i> (checks config sanity) |
| 1091 | # <i>postconf -n</i> (will tell you exactly what param's postfix is using) |
1087 | # <i>postconf -n</i> (will tell you exactly what param's postfix is using) |
| 1092 | # <i>/etc/init.d/$service restart</i> |
1088 | # <i>/etc/init.d/$service restart</i> |
| 1093 | </pre> |
1089 | </pre> |
| 1094 | |
1090 | |
| 1095 | </body> |
1091 | </body> |
| … | |
… | |
| 1109 | |
1105 | |
| 1110 | <pre caption="Checking the logs"> |
1106 | <pre caption="Checking the logs"> |
| 1111 | # <i>kill -USR1 `ps -C metalog -o pid=`</i>(to turn off metalog buffering) |
1107 | # <i>kill -USR1 `ps -C metalog -o pid=`</i>(to turn off metalog buffering) |
| 1112 | # <i>nano -w /var/log/mail/current</i> |
1108 | # <i>nano -w /var/log/mail/current</i> |
| 1113 | # <i>cat /var/log/mysql/mysql.log</i> |
1109 | # <i>cat /var/log/mysql/mysql.log</i> |
| 1114 | # <i>tail /var/log/apache/error_log</i> |
1110 | # <i>tail /var/log/apache2/error_log</i> |
| 1115 | </pre> |
1111 | </pre> |
| 1116 | |
1112 | |
| 1117 | <p> |
1113 | <p> |
| 1118 | You may also find the debug_peer parameters in main.cf helpful. Setting these |
1114 | You may also find the debug_peer parameters in main.cf helpful. Setting these |
| 1119 | will increase log output over just verbose mode. |
1115 | will increase log output over just verbose mode. |
| … | |
… | |
| 1202 | <li> |
1198 | <li> |
| 1203 | <uri>http://www.google.com/</uri> - If all else fails, there's always |
1199 | <uri>http://www.google.com/</uri> - If all else fails, there's always |
| 1204 | google, which has never failed me |
1200 | google, which has never failed me |
| 1205 | </li> |
1201 | </li> |
| 1206 | <li> |
1202 | <li> |
| 1207 | I also spend a lot of time on irc.freenode.net #gentoo. Irc is a great |
1203 | I also spend a lot of time on <uri |
| 1208 | place to go for help. |
1204 | link="irc://irc.gentoo.org/gentoo">#gentoo</uri>. IRC is a great place to go |
|
|
1205 | for help. |
| 1209 | </li> |
1206 | </li> |
| 1210 | </ul> |
1207 | </ul> |
| 1211 | |
1208 | |
| 1212 | </body> |
1209 | </body> |
| 1213 | </section> |
1210 | </section> |