nightmaremail

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

commit b39f9cae21ae20f36b836f8811b08adcb7881178
parent b7fce5a9aba53123a8f8f2cb353d034cd0ce39c3
Author: Amitai Schleier <schmonz-web-git@schmonz.com>
Date:   Sat, 23 May 2020 16:53:25 +0200

Fix Markdown formatting in examples.

Diffstat:
MFAQ.md | 196+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
MINSTALL.ctl.md | 4++--
MINSTALL.ids.md | 30+++++++++++++++++++++---------
MINSTALL.maildir.md | 4+++-
MINSTALL.vsm.md | 2+-
MINTERNALS.md | 20+++++++++++++-------
MREMOVE.binmail.md | 3++-
MREMOVE.sendmail.md | 20++++++++++++++------
MTEST.deliver.md | 114+++++++++++++++++++++++++++++++++++++++++++++++++------------------------------
MTEST.receive.md | 48++++++++++++++++++++++++++----------------------
MUPGRADE.md | 12++++++++----
11 files changed, 272 insertions(+), 181 deletions(-)

diff --git a/FAQ.md b/FAQ.md @@ -1,62 +1,62 @@ See <https://cr.yp.to/qmail/faq.html> for newer FAQs not included in this document, and <http://qmail.org/> for qmail community contributions. -1. Controlling the appearance of outgoing messages -1.1. How do I set up host masquerading? -1.2. How do I set up user masquerading? -1.3. How do I set up Mail-Followup-To automatically? - -2. Routing outgoing messages -2.1. How do I send local messages to another host? -2.2. How do I set up a null client? -2.3. How do I send outgoing mail through UUCP? -2.4. How do I set up a separate queue for a SLIP/PPP link? -2.5. How do I deal with "CNAME lookup failed temporarily"? - -3. Routing incoming messages by host -3.1. How do I receive mail for another host name? -3.2. How do I set up a virtual domain? -3.3. How do I set up several virtual domains for one user? - -4. Routing incoming messages by user -4.1. How do I forward unrecognized usernames to another host? -4.2. How do I set up a mailing list? -4.3. How do I use majordomo with qmail? -4.4. How do I use procmail with qmail? -4.5. How do I use elm's filter with qmail? -4.6. How do I create aliases with dots? -4.7. How do I use sendmail's .forward files with qmail? -4.8. How do I use sendmail's /etc/aliases with qmail? -4.9. How do I make qmail defer messages during NFS or NIS outages? -4.10. How do I change which account controls an address? - -5. Setting up servers -5.1. How do I run qmail-smtpd under tcpserver? -5.2. How do I set up qmail-qmtpd? -5.3. How do I set up qmail-pop3d? -5.4. How do I allow selected clients to use this host as a relay? -5.5. How do I fix up messages from broken SMTP clients? -5.6. How do I set up qmail-qmqpd? - -6. Configuring MUAs to work with qmail -6.1. How do I make BSD mail generate a Date with the local time zone? -6.2. How do I make pine work with qmail? -6.3. How do I make MH work with qmail? -6.4. How do I stop Sun's dtcm from hanging? - -7. Managing the mail system -7.1. How do I safely stop qmail-send? -7.2. How do I manually run the queue? -7.3. How do I rejuvenate a message? -7.4. How do I organize a big network? -7.5. How do I back up and restore the queue disk? -7.6. How do I run a supervised copy of qmail? -7.7. How do I avoid syslog? - -8. Miscellany -8.1. How do I tell qmail to do more deliveries at once? -8.2. How do I keep a copy of all incoming and outgoing mail messages? -8.3. How do I switch slowly from sendmail to qmail? +1. Controlling the appearance of outgoing messages +1.1. How do I set up host masquerading? +1.2. How do I set up user masquerading? +1.3. How do I set up Mail-Followup-To automatically? + +2. Routing outgoing messages +2.1. How do I send local messages to another host? +2.2. How do I set up a null client? +2.3. How do I send outgoing mail through UUCP? +2.4. How do I set up a separate queue for a SLIP/PPP link? +2.5. How do I deal with "CNAME lookup failed temporarily"? + +3. Routing incoming messages by host +3.1. How do I receive mail for another host name? +3.2. How do I set up a virtual domain? +3.3. How do I set up several virtual domains for one user? + +4. Routing incoming messages by user +4.1. How do I forward unrecognized usernames to another host? +4.2. How do I set up a mailing list? +4.3. How do I use majordomo with qmail? +4.4. How do I use procmail with qmail? +4.5. How do I use elm's filter with qmail? +4.6. How do I create aliases with dots? +4.7. How do I use sendmail's .forward files with qmail? +4.8. How do I use sendmail's /etc/aliases with qmail? +4.9. How do I make qmail defer messages during NFS or NIS outages? +4.10. How do I change which account controls an address? + +5. Setting up servers +5.1. How do I run qmail-smtpd under tcpserver? +5.2. How do I set up qmail-qmtpd? +5.3. How do I set up qmail-pop3d? +5.4. How do I allow selected clients to use this host as a relay? +5.5. How do I fix up messages from broken SMTP clients? +5.6. How do I set up qmail-qmqpd? + +6. Configuring MUAs to work with qmail +6.1. How do I make BSD mail generate a Date with the local time zone? +6.2. How do I make pine work with qmail? +6.3. How do I make MH work with qmail? +6.4. How do I stop Sun's dtcm from hanging? + +7. Managing the mail system +7.1. How do I safely stop qmail-send? +7.2. How do I manually run the queue? +7.3. How do I rejuvenate a message? +7.4. How do I organize a big network? +7.5. How do I back up and restore the queue disk? +7.6. How do I run a supervised copy of qmail? +7.7. How do I avoid syslog? + +8. Miscellany +8.1. How do I tell qmail to do more deliveries at once? +8.2. How do I keep a copy of all incoming and outgoing mail messages? +8.3. How do I switch slowly from sendmail to qmail? @@ -117,12 +117,14 @@ outgoing mail via UUCP to my upstream UUCP site, gonzo. Answer: Put - :alias-uucp + `:alias-uucp` into control/virtualdomains and + ``` |preline -df /usr/bin/uux - -r -gC -a"${SENDER:-MAILER-DAEMON}" gonzo!rmail "($DEFAULT@$HOST)" + ``` (all on one line) into ~alias/.qmail-uucp-default. (For some UUCP software you will need to use -d instead of -df.) If qmail-send is @@ -164,7 +166,7 @@ so on, to be delivered to Bob. I've set up the MX already. Answer: Put - nowhere.mil:bob + `nowhere.mil:bob` into control/virtualdomains. Add nowhere.mil to control/rcpthosts. If qmail-send is running, give it a HUP (or do svc -h /var/run/qmail if @@ -182,8 +184,10 @@ that without setting up a second account? Answer: Put two lines into control/virtualdomains: + ``` nowhere.mil:bob-nowhere everywhere.org:bob-everywhere + ``` Add nowhere.mil and everywhere.org to control/rcpthosts. If qmail-send is running, give it a HUP (or do svc -h /var/run/qmail if qmail is @@ -202,7 +206,7 @@ to set up a LUSER_RELAY pointing at bigbang.af.mil. Answer: Put - | forward "$LOCAL"@bigbang.af.mil + `| forward "$LOCAL"@bigbang.af.mil` into ~alias/.qmail-default. @@ -235,7 +239,7 @@ Beware that majordomo's lists are not crashproof. Answer: Put - | preline procmail + `| preline procmail` into ~/.qmail. You'll have to use a full path for procmail unless procmail is in the system's startup PATH. Note that procmail will try to @@ -247,7 +251,7 @@ INSTALL.mbox.md. Answer: Put - | preline filter + `| preline filter` into ~/.qmail. You'll have to use a full path for filter unless filter is in the system's startup PATH. @@ -274,7 +278,7 @@ Answer: Install the fastforward package To make majordomo 1.94.* work with qmail under fastforward, insert - # system("newinclude","$listdir/$clean_list"); + `# system("newinclude","$listdir/$clean_list");` before the lclose(LIST) line in do_subscribe and do_unsubscribe in majordomo. See <ftp://ftp.eyrie.org/pub/software/majordomo/mjqmail> @@ -289,13 +293,13 @@ home directories and the password database. This takes three steps. First, put your complete user list (including local and NIS passwords) into /var/qmail/users/passwd. Second, run - # qmail-pw2u -h < /var/qmail/users/passwd > /var/qmail/users/assign + `# qmail-pw2u -h < /var/qmail/users/passwd > /var/qmail/users/assign` Here -h means that every user must have a home directory; if you happen to run qmail-pw2u during an NFS outage, it will print an error message and stop. Third, run - # qmail-newu + `# qmail-newu` Make sure to rebuild the database whenever you change your user list. @@ -305,7 +309,7 @@ Make sure to rebuild the database whenever you change your user list. Answer: If you do - # chown root ~www + `# chown root ~www` then qmail will no longer consider www to be a user; see qmail-getpw.0. For more precise control over address assignments, see qmail-users.0. @@ -322,8 +326,10 @@ better connection logging. Answer: Install ucspi-tcp (<https://cr.yp.to/ucspi-tcp.html>). Remove the smtp line from /etc/inetd.conf, and put the two lines + ``` tcpserver -v -u 7770 -g 2108 0 smtp /var/qmail/bin/qmail-smtpd \ 2>&1 | /var/qmail/bin/splogger smtpd 3 & + ``` into your system startup files. Replace 7770 with your qmaild uid, and replace 2108 with your nofiles gid. Don't forget the &. The change will @@ -337,18 +343,20 @@ processes. To raise this limit to 400, use tcpserver -c 400. Answer: Two steps. First, put a - qmtp 209/tcp + `qmtp 209/tcp` line into /etc/services. Second, put (all on one line) + ``` qmtp stream tcp nowait qmaild /var/qmail/bin/tcp-env tcp-env /var/qmail/bin/qmail-qmtpd + ``` into /etc/inetd.conf, and give inetd a HUP. If you have tcpserver installed, skip the inetd step, and set up - tcpserver -u 7770 -g 2108 0 qmtp /var/qmail/bin/qmail-qmtpd & + `tcpserver -u 7770 -g 2108 0 qmtp /var/qmail/bin/qmail-qmtpd &` replacing 7770 and 2108 with the qmaild uid and nofiles gid. See question 5.1 for more details on tcpserver. @@ -360,8 +368,10 @@ delivery; I'd like to switch to maildir delivery. Answer: Install ucspi-tcp (<https://cr.yp.to/ucspi-tcp.html>) and checkpassword (<https://cr.yp.to/checkpwd.html>). Put - tcpserver 0 110 /var/qmail/bin/qmail-popup YOURHOST \ - /bin/checkpassword /var/qmail/bin/qmail-pop3d Maildir & + ``` + tcpserver 0 110 /var/qmail/bin/qmail-popup YOURHOST \ + /bin/checkpassword /var/qmail/bin/qmail-pop3d Maildir & + ``` (on two lines) into your system boot scripts; replace YOURHOST with your host's fully qualified domain name. Set up Maildir delivery for any user @@ -383,14 +393,16 @@ Answer: Three steps. First, install tcp-wrappers, available separately, including hosts_options. Second, change your qmail-smtpd line in inetd.conf to + ``` smtp stream tcp nowait qmaild /usr/local/bin/tcpd /var/qmail/bin/tcp-env /var/qmail/bin/qmail-smtpd + ``` (all on one line) and give inetd a HUP. Third, in tcpd's hosts.allow, make a line setting the environment variable RELAYCLIENT to the empty string for the selected clients: - tcp-env: 1.2.3.4, 1.2.3.5: setenv = RELAYCLIENT + `tcp-env: 1.2.3.4, 1.2.3.5: setenv = RELAYCLIENT` Here 1.2.3.4 and 1.2.3.5 are the clients' IP addresses. qmail-smtpd ignores control/rcpthosts when RELAYCLIENT is set. (It also appends @@ -400,16 +412,18 @@ application.) Alternative procedure, if you are using tcpserver 0.80 or above: Create /etc/tcp.smtp containing + ``` 1.2.3.6:allow,RELAYCLIENT="" 127.:allow,RELAYCLIENT="" + ``` to allow clients with IP addresses 1.2.3.6 and 127.*. Run - tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp + `tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp` Finally, insert - -x /etc/tcp.smtp.cdb + `-x /etc/tcp.smtp.cdb` after tcpserver in your qmail-smtpd invocation. @@ -418,24 +432,28 @@ after tcpserver in your qmail-smtpd invocation. Answer: Three steps. First, put + ``` | bouncesaying 'Permission denied' [ "@$HOST" != "@fixme" ] | qmail-inject -f "$SENDER" -- "$DEFAULT" + ``` into ~alias/.qmail-fixup-default. Second, put - fixme:fixup + `fixme:fixup` into /var/qmail/control/virtualdomains, and give qmail-send a HUP. Third, follow the procedure in question 5.4, but set RELAYCLIENT to the string "@fixme": - tcp-env: 1.2.3.6, 1.2.3.7: setenv = RELAYCLIENT @fixme + `tcp-env: 1.2.3.6, 1.2.3.7: setenv = RELAYCLIENT @fixme` Here 1.2.3.6 and 1.2.3.7 are the clients' IP addresses. If you are using tcpserver instead of inetd and tcpd, put + ``` 1.2.3.6:allow,RELAYCLIENT="@fixme" 1.2.3.7:allow,RELAYCLIENT="@fixme" + ``` into /etc/tcp.smtp, and run tcprules as in question 5.4. @@ -447,16 +465,18 @@ Answer: Make sure you have installed tcpserver 0.80 or above. Create /etc/qmqp.tcp in tcprules format to allow connections from authorized hosts. For example, if queueing is allowed from 1.2.3.*: + ``` 1.2.3.:allow :deny + ``` Convert /etc/qmqp.tcp to /etc/qmqp.cdb: - tcprules /etc/qmqp.cdb /etc/qmqp.tmp < /etc/qmqp.tcp + `tcprules /etc/qmqp.cdb /etc/qmqp.tmp < /etc/qmqp.tcp` Finally, set up - tcpserver -x /etc/qmqp.cdb -u 7770 -g 2108 0 628 /var/qmail/bin/qmail-qmqpd & + `tcpserver -x /etc/qmqp.cdb -u 7770 -g 2108 0 628 /var/qmail/bin/qmail-qmqpd &` replacing 7770 and 2108 with the qmaild uid and nofiles gid. See question 5.1 for more details on tcpserver. @@ -472,7 +492,7 @@ some MUAs don't know how to display Date in the receiver's time zone. Answer: Put - set sendmail=/var/qmail/bin/datemail + `set sendmail=/var/qmail/bin/datemail` into your .mailrc or your system-wide Mail.rc. Beware that BSD mail is neither secure nor reliable. @@ -482,7 +502,7 @@ neither secure nor reliable. Answer: Put - sendmail-path=/usr/lib/sendmail -oem -oi -t + `sendmail-path=/usr/lib/sendmail -oem -oi -t` into /usr/local/lib/pine.conf. (This will work with sendmail too.) Beware that pine is neither secure nor reliable. @@ -492,7 +512,7 @@ Beware that pine is neither secure nor reliable. Answer: Put - postproc: /usr/mh/lib/spost + `postproc: /usr/mh/lib/spost` into each user's .mh_profile. (This will work with sendmail too.) Beware that MH is neither secure nor reliable. @@ -555,8 +575,10 @@ in charge of *.movie.edu, you can use addresses like joe@movie.edu. Second, choose the machine that will know what to do with different users at movie.edu. Set up a host name in DNS for this machine: + ``` mailhost.movie.edu IN A 1.2.3.4 4.3.2.1.in-addr.arpa IN PTR mailhost.movie.edu + ``` Here 1.2.3.4 is the IP address of that machine. @@ -564,8 +586,10 @@ Third, make a list of machines where mail should end up. For example, if mail for Bob should end up on Bob's workstation, put Bob's workstation onto the list. For each of these machines, set up a host name in DNS: + ``` bobshost.movie.edu IN A 1.2.3.7 7.3.2.1.in-addr.arpa IN PTR bobshost.movie.edu + ``` Fourth, install qmail on bobshost.movie.edu. qmail will automatically configure itself to accept messages for bob@bobshost.movie.edu and @@ -574,12 +598,12 @@ machines where mail should end up. Fifth, install qmail on mailhost.movie.edu. Put - movie.edu:alias-movie + `movie.edu:alias-movie` into control/virtualdomains on mailhost. Then forward bob@movie.edu to bob@bobshost.movie.edu, by putting - bob@bobshost.movie.edu + `bob@bobshost.movie.edu` into ~alias/.qmail-movie-bob. Do the same for other users. @@ -589,7 +613,7 @@ that mailhost.movie.edu will accept messages for users at movie.edu. Seventh, set up an MX record in DNS to deliver movie.edu messages to mailhost: - movie.edu IN MX 10 mailhost.movie.edu + `movie.edu IN MX 10 mailhost.movie.edu` Eighth, on all your machines, put movie.edu into control/defaulthost. @@ -619,11 +643,11 @@ any data. Answer: Install daemontools (<https://cr.yp.to/daemontools.html>). Create a /var/run/qmail directory. Change - /var/qmail/rc + `/var/qmail/rc` to - supervise /var/run/qmail /var/qmail/rc + `supervise /var/run/qmail /var/qmail/rc` in your boot scripts. Make sure that supervise is in the startup PATH. Now you can use svc to stop or restart qmail, and svstat to check @@ -636,8 +660,10 @@ reliable. Answer: Install daemontools (<https://cr.yp.to/daemontools.html>). Make a /var/log/qmail directory, owned by qmaill, mode 2700. Do + ``` qmail-start ./Mailbox /usr/local/bin/accustamp \ | setuser qmaill /usr/local/bin/cyclog /var/log/qmail & + ``` in /var/qmail/rc. @@ -674,7 +700,7 @@ Recompile qmail. Put ./msg-log into ~alias/.qmail-log. You can also use QUEUE_EXTRA to, e.g., record the Message-ID of every message: run - | awk '/^$/ { exit } /^[mM][eE][sS][sS][aA][gG][eE]-/ { print }' + `| awk '/^$/ { exit } /^[mM][eE][sS][sS][aA][gG][eE]-/ { print }'` from ~alias/.qmail-log. diff --git a/INSTALL.ctl.md b/INSTALL.ctl.md @@ -13,7 +13,7 @@ configuration right now. You can always come back and tune things later. There's one big exception. You MUST tell qmail your hostname. Just run the config-fast script: - # ./config-fast your.full.host.name + `# ./config-fast your.full.host.name` config-fast puts your.full.host.name into control/me. It also puts it into control/locals and control/rcpthosts, so that qmail will accept @@ -22,7 +22,7 @@ mail for your.full.host.name. You can instead use the config script, which looks up your host name in DNS: - # ./config + `# ./config` config also looks up your local IP addresses in DNS to decide which hosts to accept mail for. diff --git a/INSTALL.ids.md b/INSTALL.ids.md @@ -3,6 +3,7 @@ Here's how to set up the qmail groups and the qmail users. On some systems there are commands that make this easy. Solaris and Linux: + ``` # groupadd nofiles # useradd -g nofiles -d /var/qmail/alias alias # useradd -g nofiles -d /var/qmail qmaild @@ -12,9 +13,11 @@ Linux: # useradd -g qmail -d /var/qmail qmailq # useradd -g qmail -d /var/qmail qmailr # useradd -g qmail -d /var/qmail qmails + ``` FreeBSD 2.2: + ``` # pw groupadd nofiles # pw useradd alias -g nofiles -d /var/qmail/alias -s /nonexistent # pw useradd qmaild -g nofiles -d /var/qmail -s /nonexistent @@ -24,9 +27,11 @@ FreeBSD 2.2: # pw useradd qmailq -g qmail -d /var/qmail -s /nonexistent # pw useradd qmailr -g qmail -d /var/qmail -s /nonexistent # pw useradd qmails -g qmail -d /var/qmail -s /nonexistent + ``` BSDI 2.0: + ``` # addgroup nofiles # adduser -g nofiles -H/var/qmail/alias -G,,, -s/dev/null -P'*' alias # adduser -g nofiles -H/var/qmail -G,,, -s/dev/null -P'*' qmaild @@ -36,9 +41,11 @@ BSDI 2.0: # adduser -g qmail -H/var/qmail -G,,, -s/dev/null -P'*' qmailq # adduser -g qmail -H/var/qmail -G,,, -s/dev/null -P'*' qmailr # adduser -g qmail -H/var/qmail -G,,, -s/dev/null -P'*' qmails + ``` AIX: + ``` # mkgroup -A nofiles # mkuser pgrp=nofiles home=/var/qmail/alias shell=/bin/true alias # mkuser pgrp=nofiles home=/var/qmail shell=/bin/true qmaild @@ -48,23 +55,28 @@ AIX: # mkuser pgrp=qmail home=/var/qmail shell=/bin/true qmailq # mkuser pgrp=qmail home=/var/qmail shell=/bin/true qmailr # mkuser pgrp=qmail home=/var/qmail shell=/bin/true qmails + ``` On other systems, you will have to edit /etc/group and /etc/passwd manually. First add two new lines to /etc/group, something like - qmail:*:2107: - nofiles:*:2108: + ``` + qmail:*:2107: + nofiles:*:2108: + ``` where 2107 and 2108 are different from the other gids in /etc/group. Next (using vipw) add six new lines to /etc/passwd, something like - alias:*:7790:2108::/var/qmail/alias:/bin/true - qmaild:*:7791:2108::/var/qmail:/bin/true - qmaill:*:7792:2108::/var/qmail:/bin/true - qmailp:*:7793:2108::/var/qmail:/bin/true - qmailq:*:7794:2107::/var/qmail:/bin/true - qmailr:*:7795:2107::/var/qmail:/bin/true - qmails:*:7796:2107::/var/qmail:/bin/true + ``` + alias:*:7790:2108::/var/qmail/alias:/bin/true + qmaild:*:7791:2108::/var/qmail:/bin/true + qmaill:*:7792:2108::/var/qmail:/bin/true + qmailp:*:7793:2108::/var/qmail:/bin/true + qmailq:*:7794:2107::/var/qmail:/bin/true + qmailr:*:7795:2107::/var/qmail:/bin/true + qmails:*:7796:2107::/var/qmail:/bin/true + ``` where 7790 through 7796 are _new_ uids, 2107 is the qmail gid, and 2108 is the nofiles gid. Make sure you use the nofiles gid for qmaild, diff --git a/INSTALL.maildir.md b/INSTALL.maildir.md @@ -26,7 +26,7 @@ versions of your favorite MUAs, and to switch over to maildir as soon as you can. -2. Sun's Network F_ail_u_re System +2. Sun's Network Failure System Anyone who tells you that mail can be safely delivered in mbox format over NFS is pulling your leg -- as explained above, mbox format is @@ -44,8 +44,10 @@ home directory.) Here's how to set up qmail to use maildir for your incoming mail: + ``` % maildirmake $HOME/Maildir % echo ./Maildir/ > ~/.qmail + ``` Make sure you include the trailing slash on Maildir/. diff --git a/INSTALL.vsm.md b/INSTALL.vsm.md @@ -21,7 +21,7 @@ for the security or reliability of any of those tools. The qmail system is started from /var/qmail/rc with - qmail-start ./Mailbox splogger qmail + `qmail-start ./Mailbox splogger qmail` The first argument to qmail-start, ./Mailbox, is the default delivery instruction. You can change it to run a program such as binmail or diff --git a/INTERNALS.md b/INTERNALS.md @@ -2,9 +2,11 @@ Here's the data flow in the qmail suite: +``` qmail-smtpd --- qmail-queue --- qmail-send --- qmail-rspawn --- qmail-remote / | \ qmail-inject _/ qmail-clean \_ qmail-lspawn --- qmail-local +``` Every message is added to a central queue directory by qmail-queue. qmail-queue is invoked as needed, usually by qmail-inject for locally @@ -26,6 +28,7 @@ Each message in the queue is identified by a unique number, let's say 457. The queue is organized into several directories, each of which may contain files related to message 457: + ``` mess/457: the message todo/457: the envelope: where the message came from, where it's going intd/457: the envelope, under construction by qmail-queue @@ -33,15 +36,18 @@ contain files related to message 457: local/457: local envelope recipient addresses, after preprocessing remote/457: remote envelope recipient addresses, after preprocessing bounce/457: permanent delivery errors + ``` Here are all possible states for a message. + means a file exists; - means it does not exist; ? means it may or may not exist. + ``` S1. -mess -intd -todo -info -local -remote -bounce S2. +mess -intd -todo -info -local -remote -bounce S3. +mess +intd -todo -info -local -remote -bounce S4. +mess ?intd +todo ?info ?local ?remote -bounce (queued) S5. +mess -intd -todo +info ?local ?remote ?bounce (preprocessed) + ``` Guarantee: If mess/457 exists, it has inode number 457. @@ -84,13 +90,13 @@ At that instant the message has been successfully preprocessed. Messages at S5 are handled as follows. Each address in local/457 and remote/457 is marked either NOT DONE or DONE. - DONE: The message was successfully delivered, or the last delivery - attempt met with permanent failure. Either way, qmail-send - should not attempt further delivery to this address. - - NOT DONE: If there have been any delivery attempts, they have all - met with temporary failure. Either way, qmail-send should - try delivery in the future. +- DONE: The message was successfully delivered, or the last delivery + attempt met with permanent failure. Either way, qmail-send + should not attempt further delivery to this address. + +- NOT DONE: If there have been any delivery attempts, they have all + met with temporary failure. Either way, qmail-send should + try delivery in the future. qmail-send may at its leisure try to deliver a message to a NOT DONE address. If the message is successfully delivered, qmail-send marks the diff --git a/REMOVE.binmail.md b/REMOVE.binmail.md @@ -6,7 +6,8 @@ configured qmail to use binmail for local delivery. that exists, otherwise /bin/mail. 2. Remove permissions from the binmail binary: - # chmod 0 /usr/libexec/mail.local + + `# chmod 0 /usr/libexec/mail.local` 3. If the binmail binary was /bin/mail, make sure that "mail" still invokes a usable mailer. Under SVR4 you may want to link mail to diff --git a/REMOVE.sendmail.md b/REMOVE.sendmail.md @@ -2,7 +2,9 @@ Here's how to remove sendmail from your system. 1. Find sendmail in your boot scripts. It's usually in either /etc/rc or /etc/init.d/sendmail. It looks like - sendmail -bd -q15m + + `sendmail -bd -q15m` + -q15m means that it should run the queue every 15 minutes; you may see a different number. Comment out this line. @@ -19,10 +21,16 @@ Here's how to remove sendmail from your system. 4. Remove the setuid bit on the sendmail binary, to prevent local users from gaining extra privileges through sendmail's security holes. The binary may be at several different locations: - # chmod 0 /usr/lib/sendmail - # chmod 0 /usr/sbin/sendmail - # chmod 0 /usr/lib/sendmail.mx + + ``` + # chmod 0 /usr/lib/sendmail + # chmod 0 /usr/sbin/sendmail + # chmod 0 /usr/lib/sendmail.mx + ``` 5. Move the sendmail binary out of the way: - # mv /usr/lib/sendmail /usr/lib/sendmail.bak - # mv /usr/sbin/sendmail /usr/sbin/sendmail.bak + + ``` + # mv /usr/lib/sendmail /usr/lib/sendmail.bak + # mv /usr/sbin/sendmail /usr/sbin/sendmail.bak + ``` diff --git a/TEST.deliver.md b/TEST.deliver.md @@ -2,7 +2,9 @@ You can do several tests of qmail delivery without setting up qmail to accept messages through SMTP or through /usr/lib/sendmail: 1. After you start qmail, look for a - qmail: status: local 0/10 remote 0/20 + + `qmail: status: local 0/10 remote 0/20` + line in syslog. qmail-send always prints either "cannot start" or "status". (The big number is a splogger timestamp.) @@ -13,70 +15,96 @@ accept messages through SMTP or through /usr/lib/sendmail: 3. Local-local test: Send yourself an empty message. (Replace "me" with your username. Make sure to include the "to:" colon.) - % echo to: me | /var/qmail/bin/qmail-inject + + `% echo to: me | /var/qmail/bin/qmail-inject` + The message will show up immediately in your mailbox, and syslog will show something like this: - qmail: new msg 53 - qmail: info msg 53: bytes 246 from <me@domain> qp 20345 uid 666 - qmail: starting delivery 1: msg 53 to local me@domain - qmail: status: local 1/10 remote 0/20 - qmail: delivery 1: success: did_1+0+0/ - qmail: status: local 0/10 remote 0/20 - qmail: end msg 53 + + ``` + qmail: new msg 53 + qmail: info msg 53: bytes 246 from <me@domain> qp 20345 uid 666 + qmail: starting delivery 1: msg 53 to local me@domain + qmail: status: local 1/10 remote 0/20 + qmail: delivery 1: success: did_1+0+0/ + qmail: status: local 0/10 remote 0/20 + qmail: end msg 53 + ``` + (53 is an inode number; 20345 is a process ID; your numbers will probably be different.) 4. Local-error test: Send a message to a nonexistent local address. - % echo to: nonexistent | /var/qmail/bin/qmail-inject - qmail: new msg 53 - qmail: info msg 53: bytes 246 from <me@domain> qp 20351 uid 666 - qmail: starting delivery 2: msg 53 to local nonexistent@domain - qmail: status: local 1/10 remote 0/20 - qmail: delivery 2: failure: No_such_address.__#5.1.1_/ - qmail: status: local 0/10 remote 0/20 - qmail: bounce msg 53 qp 20357 - qmail: end msg 53 - qmail: new msg 54 - qmail: info msg 54: bytes 743 from <> qp 20357 uid 666 - qmail: starting delivery 3: msg 54 to local me@domain - qmail: status: local 1/10 remote 0/20 - qmail: delivery 3: success: did_1+0+0/ - qmail: status: local 0/10 remote 0/20 - qmail: end msg 54 + + `% echo to: nonexistent | /var/qmail/bin/qmail-inject` + + ``` + qmail: new msg 53 + qmail: info msg 53: bytes 246 from <me@domain> qp 20351 uid 666 + qmail: starting delivery 2: msg 53 to local nonexistent@domain + qmail: status: local 1/10 remote 0/20 + qmail: delivery 2: failure: No_such_address.__#5.1.1_/ + qmail: status: local 0/10 remote 0/20 + qmail: bounce msg 53 qp 20357 + qmail: end msg 53 + qmail: new msg 54 + qmail: info msg 54: bytes 743 from <> qp 20357 uid 666 + qmail: starting delivery 3: msg 54 to local me@domain + qmail: status: local 1/10 remote 0/20 + qmail: delivery 3: success: did_1+0+0/ + qmail: status: local 0/10 remote 0/20 + qmail: end msg 54 + ``` + You will now have a bounce message in your mailbox. 5. Local-remote test: Send an empty message to your account on another machine. - % echo to: me@wherever | /var/qmail/bin/qmail-inject - qmail: new msg 53 - qmail: info msg 53: bytes 246 from <me@domain> qp 20372 uid 666 - qmail: starting delivery 4: msg 53 to remote me@wherever - qmail: status: local 0/10 remote 1/20 - qmail: delivery 4: success: 1.2.3.4_accepted_message./... - qmail: status: local 0/10 remote 0/20 - qmail: end msg 53 + + `% echo to: me@wherever | /var/qmail/bin/qmail-inject` + + ``` + qmail: new msg 53 + qmail: info msg 53: bytes 246 from <me@domain> qp 20372 uid 666 + qmail: starting delivery 4: msg 53 to remote me@wherever + qmail: status: local 0/10 remote 1/20 + qmail: delivery 4: success: 1.2.3.4_accepted_message./... + qmail: status: local 0/10 remote 0/20 + qmail: end msg 53 + ``` + There will be a pause between "starting delivery" and "success"; SMTP is slow. Check that the message is in your mailbox on the other machine. 6. Local-postmaster test: Send mail to postmaster, any capitalization. - % echo to: POSTmaster | /var/qmail/bin/qmail-inject + + `% echo to: POSTmaster | /var/qmail/bin/qmail-inject` + Look for the message in the alias mailbox, normally ~alias/Mailbox. 7. Double-bounce test: Send a message with a completely bad envelope. - % /var/qmail/bin/qmail-inject -f nonexistent - To: unknownuser - Subject: testing - This is a test. This is only a test. - % + ``` + % /var/qmail/bin/qmail-inject -f nonexistent + To: unknownuser + Subject: testing + + This is a test. This is only a test. + % + ``` + (Use end-of-file, not dot, to end the message.) Look for the double bounce in the alias mailbox. 8. Group membership test: - % cat > ~me/.qmail-groups - |groups >> MYGROUPS; exit 0 - % /var/qmail/bin/qmail-inject me-groups < /dev/null - % cat ~me/MYGROUPS + + ``` + % cat > ~me/.qmail-groups + |groups >> MYGROUPS; exit 0 + % /var/qmail/bin/qmail-inject me-groups < /dev/null + % cat ~me/MYGROUPS + ``` + MYGROUPS will show your normal gid and nothing else. (Under Solaris, make sure to use /usr/ucb/groups; /usr/bin/groups is broken.) diff --git a/TEST.receive.md b/TEST.receive.md @@ -2,28 +2,32 @@ You can do several tests of messages entering the qmail system: 1. SMTP server test: Forge some mail locally via SMTP. Replace "me" with your username and "domain" with your host's name. - % telnet 127.0.0.1 25 - Trying 127.0.0.1... - Connected to 127.0.0.1. - Escape character is '^]'. - 220 domain ESMTP - helo dude - 250 domain - mail <me@domain> - 250 ok - rcpt <me@domain> - 250 ok - data - 354 go ahead - Subject: testing - - This is a test. - . - 250 ok 812345679 qp 12345 - quit - 221 domain - Connection closed by foreign host. - % + + ``` + % telnet 127.0.0.1 25 + Trying 127.0.0.1... + Connected to 127.0.0.1. + Escape character is '^]'. + 220 domain ESMTP + helo dude + 250 domain + mail <me@domain> + 250 ok + rcpt <me@domain> + 250 ok + data + 354 go ahead + Subject: testing + + This is a test. + . + 250 ok 812345679 qp 12345 + quit + 221 domain + Connection closed by foreign host. + % + ``` + Look for the message in your mailbox. (Note for programmers: Most SMTP servers need more text after MAIL and RCPT. See RFC 821.) diff --git a/UPGRADE.md b/UPGRADE.md @@ -23,7 +23,8 @@ changes. You can copy conf* from 1.02 or 1.03. How to install: 1. Compile the programs and create the formatted man pages: - # make it man + + `# make it man` 2. Inform your users that mail will not be accepted for a few minutes. @@ -36,7 +37,8 @@ How to install: Wait for current qmail-smtpd processes to die. 5. Install the new binaries and man pages: - # make setup check + + `# make setup check` 6. If your boot scripts are using qmail-start instead of /var/qmail/rc: Copy /var/qmail/boot/home to /var/qmail/rc. (Use home+df instead if @@ -44,10 +46,12 @@ How to install: procmail by default for local deliveries.) Compare /var/qmail/rc to your qmail-start boot line, and edit /var/qmail/rc if necessary. Replace your qmail-start boot line with - csh -cf '/var/qmail/rc &' + + `csh -cf '/var/qmail/rc &'` 7. Reenable deliveries: - # csh -cf '/var/qmail/rc &' + + `# csh -cf '/var/qmail/rc &'` 8. Read TEST.deliver.md.