nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

FAQ.md (23345B)


      1 See <https://cr.yp.to/qmail/faq.html> for newer FAQs not included in this
      2 document, and <http://qmail.org/> for qmail community contributions.
      3 
      4 1. Controlling the appearance of outgoing messages  
      5 1.1. How do I set up host masquerading?  
      6 1.2. How do I set up user masquerading?  
      7 1.3. How do I set up Mail-Followup-To automatically?  
      8 
      9 2. Routing outgoing messages  
     10 2.1. How do I send local messages to another host?  
     11 2.2. How do I set up a null client?  
     12 2.3. How do I send outgoing mail through UUCP?  
     13 2.4. How do I set up a separate queue for a SLIP/PPP link?  
     14 
     15 3. Routing incoming messages by host  
     16 3.1. How do I receive mail for another host name?  
     17 3.2. How do I set up a virtual domain?  
     18 3.3. How do I set up several virtual domains for one user?  
     19 
     20 4. Routing incoming messages by user  
     21 4.1. How do I forward unrecognized usernames to another host?  
     22 4.2. How do I set up a mailing list?  
     23 4.3. How do I use majordomo with qmail?  
     24 4.4. How do I use procmail with qmail?  
     25 4.5. How do I use elm's filter with qmail?  
     26 4.6. How do I create aliases with dots?  
     27 4.7. How do I use sendmail's .forward files with qmail?  
     28 4.8. How do I use sendmail's /etc/aliases with qmail?  
     29 4.9. How do I make qmail defer messages during NFS or NIS outages?  
     30 4.10. How do I change which account controls an address?  
     31 
     32 5. Setting up servers  
     33 5.1. How do I run qmail-smtpd under tcpserver?  
     34 5.2. How do I set up qmail-qmtpd?  
     35 5.3. How do I set up qmail-pop3d?  
     36 5.4. How do I allow selected clients to use this host as a relay?  
     37 5.5. How do I fix up messages from broken SMTP clients?  
     38 5.6. How do I set up qmail-qmqpd?  
     39 
     40 6. Configuring MUAs to work with qmail  
     41 6.1. How do I make BSD mail generate a Date with the local time zone?  
     42 6.2. How do I make pine work with qmail?  
     43 6.3. How do I make MH work with qmail?  
     44 6.4. How do I stop Sun's dtcm from hanging?  
     45 
     46 7. Managing the mail system  
     47 7.1. How do I safely stop qmail-send?  
     48 7.2. How do I manually run the queue?  
     49 7.3. How do I rejuvenate a message?  
     50 7.4. How do I organize a big network?  
     51 7.5. How do I back up and restore the queue disk?  
     52 7.6. How do I run a supervised copy of qmail?  
     53 7.7. How do I avoid syslog?  
     54 
     55 8. Miscellany  
     56 8.1. How do I tell qmail to do more deliveries at once?  
     57 8.2. How do I keep a copy of all incoming and outgoing mail messages?  
     58 8.3. How do I switch slowly from sendmail to qmail?  
     59 
     60 
     61 
     62 1. Controlling the appearance of outgoing messages
     63 
     64 
     65 1.1. How do I set up host masquerading? All the users on this host,
     66 zippy.af.mil, are users on af.mil. When joe sends a message to fred, the
     67 message should say "From: joe@af.mil" and "To: fred@af.mil", without
     68 "zippy" anywhere.
     69 
     70 Answer: echo af.mil > /var/qmail/control/defaulthost; chmod 644
     71 /var/qmail/control/defaulthost.
     72 
     73 
     74 1.2. How do I set up user masquerading? I'd like my own From lines to
     75 show boss@af.mil rather than god@heaven.af.mil.
     76 
     77 Answer: Add MAILHOST=af.mil and MAILUSER=boss to your environment. To
     78 override From lines supplied by your MUA, add QMAILINJECT=f to your
     79 environment.
     80 
     81 
     82 1.3. How do I set up Mail-Followup-To automatically? When I send a
     83 message to the sos@heaven.af.mil mailing list, I'd like to include
     84 "Mail-Followup-To: sos@heaven.af.mil".
     85 
     86 Answer: Add QMAILMFTFILE=$HOME/.lists to your environment, and put
     87 sos@heaven.af.mil into ~/.lists.
     88 
     89 
     90 
     91 2. Routing outgoing messages
     92 
     93 
     94 2.1. How do I send local messages to another host? All the mail for
     95 af.mil should be delivered to our disk server, pokey.af.mil. I've set up
     96 an MX from af.mil to pokey.af.mil, but when a user on the af.mil host
     97 sends a message to boss@af.mil, af.mil tries to deliver it locally. How
     98 do I stop that?
     99 
    100 Answer: Remove af.mil from /var/qmail/control/locals. If qmail-send is
    101 running, give it a HUP. Make sure the MX is set up properly before you
    102 do this. Also make sure that pokey can receive mail for af.mil -- see
    103 question 3.1.
    104 
    105 
    106 2.2. How do I set up a null client? I'd like zippy.af.mil to
    107 send all mail to bigbang.af.mil.
    108 
    109 Answer: echo :bigbang.af.mil > /var/qmail/control/smtproutes;
    110 chmod 644 /var/qmail/control/smtproutes. Disable local delivery as in
    111 question 2.1. Turn off qmail-smtpd in /etc/inetd.conf.
    112 
    113 
    114 2.3. How do I send outgoing mail through UUCP? I need qmail to send all
    115 outgoing mail via UUCP to my upstream UUCP site, gonzo.
    116 
    117 Answer: Put
    118 
    119    `:alias-uucp`
    120 
    121 into control/virtualdomains and
    122 
    123    ```
    124    |preline -df /usr/bin/uux - -r -gC
    125       -a"${SENDER:-MAILER-DAEMON}" gonzo!rmail "($DEFAULT@$HOST)"
    126    ```
    127 
    128 (all on one line) into ~alias/.qmail-uucp-default. (For some UUCP
    129 software you will need to use -d instead of -df.) If qmail-send is
    130 running, give it a HUP.
    131 
    132 
    133 2.4. How do I set up a separate queue for a SLIP/PPP link?
    134 
    135 Answer: Use serialmail (<https://cr.yp.to/serialmail.html>).
    136 
    137 
    138 
    139 3. Routing incoming messages by host
    140 
    141 
    142 3.1. How do I receive mail for another host name? I'd like our disk
    143 server, pokey.af.mil, to receive mail addressed to af.mil. I've set up
    144 an MX from af.mil to pokey.af.mil, but how do I get pokey to treat
    145 af.mil as a name for the local host?
    146 
    147 Answer: Add af.mil to /var/qmail/control/locals and to
    148 /var/qmail/control/rcpthosts. If qmail-send is running, give it a HUP
    149 (or do svc -h /var/run/qmail if qmail is supervised).
    150 
    151 
    152 3.2. How do I set up a virtual domain? I'd like any mail for
    153 nowhere.mil, including root@nowhere.mil and postmaster@nowhere.mil and
    154 so on, to be delivered to Bob. I've set up the MX already.
    155 
    156 Answer: Put
    157 
    158    `nowhere.mil:bob`
    159 
    160 into control/virtualdomains. Add nowhere.mil to control/rcpthosts. If
    161 qmail-send is running, give it a HUP (or do svc -h /var/run/qmail if
    162 qmail is supervised).
    163 
    164 Now mail for whatever@nowhere.mil will be delivered locally to
    165 bob-whatever. Bob can set up ~bob/.qmail-default to catch all the
    166 possible addresses, ~bob/.qmail-info to catch info@nowhere.mil, etc.
    167 
    168 
    169 3.3. How do I set up several virtual domains for one user? Bob wants
    170 another virtual domain, everywhere.org, but he wants to handle
    171 nowhere.mil users and everywhere.org users differently. How can we do
    172 that without setting up a second account?
    173 
    174 Answer: Put two lines into control/virtualdomains:
    175 
    176    ```
    177    nowhere.mil:bob-nowhere
    178    everywhere.org:bob-everywhere
    179    ```
    180 
    181 Add nowhere.mil and everywhere.org to control/rcpthosts. If qmail-send
    182 is running, give it a HUP (or do svc -h /var/run/qmail if qmail is
    183 supervised).
    184 
    185 Now Bob can set up separate .qmail-nowhere-* and everywhere-* files. He
    186 can even set up .qmail-nowhere-default and .qmail-everywhere-default.
    187 
    188 
    189 
    190 4. Routing incoming messages by user
    191 
    192 
    193 4.1. How do I forward unrecognized usernames to another host? I'd like
    194 to set up a LUSER_RELAY pointing at bigbang.af.mil.
    195 
    196 Answer: Put
    197 
    198    `| forward "$LOCAL"@bigbang.af.mil`
    199 
    200 into ~alias/.qmail-default.
    201 
    202 
    203 4.2. How do I set up a mailing list? I'd like me-sos@my.host.name to be
    204 forwarded to a bunch of people.
    205 
    206 Answer: Put a list of addresses into ~me/.qmail-sos, one per line. Then
    207 incoming mail for me-sos will be forwarded to each of those addresses.
    208 You should also touch ~me/.qmail-sos-owner so that bounces come back to
    209 you rather than the original sender.
    210 
    211 Alternative: ezmlm (<https://cr.yp.to/ezmlm.html>) is a modern
    212 mailing list manager, supporting automatic subscriptions, confirmations,
    213 archives, fully automatic bounce handling (including warnings to
    214 subscribers saying which messages they've missed), and more.
    215 
    216 
    217 4.3. How do I use majordomo with qmail?
    218 
    219 Answer: See <ftp://ftp.eyrie.org/pub/software/majordomo/mjqmail> and
    220 <http://www.qmail.org> for various methods. majordomo 2.0 is expected to
    221 support qmail directly.
    222 
    223 Beware that majordomo's lists are not crashproof.
    224 
    225 
    226 
    227 4.4. How do I use procmail with qmail?
    228 
    229 Answer: Put 
    230 
    231    `| preline procmail`
    232 
    233 into ~/.qmail. You'll have to use a full path for procmail unless
    234 procmail is in the system's startup PATH. Note that procmail will try to
    235 deliver to /var/spool/mail/$USER by default; to change this, see
    236 INSTALL.mbox.md.
    237 
    238 
    239 4.5. How do I use elm's filter with qmail?
    240 
    241 Answer: Put 
    242 
    243    `| preline filter`
    244 
    245 into ~/.qmail. You'll have to use a full path for filter unless filter
    246 is in the system's startup PATH.
    247 
    248 
    249 4.6. How do I create aliases with dots? I tried setting up
    250 ~alias/.qmail-P.D.Q.Bach, but it doesn't do anything.
    251 
    252 Answer: Use .qmail-p:d:q:bach. Dots are converted to colons, and
    253 uppercase is converted to lowercase.
    254 
    255 
    256 4.7. How do I use sendmail's .forward files with qmail?
    257 
    258 Answer: Install the dot-forward package
    259 (<https://cr.yp.to/dot-forward.html>).
    260 
    261 
    262 4.8. How do I use sendmail's /etc/aliases with qmail?
    263 
    264 Answer: Install the fastforward package
    265 (<https://cr.yp.to/fastforward.html>).
    266 
    267 
    268 To make majordomo 1.94.* work with qmail under fastforward, insert
    269 
    270    `# system("newinclude","$listdir/$clean_list");`
    271 
    272 before the lclose(LIST) line in do_subscribe and do_unsubscribe in
    273 majordomo. See <ftp://ftp.eyrie.org/pub/software/majordomo/mjqmail>
    274 and <http://www.qmail.org> for other methods of using majordomo with
    275 qmail. majordomo 2.0 is expected to support qmail directly.
    276 
    277 4.9. How do I make qmail defer messages during NFS or NIS outages? If
    278 ~joe suddenly disappears, I'd like mail for joe to be deferred.
    279 
    280 Answer: Build a qmail-users database, so that qmail no longer checks
    281 home directories and the password database. This takes three steps.
    282 First, put your complete user list (including local and NIS passwords)
    283 into /var/qmail/users/passwd. Second, run
    284 
    285    `# qmail-pw2u -h < /var/qmail/users/passwd > /var/qmail/users/assign`
    286 
    287 Here -h means that every user must have a home directory; if you happen
    288 to run qmail-pw2u during an NFS outage, it will print an error message
    289 and stop. Third, run
    290 
    291    `# qmail-newu`
    292 
    293 Make sure to rebuild the database whenever you change your user list.
    294 
    295 
    296 4.10. How do I change which account controls an address? I set up
    297 ~alias/.qmail-www, but qmail is looking at ~www/.qmail instead.
    298 
    299 Answer: If you do
    300 
    301    `# chown root ~www`
    302 
    303 then qmail will no longer consider www to be a user; see qmail-getpw.0.
    304 For more precise control over address assignments, see qmail-users.0.
    305 
    306 
    307 
    308 5. Setting up servers
    309 
    310 
    311 5.1. How do I run qmail-smtpd under tcpserver? inetd is barfing at high
    312 loads, cutting off service for ten-minute stretches. I'd also like
    313 better connection logging.
    314 
    315 Answer: Install ucspi-tcp (<https://cr.yp.to/ucspi-tcp.html>). Remove the
    316 smtp line from /etc/inetd.conf, and put the two lines
    317 
    318    ```
    319    tcpserver -v -u 7770 -g 2108 0 smtp /var/qmail/bin/qmail-smtpd \
    320    2>&1 | /var/qmail/bin/splogger smtpd 3 &
    321    ```
    322 
    323 into your system startup files. Replace 7770 with your qmaild uid, and
    324 replace 2108 with your nofiles gid. Don't forget the &. The change will
    325 take effect at your next reboot.
    326 
    327 By default, tcpserver allows at most 40 simultaneous qmail-smtpd
    328 processes. To raise this limit to 400, use tcpserver -c 400.
    329 
    330 
    331 5.2. How do I set up qmail-qmtpd?
    332 
    333 Answer: Two steps. First, put a
    334 
    335    `qmtp 209/tcp`
    336 
    337 line into /etc/services. Second, put (all on one line)
    338 
    339    ```
    340    qmtp stream tcp nowait qmaild
    341    /var/qmail/bin/tcp-env tcp-env /var/qmail/bin/qmail-qmtpd
    342    ```
    343 
    344 into /etc/inetd.conf, and give inetd a HUP.
    345 
    346 If you have tcpserver installed, skip the inetd step, and set up
    347 
    348    `tcpserver -u 7770 -g 2108 0 qmtp /var/qmail/bin/qmail-qmtpd &`
    349 
    350 replacing 7770 and 2108 with the qmaild uid and nofiles gid. See
    351 question 5.1 for more details on tcpserver.
    352 
    353 
    354 5.3. How do I set up qmail-pop3d? My old POP server works with mbox
    355 delivery; I'd like to switch to maildir delivery.
    356 
    357 Answer: Install ucspi-tcp (<https://cr.yp.to/ucspi-tcp.html>) and
    358 checkpassword (<https://cr.yp.to/checkpwd.html>). Put
    359 
    360    ```
    361    tcpserver 0 110 /var/qmail/bin/qmail-popup YOURHOST \
    362    /bin/checkpassword /var/qmail/bin/qmail-pop3d Maildir &
    363    ```
    364 
    365 (on two lines) into your system boot scripts; replace YOURHOST with your
    366 host's fully qualified domain name. Set up Maildir delivery for any user
    367 who wants to read mail via POP. The new service will start after you
    368 reboot.
    369 
    370 Security note: You should do this only within a secure network; otherwise
    371 an eavesdropper can steal passwords.
    372 
    373 There are several programs that can be substituted for checkpassword.
    374 See <https://cr.yp.to/qmail/toaster.html> for more information.
    375 
    376 
    377 5.4. How do I allow selected clients to use this host as a relay? I see
    378 that qmail-smtpd rejects messages to any host not listed in
    379 control/rcpthosts.
    380 
    381 Answer: Three steps. First, install tcp-wrappers, available separately,
    382 including hosts_options. Second, change your qmail-smtpd line in
    383 inetd.conf to
    384 
    385    ```
    386    smtp stream tcp nowait qmaild /usr/local/bin/tcpd
    387    /var/qmail/bin/tcp-env /var/qmail/bin/qmail-smtpd
    388    ```
    389 
    390 (all on one line) and give inetd a HUP. Third, in tcpd's hosts.allow,
    391 make a line setting the environment variable RELAYCLIENT to the empty
    392 string for the selected clients:
    393 
    394    `tcp-env: 1.2.3.4, 1.2.3.5: setenv = RELAYCLIENT`
    395 
    396 Here 1.2.3.4 and 1.2.3.5 are the clients' IP addresses. qmail-smtpd
    397 ignores control/rcpthosts when RELAYCLIENT is set. (It also appends
    398 RELAYCLIENT to each envelope recipient address. See question 5.5 for an
    399 application.)
    400 
    401 Alternative procedure, if you are using tcpserver 0.80 or above: Create
    402 /etc/tcp.smtp containing
    403 
    404    ```
    405    1.2.3.6:allow,RELAYCLIENT=""
    406    127.:allow,RELAYCLIENT=""
    407    ```
    408 
    409 to allow clients with IP addresses 1.2.3.6 and 127.*. Run
    410 
    411    `tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp`
    412 
    413 Finally, insert
    414 
    415    `-x /etc/tcp.smtp.cdb`
    416 
    417 after tcpserver in your qmail-smtpd invocation.
    418 
    419 
    420 5.5. How do I fix up messages from broken SMTP clients?
    421 
    422 Answer: Three steps. First, put
    423 
    424    ```
    425    | bouncesaying 'Permission denied' [ "@$HOST" != "@fixme" ]
    426    | qmail-inject -f "$SENDER" -- "$DEFAULT"
    427    ```
    428 
    429 into ~alias/.qmail-fixup-default. Second, put
    430 
    431    `fixme:fixup`
    432 
    433 into /var/qmail/control/virtualdomains, and give qmail-send a HUP.
    434 Third, follow the procedure in question 5.4, but set RELAYCLIENT to the
    435 string "@fixme":
    436 
    437    `tcp-env: 1.2.3.6, 1.2.3.7: setenv = RELAYCLIENT @fixme`
    438 
    439 Here 1.2.3.6 and 1.2.3.7 are the clients' IP addresses. If you are using
    440 tcpserver instead of inetd and tcpd, put
    441 
    442    ```
    443    1.2.3.6:allow,RELAYCLIENT="@fixme"
    444    1.2.3.7:allow,RELAYCLIENT="@fixme"
    445    ```
    446 
    447 into /etc/tcp.smtp, and run tcprules as in question 5.4.
    448 
    449 
    450 5.6. How do I set up qmail-qmqpd? I'd like to allow fast queueing of
    451 outgoing mail from authorized clients.
    452 
    453 Answer: Make sure you have installed tcpserver 0.80 or above. Create
    454 /etc/qmqp.tcp in tcprules format to allow connections from authorized
    455 hosts. For example, if queueing is allowed from 1.2.3.*:
    456 
    457    ```
    458    1.2.3.:allow
    459    :deny
    460    ```
    461 
    462 Convert /etc/qmqp.tcp to /etc/qmqp.cdb:
    463 
    464    `tcprules /etc/qmqp.cdb /etc/qmqp.tmp < /etc/qmqp.tcp`
    465 
    466 Finally, set up
    467 
    468    `tcpserver -x /etc/qmqp.cdb -u 7770 -g 2108 0 628 /var/qmail/bin/qmail-qmqpd &`
    469 
    470 replacing 7770 and 2108 with the qmaild uid and nofiles gid. See
    471 question 5.1 for more details on tcpserver.
    472 
    473 
    474 
    475 6. Configuring MUAs to work with qmail
    476 
    477 
    478 6.1. How do I make BSD mail generate a Date with the local time zone?
    479 When I send mail, I'd rather use the local time zone than GMT, since
    480 some MUAs don't know how to display Date in the receiver's time zone.
    481 
    482 Answer: Put
    483 
    484    `set sendmail=/var/qmail/bin/datemail`
    485 
    486 into your .mailrc or your system-wide Mail.rc. Beware that BSD mail is
    487 neither secure nor reliable.
    488 
    489 
    490 6.2. How do I make pine work with qmail?
    491 
    492 Answer: Put
    493 
    494    `sendmail-path=/usr/lib/sendmail -oem -oi -t`
    495 
    496 into /usr/local/lib/pine.conf. (This will work with sendmail too.)
    497 Beware that pine is neither secure nor reliable.
    498 
    499 
    500 6.3. How do I make MH work with qmail?
    501 
    502 Answer: Put
    503 
    504    `postproc: /usr/mh/lib/spost`
    505 
    506 into each user's .mh_profile. (This will work with sendmail too.) Beware
    507 that MH is neither secure nor reliable.
    508 
    509 
    510 6.4. How do I stop Sun's dtcm from hanging?
    511 
    512 Answer: There is a novice programming error in dtcm, known as "failure
    513 to close the output side of the pipe in the child." Sun has, at the
    514 time of this writing, not yet provided a patch. Sorry.
    515 
    516 
    517 
    518 7. Managing the mail system
    519 
    520 
    521 7.1. How do I safely stop qmail-send? Back when we were running
    522 sendmail, it was always tricky to kill sendmail without risking the loss
    523 of current deliveries; what should I do with qmail-send?
    524 
    525 Answer: Go ahead and kill the qmail-send process. It will shut down
    526 cleanly. Wait for "exiting" to show up in the log. To restart qmail,
    527 run /var/qmail/rc the same way it is run from your system boot scripts,
    528 with the proper PATH, resource limits, etc.
    529 
    530 Alternative, if qmail is supervised: svc -t /var/run/qmail. The
    531 supervise process will kill qmail, wait for it to stop, and restart it.
    532 Use -d instead of -t if you don't want qmail to restart automatically;
    533 to manually restart it, use -u.
    534 
    535 
    536 7.2. How do I manually run the queue? I'd like qmail to try delivering
    537 all the remote messages right now.
    538 
    539 Answer: Give the qmail-send process an ALRM. (Do svc -a /var/run/qmail
    540 if qmail is supervised.)
    541 
    542 You may want to run qmail-tcpok first, to guarantee that qmail-remote
    543 will try all addresses. Normally, if an address fails repeatedly,
    544 qmail-remote leaves it alone for an hour.
    545 
    546 
    547 7.3. How do I rejuvenate a message? Somebody broke into Eric's computer
    548 again; it's going to be down for at least another two days. I know Eric
    549 has been expecting an important message -- in fact, I see it sitting here
    550 in /var/qmail/queue/mess/15/26902. It's been in the queue for six days;
    551 how can I make sure it isn't bounced tomorrow?
    552 
    553 Answer: Just touch /var/qmail/queue/info/15/26902. (This is the only
    554 form of queue modification that's safe while qmail is running.)
    555 
    556 
    557 7.4. How do I organize a big network? I have a lot of machines, and I
    558 don't know where to start.
    559 
    560 Answer: First, choose the domain name where your users will receive
    561 mail. This is normally the shortest domain name you control. If you are
    562 in charge of *.movie.edu, you can use addresses like joe@movie.edu.
    563 
    564 Second, choose the machine that will know what to do with different
    565 users at movie.edu. Set up a host name in DNS for this machine:
    566 
    567    ```
    568    mailhost.movie.edu IN A 1.2.3.4
    569    4.3.2.1.in-addr.arpa IN PTR mailhost.movie.edu
    570    ```
    571 
    572 Here 1.2.3.4 is the IP address of that machine.
    573 
    574 Third, make a list of machines where mail should end up. For example, if
    575 mail for Bob should end up on Bob's workstation, put Bob's workstation
    576 onto the list. For each of these machines, set up a host name in DNS:
    577 
    578    ```
    579    bobshost.movie.edu IN A 1.2.3.7
    580    7.3.2.1.in-addr.arpa IN PTR bobshost.movie.edu
    581    ```
    582 
    583 Fourth, install qmail on bobshost.movie.edu. qmail will automatically
    584 configure itself to accept messages for bob@bobshost.movie.edu and
    585 deliver them to ~bob/Mailbox on bobshost. Do the same for the other
    586 machines where mail should end up.
    587 
    588 Fifth, install qmail on mailhost.movie.edu. Put
    589 
    590    `movie.edu:alias-movie`
    591 
    592 into control/virtualdomains on mailhost. Then forward bob@movie.edu to
    593 bob@bobshost.movie.edu, by putting
    594 
    595    `bob@bobshost.movie.edu`
    596 
    597 into ~alias/.qmail-movie-bob. Do the same for other users.
    598 
    599 Sixth, put movie.edu into control/rcpthosts on mailhost.movie.edu, so
    600 that mailhost.movie.edu will accept messages for users at movie.edu.
    601 
    602 Seventh, set up an MX record in DNS to deliver movie.edu messages to
    603 mailhost:
    604 
    605    `movie.edu IN MX 10 mailhost.movie.edu`
    606 
    607 Eighth, on all your machines, put movie.edu into control/defaulthost.
    608 
    609 
    610 7.5. How do I back up and restore the queue disk?
    611 
    612 Answer: You can't.
    613 
    614 One difficulty is that you can't get a consistent snapshot of the queue
    615 while qmail-send is running. Another difficulty is that messages in the
    616 queue must have filenames that match their inode numbers.
    617 
    618 However, the big problem is that backups -- even twice-daily backups -- 
    619 are far too unreliable for mail. If your disk dies, there will be very
    620 little overlap between the messages saved in the last backup and the
    621 messages that were lost.
    622 
    623 There are several ways to add real reliability to a mail server. Battery
    624 backups will keep your server alive, letting you park the disk to avoid
    625 a head crash, when the power goes out. Solid-state disks have their own
    626 battery backups. RAID boxes let you replace dead disks without losing
    627 any data.
    628 
    629 
    630 7.6. How do I run a supervised copy of qmail? svc sounds useful.
    631 
    632 Answer: Install daemontools (<https://cr.yp.to/daemontools.html>).
    633 Create a /var/run/qmail directory. Change
    634 
    635    `/var/qmail/rc`
    636 
    637 to
    638 
    639    `supervise /var/run/qmail /var/qmail/rc`
    640 
    641 in your boot scripts. Make sure that supervise is in the startup PATH.
    642 Now you can use svc to stop or restart qmail, and svstat to check
    643 whether qmail is running.
    644 
    645 
    646 7.7. How do I avoid syslog? It chews up a lot of CPU time and isn't
    647 reliable.
    648 
    649 Answer: Install daemontools (<https://cr.yp.to/daemontools.html>).
    650 Make a /var/log/qmail directory, owned by qmaill, mode 2700. Do
    651 
    652    ```
    653    qmail-start ./Mailbox /usr/local/bin/accustamp \
    654    | setuser qmaill /usr/local/bin/cyclog /var/log/qmail &
    655    ```
    656 
    657 in /var/qmail/rc.
    658 
    659 If you are logging tcpserver connections, make a /var/log/smtpd
    660 directory, and use cyclog /var/log/smtpd for tcpserver. You shouldn't
    661 run several copies of cyclog with the same log directory.
    662 
    663 By default, cyclog keeps 10 automatically rotated log files, each
    664 containing up to 100KB of log data. To keep 20 files with 1MB each, use
    665 cyclog -s 1000000 -n 20.
    666 
    667 
    668 
    669 8. Miscellany
    670 
    671 
    672 8.1. How do I tell qmail to do more deliveries at once? It's running
    673 only 20 parallel qmail-remote processes.
    674 
    675 Answer: Decide how many deliveries you want to allow at once. Put that
    676 number into control/concurrencyremote. Restart qmail-send as in question
    677 7.1. If your system has resource limits, make sure you set the
    678 descriptors limit to at least double the concurrency plus 5; otherwise
    679 you'll get lots of unnecessary deferrals whenever a big burst of mail
    680 shows up. Note that qmail also imposes a compile-time concurrency limit,
    681 120 by default; this is set in conf-spawn.
    682 
    683 
    684 8.2. How do I keep a copy of all incoming and outgoing mail messages?
    685 
    686 Answer: Set QUEUE_EXTRA to "Tlog\0" and QUEUE_EXTRALEN to 5 in extra.h.
    687 Recompile qmail. Put ./msg-log into ~alias/.qmail-log.
    688 
    689 You can also use QUEUE_EXTRA to, e.g., record the Message-ID of every
    690 message: run
    691 
    692    `| awk '/^$/ { exit } /^[mM][eE][sS][sS][aA][gG][eE]-/ { print }'`
    693 
    694 from ~alias/.qmail-log.
    695 
    696 
    697 8.3. How do I switch slowly from sendmail to qmail? I'm thinking of
    698 moving the heaven.af.mil network over to qmail, but first I'd like to
    699 give my users a chance to try out qmail without affecting current
    700 sendmail deliveries. We're using NFS.
    701 
    702 Answer: Find a host in your network, say pc.heaven.af.mil, that isn't
    703 running an SMTP server. (If addresses at pc.heaven.af.mil are used, you
    704 should already have an MX pointing pc.heaven.af.mil to your mail hub.)
    705 
    706 Set up a new MX record pointing lists.heaven.af.mil to pc.heaven.af.mil.
    707 Install qmail on pc.heaven.af.mil. Replace pc with lists in the control
    708 files. Make the qmail man pages available on all your machines.
    709 
    710 Now tell your users about qmail. A user can forward joe@heaven.af.mil to
    711 joe@lists.heaven.af.mil to get ~/Mailbox delivery; he can set up .qmail
    712 files; he can start running his own mailing lists @lists.heaven.af.mil.
    713 
    714 When you're ready to turn sendmail off, you can set up pc.heaven.af.mil
    715 as your new mail hub. Add heaven.af.mil to control/locals, and change
    716 the heaven.af.mil MX to point to pc.heaven.af.mil. Make sure you leave
    717 lists.heaven.af.mil in control/locals so that transition addresses will
    718 continue to work.