Subject: Queue-R-Mail-HOWTO 1.01
V 1.01 of "Queue-R-Mail-HOWTO" - Note that this is an UPDATE from V 1.0
published earlier TODAY.
Here goes a suggested new HOWTO dealing with Sendmail V8 in a typical Linux
situation, where You want to write and "send" several mails before actually
dialling up an TCP/IP connection to actually empty the queue. Unlike some
other suggestioons I've heard, this approach gives You instantaneous
delivery for local mail. It's just remotely destined mail that's being held
in /var/spool/mqueue until somebody dials up an IP connection and executes
"sendmail -q".
-------------------------------- cut here ----------------------------------
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ Author: Leif Erlingsson <Leif.Erlings...@mailbox.swipnet.se> Update History: 1.01 /usr/src/sendmail.8.6.12/cf/cf/obj/elijah.smtp.cf section < OcTrue Consequences: None, if You updated the .mc and .m4 files Updated By: Leif.Erlings...@mailbox.swipnet.se ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ At the end of the document is some suggested edits to Designed for sendmail 8.6.12 /Leif Erlingsson, home: work: [No, I'm not a sendmail expert. Yes, I'm reading the "sendmail" book from =========================================================================== ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ mkdir -p /var/spool/mqueue /var/spool/mqueue.hide ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ The below section starts the sendmail daemon so that it won't process Delivery happens when any user runs "sendmail -q". # Start the sendmail daemon: ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ #!/bin/sh # ALT 1: m4 yourhostname.smtp.mc > obj/yourhostname.smtp.cf m4 yourhostname.smtp.mc > obj/yourhostname.smtp.cf ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ /usr/src/sendmail.8.6.12/cf/cf/yourhostname.smtp.mc ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ dnl # Defer Delivery to "expensive" mailers until next time the queue is ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ [SECURITY PATCH THIS PATCH DOESN'T MAKE ANY DIFFERENCE FOR OUR ] # MODIFICATION BY Leif.Erlings...@mailbox.swipnet.se: ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ [The code isn't really changed in ] # If any F= below contains the e flag, this is an 'expensive mailer'. [Unchanged lines... ] Msmtp, P=[IPC], F=CONCAT(mDFMuX, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n, ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ define(`LOCAL_MAILER_PATH',`/usr/bin/procmail')dnl ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ #### sendmail.cf Done. #### THAT'S THE sendmail.cf MODIFICATIONS. BUT I THINK I'D BETTER INCLUDE MY read more »
Queue-R-Mail-HOWTO Queue Remote Mail + Deliver Local Mail (V8)
Designed for sendmail 8.6.12
First written: 19 Sep 1995 Version: 1.0
Last updated: 19 Sep 1995 Version: 1.01
lacked the following items:
> OcFalse
as instructed, and performed 'make' on them. Big if You
edited /etc/sendmail.cf directly --- omitting this change
would make the patch NOT WORK. Remote mail would be
delivered same as local, immediately.
If all the below instructions is followed, it even works during boot!
REMOTE MAIL will not be delivered from the mail queue unless a user
executes sendmail -q.
/var/X11R6/lib/fvwm/system.fvwmrc to give some menu support for this
for the benifit of Linux hackers and others! Some of those edits assume
that other homemade programs are available, so study and implement YOUR way!
Tel: +46 8 604 0995 Tel: +46 8 764 8495
Fax: +46 8 604 0995 (ask 1'st) Fax: +46 8 29 4975
E-mail: Leif.Erlings...@mailbox.swipnet.se E-mail: lei...@rsv.svskt.se
cover to cover.]
| The Configuration Changes Neccessary to Make Sendmail Deliver Local Mail |
| ***Now*** While Stashing Remote Mail in The Queue Until "I Say So": |
===========================================================================
Create system mail queue and hideaway for system mail queue files
to be used while starting the sendmail daemon during system boot:
chmod 0700 /var/spool/mqueue /var/spool/mqueue.hide
Start the sendmail daemon section of /etc/rc.d/rc.M heavily re-programmed:
"expensive" mail the first time around. And so "delivery runs" are NOT
performed every 15 minutes. The -os flag makes ALL mail queued (that
doesn't mean it can't be delivered immediately all the same).
if [ -x /usr/sbin/sendmail ]; then
# If the queue isn't empty, stash away the queued items in mqueue.hide...
mqquery=`/usr/sbin/sendmail -bp` # mqquery=`/usr/bin/mailq`
if [ ! "${mqquery}" = "Mail queue is empty" ]; then
mv /var/spool/mqueue/* /var/spool/mqueue.hide
fi
echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -os -q)..."
echo "[Special note: As configured on this system, REMOTE MAIL is queued only!!!]..."
/usr/sbin/sendmail -bd -os -q # "15m" removed from off the "-q" flag!
if [ ! "${mqquery}" = "Mail queue is empty" ]; then
echo "[/var/spool/mqueue wasn't empty, now being copied back from mqueue.hide!!!]..."
sleep 2; mv /var/spool/mqueue.hide/* /var/spool/mqueue
fi
fi
#
# There is an alternative solution, but this approach queues *only* ALL MAIL,
# LOCAL TOO. It goes like this, and doesn't need any /var/spool/mqueue.hide,
# nor all the reconfiguration of sendmail.cf that will follow further below:
#
# # Start the sendmail daemon:
# if [ -x /usr/sbin/sendmail ]; then
# echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -osdq) [queue only mode]..."
# /usr/sbin/sendmail -bd -osdq # NOT EQ "-bd -q 15m", the "standard" flags! )
# fi
/usr/src/sendmail.8.6.12/cf/cf/obj/elijah.smtp.cf = /etc/sendmail.cf
changes. This is for information only, the real editing should be done
in the files:
sendmail.8.6.12/cf/cf/yourhostname.smtp.mc
sendmail.8.6.12/cf/mailer/local.m4
sendmail.8.6.12/cf/mailer/smtp.m4
sendmail.8.6.12/cf/ostype/linux.m4 (Use Your OS!)
< # After the edits:
Very simple makescript sendmail.8.6.12/cf/cf/make_yourhostname:
# ALT 2: pmake yourhostname.smtp.cf
The above /etc/sendmail.cf changes can be entered like described in the
following passages in the here listed .mc and .m4 files:
/usr/src/sendmail.8.6.12/cf/mailer/local.m4
/usr/src/sendmail.8.6.12/cf/mailer/smtp.m4
/usr/src/sendmail.8.6.12/cf/ostype/linux.m4 (Use Your OS!)
/usr/src/sendmail.8.6.12/cf/cf/yourhostname.smtp.mc
dnl # processed using "OcTrue" and make sure smtp mailers are "expensive".
dnl # (The "sendmail" book, Chapter 30: Options, "Oc - Don't connect to expensive
dnl # mailers".) / Leif.Erlings...@mailbox.swipnet.se
define(`confCON_EXPENSIVE', `True')
define(SMTP_MAILER_FLAGS, e)
MAILER(local)dnl
MAILER(smtp)dnl
/usr/src/sendmail.8.6.12/cf/mailer/local.m4
[ PRESENT PURPOUSES, BUT IT HIGHTENS SECURITY! ]
# According to the "sendmail" book, chapter 19, "The Queue", page 249,
# "Overview of the Queue" and chapter 26, "Delivery Agents", page 385,
# "Paths of Working Directories (V8 only): D=" and for tigthest possible
# queue security, queue (/var/spool/mqueue) permissions is set to 0700
# and in the below Mprog line Paths of working directories is set to
# D=$z:/tmp:/
# / Leif.Erlings...@mailbox.swipnet.se
#
Mlocal, P=LOCAL_MAILER_PATH, F=CONCAT(`lsDFM', LOCAL_MAILER_FLAGS), S=10, R=20/40,
A=LOCAL_MAILER_ARGS
Mprog, P=LOCAL_SHELL_PATH, F=CONCAT(`lsDFM', LOCAL_SHELL_FLAGS), S=10, R=20/40, D=$z:/tmp:/,
A=LOCAL_SHELL_ARGS
/usr/src/sendmail.8.6.12/cf/mailer/smtp.m4
[/usr/src/sendmail.8.6.12/cf/mailer/smtp.m4, it's just the below comments ]
[that is added, so they appear in the resulting sendmail.cf file above the ]
[following lines, that are not modified: ]
# (The "sendmail" book, Chapter 30: Options, "Oc - Don't connect to expensive
# mailers".) / Leif.Erlings...@mailbox.swipnet.se
ifdef(`_OLD_SENDMAIL_',, `L=990, ')ifdef(`SMTP_MAILER_MAX', `M=SMTP_MAILER_MAX, ')A=IPC $h
Mesmtp, P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
ifdef(`_OLD_SENDMAIL_',, `L=990, ')ifdef(`SMTP_MAILER_MAX', `M=SMTP_MAILER_MAX, ')A=IPC $h
Mrelay, P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=61, E=\r\n,
ifdef(`_OLD_SENDMAIL_',, `L=2040, ')A=IPC $h
/usr/src/sendmail.8.6.12/cf/ostype/linux.m4 (or whatever ostype You have)
dnl `LOCAL_MAILER_FLAGS',`ShP' results in F=lsDFMShP, but I don't
dnl want the "S" flag, it's a security risc, see "sendmail",
dnl chapter 18, "The A= of Deliver Agents", page 234, so....
define(`LOCAL_MAILER_FLAGS',`hP')dnl
dnl `LOCAL_MAILER_FLAGS',`hP' results in F=lsDFMhP.
dnl For this to work, /usr/bin/procmail must be SUID root!
define(`LOCAL_MAILER_ARGS',`procmail -d $u')dnl
define(`QUEUE_DIR', /var/spool/mqueue)dnl
COMPLETE /usr/src/sendmail.8.6.12/cf/cf/yourhostname.smtp.mc IN CASE
YOU HAVE ANY TROUBLE WITH THIS SETUP:
...