home *** CD-ROM | disk | FTP | other *** search
/ Caldera Network Desktop 1.0 / caldera-network-desktop-1.0.bin / doc / HOWTO / mini / Mail-Queue < prev    next >
Text File  |  1995-09-24  |  13KB  |  316 lines

  1. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  2. Queue-R-Mail-HOWTO    Queue Remote Mail + Deliver Local Mail (V8)
  3.             Designed for sendmail 8.6.12
  4.  
  5.     Author:        Leif Erlingsson <Leif.Erlingsson@mailbox.swipnet.se>
  6.     First written:    19 Sep 1995    Version:    1.0
  7.     Last updated:    19 Sep 1995    Version:    1.01
  8.  
  9. Update History:
  10.  
  11.     1.01    /usr/src/sendmail.8.6.12/cf/cf/obj/elijah.smtp.cf section
  12.         lacked the following items:
  13.  
  14.         < OcTrue
  15.         > OcFalse
  16.  
  17.         Consequences:    None, if You updated the .mc and .m4 files
  18.         as instructed, and performed 'make' on them. Big if You
  19.         edited /etc/sendmail.cf directly --- omitting this change
  20.         would make the patch NOT WORK. Remote mail would be
  21.         delivered same as local, immediately.
  22.  
  23.         Updated By:    Leif.Erlingsson@mailbox.swipnet.se
  24.  
  25. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  26. If all the below instructions is followed, it even works during boot!
  27. REMOTE MAIL will not be delivered from the mail queue unless a user
  28. executes sendmail -q.
  29.  
  30. At the end of the document is some suggested edits to
  31. /var/X11R6/lib/fvwm/system.fvwmrc to give some menu support for this
  32. for the benifit of Linux hackers and others! Some of those edits assume
  33. that other homemade programs are available, so study and implement YOUR way!
  34.  
  35. Designed for sendmail 8.6.12
  36.  
  37. /Leif Erlingsson, home:              work:
  38. Tel:    +46 8 604 0995              Tel:    +46 8 764 8495
  39. Fax:    +46 8 604 0995 (ask 1'st)        Fax:    +46 8  29 4975
  40. E-mail:    Leif.Erlingsson@mailbox.swipnet.se    E-mail: leierl@rsv.svskt.se
  41.  
  42. [No, I'm not a sendmail expert. Yes, I'm reading the "sendmail" book from
  43. cover to cover.]
  44.  
  45. ============================================================================
  46. | The Configuration Changes Neccessary to Make Sendmail Deliver Local Mail |
  47. | ***Now*** While Stashing Remote Mail in The Queue Until "I Say So":      |
  48. ============================================================================
  49.  
  50. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  51. Create system mail queue and hideaway for system mail queue files
  52. to be used while starting the sendmail daemon during system boot:
  53.  
  54. mkdir -p /var/spool/mqueue /var/spool/mqueue.hide
  55. chmod 0700 /var/spool/mqueue /var/spool/mqueue.hide
  56.  
  57.  
  58. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  59. Start the sendmail daemon section of /etc/rc.d/rc.M heavily re-programmed:
  60.  
  61. The below section starts the sendmail daemon so that it won't process
  62. "expensive" mail the first time around. And so "delivery runs" are NOT
  63. performed every 15 minutes. The -os flag makes ALL mail queued (that
  64. doesn't mean it can't be delivered immediately all the same).
  65.  
  66. Delivery happens when any user runs "sendmail -q".
  67.  
  68. # Start the sendmail daemon:
  69. if [ -x /usr/sbin/sendmail ]; then
  70.   # If the queue isn't empty, stash away the queued items in mqueue.hide...
  71.   mqquery=`/usr/sbin/sendmail -bp`    # mqquery=`/usr/bin/mailq`
  72.   if [ ! "${mqquery}" = "Mail queue is empty" ]; then
  73.     mv /var/spool/mqueue/* /var/spool/mqueue.hide
  74.   fi
  75.   echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -os -q)..."
  76.   echo "[Special note: As configured on this system, REMOTE MAIL is queued only!!!]..."
  77.   /usr/sbin/sendmail -bd -os -q        # "15m" removed from off the "-q" flag!
  78.   if [ ! "${mqquery}" = "Mail queue is empty" ]; then
  79.     echo "[/var/spool/mqueue wasn't empty, now being copied back from mqueue.hide!!!]..."
  80.     sleep 2; mv /var/spool/mqueue.hide/* /var/spool/mqueue
  81.   fi
  82. fi
  83. #
  84. # There is an alternative solution, but this approach queues *only* ALL MAIL,
  85. # LOCAL TOO. It goes like this, and doesn't need any /var/spool/mqueue.hide,
  86. # nor all the reconfiguration of sendmail.cf that will follow further below:
  87. #
  88. # # Start the sendmail daemon:
  89. # if [ -x /usr/sbin/sendmail ]; then
  90. #   echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -osdq) [queue only mode]..."
  91. #   /usr/sbin/sendmail -bd -osdq    # NOT EQ "-bd -q 15m", the "standard" flags! )
  92. # fi
  93.  
  94.  
  95. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  96. /usr/src/sendmail.8.6.12/cf/cf/obj/elijah.smtp.cf = /etc/sendmail.cf
  97. changes. This is for information only, the real editing should be done
  98. in the files:
  99.             sendmail.8.6.12/cf/cf/yourhostname.smtp.mc
  100.             sendmail.8.6.12/cf/mailer/local.m4
  101.             sendmail.8.6.12/cf/mailer/smtp.m4
  102.             sendmail.8.6.12/cf/ostype/linux.m4    (Use Your OS!)
  103. < # After the edits:
  104. > # Before the edits:
  105.  
  106. < OcTrue
  107. > OcFalse
  108.  
  109. < Msmtp,                P=[IPC], F=mDFMuXe, S=11/31, R=21, E=\r\n,
  110. > Msmtp,                P=[IPC], F=mDFMuX, S=11/31, R=21, E=\r\n,
  111.  
  112. < Mesmtp,               P=[IPC], F=mDFMuXae, S=11/31, R=21, E=\r\n,
  113. > Mesmtp,               P=[IPC], F=mDFMuXa, S=11/31, R=21, E=\r\n,
  114.  
  115. < Mrelay,               P=[IPC], F=mDFMuXae, S=11/31, R=61, E=\r\n,
  116. > Mrelay,               P=[IPC], F=mDFMuXa, S=11/31, R=61, E=\r\n,
  117.  
  118. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  119. Very simple makescript        sendmail.8.6.12/cf/cf/make_yourhostname:
  120.  
  121.     #!/bin/sh
  122.  
  123.     # ALT 1:    m4 yourhostname.smtp.mc > obj/yourhostname.smtp.cf 
  124.     # ALT 2:    pmake yourhostname.smtp.cf
  125.  
  126.     m4 yourhostname.smtp.mc > obj/yourhostname.smtp.cf
  127.  
  128. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  129. The above /etc/sendmail.cf changes can be entered like described in the
  130. following passages in the here listed .mc and .m4 files:
  131.  
  132.         /usr/src/sendmail.8.6.12/cf/cf/yourhostname.smtp.mc
  133.         /usr/src/sendmail.8.6.12/cf/mailer/local.m4
  134.         /usr/src/sendmail.8.6.12/cf/mailer/smtp.m4
  135.         /usr/src/sendmail.8.6.12/cf/ostype/linux.m4   (Use Your OS!)
  136.  
  137. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  138. /usr/src/sendmail.8.6.12/cf/cf/yourhostname.smtp.mc
  139.  
  140. dnl # Defer Delivery to "expensive" mailers until next time the queue is
  141. dnl # processed using "OcTrue" and make sure smtp mailers are "expensive".
  142. dnl # (The "sendmail" book, Chapter 30: Options, "Oc - Don't connect to expensive
  143. dnl # mailers".)            / Leif.Erlingsson@mailbox.swipnet.se
  144. define(`confCON_EXPENSIVE', `True')
  145. define(SMTP_MAILER_FLAGS, e)
  146. MAILER(local)dnl
  147. MAILER(smtp)dnl
  148.  
  149. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  150. /usr/src/sendmail.8.6.12/cf/mailer/local.m4
  151.  
  152. [SECURITY PATCH        THIS PATCH DOESN'T MAKE ANY DIFFERENCE FOR OUR     ]
  153. [            PRESENT PURPOUSES, BUT IT HIGHTENS SECURITY!       ]
  154.  
  155. # MODIFICATION BY Leif.Erlingsson@mailbox.swipnet.se:
  156. # According to the "sendmail" book, chapter 19, "The Queue", page 249,
  157. # "Overview of the Queue" and chapter 26, "Delivery Agents", page 385,
  158. # "Paths of Working Directories (V8 only): D=" and for tigthest possible
  159. # queue security, queue (/var/spool/mqueue) permissions is set to 0700
  160. # and in the below Mprog line Paths of working directories is set to
  161. # D=$z:/tmp:/
  162. #                    / Leif.Erlingsson@mailbox.swipnet.se
  163. #
  164. Mlocal,        P=LOCAL_MAILER_PATH, F=CONCAT(`lsDFM', LOCAL_MAILER_FLAGS), S=10, R=20/40,
  165.         A=LOCAL_MAILER_ARGS
  166. Mprog,        P=LOCAL_SHELL_PATH, F=CONCAT(`lsDFM', LOCAL_SHELL_FLAGS), S=10, R=20/40, D=$z:/tmp:/,
  167.         A=LOCAL_SHELL_ARGS
  168.  
  169. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  170. /usr/src/sendmail.8.6.12/cf/mailer/smtp.m4
  171.  
  172. [The code isn't really changed in                                          ]
  173. [/usr/src/sendmail.8.6.12/cf/mailer/smtp.m4, it's just the below comments  ]
  174. [that is added, so they appear in the resulting sendmail.cf file above the ]
  175. [following lines, that are not modified:                                   ]
  176.  
  177. # If any F= below contains the e flag, this is an 'expensive mailer'.
  178. # (The "sendmail" book, Chapter 30: Options, "Oc - Don't connect to expensive
  179. # mailers".)                / Leif.Erlingsson@mailbox.swipnet.se
  180.  
  181. [Unchanged lines...                                                        ]
  182.  
  183. Msmtp,          P=[IPC], F=CONCAT(mDFMuX, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
  184.                 ifdef(`_OLD_SENDMAIL_',, `L=990, ')ifdef(`SMTP_MAILER_MAX', `M=SMTP_MAILER_MAX, ')A=IPC $h
  185. Mesmtp,         P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
  186.                 ifdef(`_OLD_SENDMAIL_',, `L=990, ')ifdef(`SMTP_MAILER_MAX', `M=SMTP_MAILER_MAX, ')A=IPC $h
  187. Mrelay,         P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=61, E=\r\n,
  188.                 ifdef(`_OLD_SENDMAIL_',, `L=2040, ')A=IPC $h
  189.  
  190. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  191. /usr/src/sendmail.8.6.12/cf/ostype/linux.m4    (or whatever ostype You have)
  192.  
  193. define(`LOCAL_MAILER_PATH',`/usr/bin/procmail')dnl
  194. dnl        `LOCAL_MAILER_FLAGS',`ShP' results in F=lsDFMShP, but I don't
  195. dnl        want the "S" flag, it's a security risc, see "sendmail",
  196. dnl        chapter 18, "The A= of Deliver Agents", page 234, so....
  197. define(`LOCAL_MAILER_FLAGS',`hP')dnl
  198. dnl        `LOCAL_MAILER_FLAGS',`hP' results in F=lsDFMhP.
  199. dnl        For this to work, /usr/bin/procmail must be SUID root!
  200. define(`LOCAL_MAILER_ARGS',`procmail -d $u')dnl
  201. define(`QUEUE_DIR', /var/spool/mqueue)dnl
  202.  
  203. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  204.  
  205. #### sendmail.cf Done. ####
  206.  
  207. THAT'S THE sendmail.cf MODIFICATIONS. BUT I THINK I'D BETTER INCLUDE MY
  208. COMPLETE  /usr/src/sendmail.8.6.12/cf/cf/yourhostname.smtp.mc  IN CASE
  209. YOU HAVE ANY TROUBLE WITH THIS SETUP:
  210.  
  211. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  212. MY COMPLETE /usr/src/sendmail.8.6.12/cf/cf/yourhostname.smtp.mc:
  213.  
  214. include(`../m4/cf.m4')
  215. VERSIONID(`@(#)cf/cf/yourhostname.smtp.mc    1.1 (Swipnet) 18/9/95')dnl
  216.  
  217. # MODIFICATION:
  218. # Defer Delivery to "expensive" mailers until next time the queue is
  219. # processed using "OcTrue" and make sure smtp mailers are "expensive".
  220. # (The "sendmail" book, Chapter 30: Options, "Oc - Don't connect to expensive
  221. # mailers".)                / Leif.Erlingsson@mailbox.swipnet.se
  222. dnl # done further down:    define(`confCON_EXPENSIVE', `True')
  223. dnl # done further down:    define(SMTP_MAILER_FLAGS, e)
  224. define(PSEUDONYMS, `localhost yourhostname yourhostname.swipnet.se')
  225. define(ALIAS_FILE, /etc/aliases)
  226. define(GENERICFROM, /etc/xaliases)
  227. dnl # default: # define(confTEMP_FILE_MODE, 0600)
  228. dnl # See "sendmail", chapter 19, "The Queue", page 251, "The Data (Message Body)
  229. dnl # File: df". For tigthest possible security, the F option should specify 0600.
  230. OSTYPE(linux)
  231. DOMAIN(mailbox.hidden)
  232. EXPOSED_USER(Mailer-Daemon)
  233. EXPOSED_USER(postmaster)
  234. EXPOSED_USER(operator)
  235. EXPOSED_USER(oracle)
  236. EXPOSED_USER(rsv)
  237. EXPOSED_USER(demo)
  238. EXPOSED_USER(leierl)
  239. EXPOSED_USER(ftp)
  240. EXPOSED_USER(ulf)
  241. dnl # Defer Delivery to "expensive" mailers until next time the queue is
  242. dnl # processed using "OcTrue" and make sure smtp mailers are "expensive".
  243. dnl # (The "sendmail" book, Chapter 30: Options, "Oc - Don't connect to expensive
  244. dnl # mailers".)            / Leif.Erlingsson@mailbox.swipnet.se
  245. define(`confCON_EXPENSIVE', `True')
  246. define(SMTP_MAILER_FLAGS, e)
  247. MAILER(local)dnl
  248. MAILER(smtp)dnl
  249. dnl MAILER(pop)dnl
  250. dnl # continues in ../domain/Yourhostname.m4
  251.  
  252. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  253.  
  254. ============================================================================
  255. | Menu support suggestions:                                                |
  256. ============================================================================
  257.  
  258. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  259. As promised, here follows some suggested edits to
  260. /var/X11R6/lib/fvwm/system.fvwmrc to give some menu support SLIP/PPP TCP/IP
  261. for the benifit of Linux hackers and others! Some of those edits assume
  262. that other homemade programs are available, so study and implement YOUR way:
  263.  
  264. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  265. /var/X11R6/lib/fvwm/system.fvwmrc:
  266.  
  267.  
  268. Popup "Internet"            # Added in Utilities menu below #
  269.     Title    "Internet"
  270.     Exec    "Ip (dial up internet)"    xterm -geometry 66x12+586+0 -font 7x14 -T "Ip (dial up internet)" -n Ip -e perl -le 'system "echo; sleep 1; /sbin/dip /etc/swipnet.dip; sleep 65535";' &
  271.     Nop    ""
  272.     Exec    "Netscape"    exec netscape &
  273.     Nop    ""
  274.     Exec    "Mailq (check mail queue)"    xterm -geometry 75x12+586+0 -font 7x14 -T "Mailq (check mail queue)" -n Mailq -e perl -le 'system "echo; sleep 1; /usr/bin/mailq; sleep 10";' &
  275.     Nop    ""
  276.     Exec    "Really send mail (smtp)"    xterm -geometry 75x12+586+0 -font 7x14 -T "Really send mail (smtp)" -n Sendmail-q -e perl -le 'system "echo; sleep 1; /usr/bin/mailq; echo sendmail -q ...; /usr/sbin/sendmail -q; /usr/bin/mailq; sleep 10";' &
  277.     Nop    ""
  278.     Exec    "Noip (offline again)"    xterm -geometry 66x12+586+0 -font 7x14 -T "Noip (offline again)" -n Noip -e perl -le 'system "echo; sleep 1; /sbin/dip -l cua1 -k; sleep 7";' &
  279. EndPopup
  280. #
  281. #    HOMEMADE STUFF REFERENCED ABOVE:    /etc/swipnet.dip
  282.  
  283. # This menu will fire up some very common utilities
  284. Popup "Utilities"
  285.     Title    "Utilities"
  286.     Exec    "Top"        exec rxvt  -font 7x14 -T Top -n Top -e top &
  287.     Exec    "Calculator"    exec xcalc &
  288.     Exec    "Xman"        exec xman &
  289.     Exec    "Xmag"        exec xmag &
  290.     Exec    "Oclock"    exec oclock &
  291.     Nop    ""
  292.     Popup    "Applications"    Applications
  293.     Nop    ""
  294.     Popup    "Shells"    Shells
  295.     Nop    ""
  296.     Popup    "Floppy"    Floppy
  297.     Nop    ""
  298.     Popup    "Internet"    Internet    # Popup added HERE #
  299.     Nop    ""
  300.     Popup    "Games"        Games
  301.     Nop    ""
  302.     Popup    "Screensaver"    Screensaver
  303.     Nop    ""
  304.     Popup    "Lock Screen"    Screenlock
  305.     Nop    ""
  306.     Popup    "Modules"    Module-Popup
  307.     Nop    ""
  308.     Popup    "Exit Fvwm"    Quit-Verify
  309.     Nop    ""
  310.     Popup    "SHUT DOWN"    Shtdwn-Verify
  311.     Nop    ""
  312.     Refresh "Refresh Screen"
  313. EndPopup
  314.  
  315. ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
  316.