home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / internet / sendmai3.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  9.9 KB  |  320 lines

  1. ###############################################################################
  2. ###                                                                         ###
  3. ###           sendmail configuration for generic, Internet only host        ###
  4. ###                                                                         ###
  5. ###           Erik E. Fair <fair@ucbarpa.berkeley.edu>                      ###
  6. ###                                                                         ###
  7. ###############################################################################
  8.  
  9. # Our local domain ($D is added to $w [hostname] for official name in base.m4)
  10. DDARPA
  11.  
  12. # All the names we are known by (egrep /etc/hosts for this)
  13. Cw
  14.  
  15. ###############################################################################
  16. ###   baseline definitions that sendmail needs to operate                   ###
  17. ###############################################################################
  18.  
  19. ##########################
  20. ###   Special macros   ###
  21. ##########################
  22.  
  23. DV25
  24.  
  25. # my official hostname
  26. Dj$w.$D
  27. # my name (the name on mailer bounces)
  28. DnMAILER-DAEMON
  29. # UNIX header format
  30. DlFrom $g $d
  31. # delimiter (operator) characters
  32. Do.:%@!^/[]
  33. # format of a total name
  34. Dq$?x$x <$g>$|$g$.
  35. # SMTP login message
  36. De$j Sendmail $v/$V ready at $b
  37.  
  38. ###################
  39. ###   Options   ###
  40. ###################
  41.  
  42. # we have full sendmail support here
  43. Oa
  44. # location of alias file
  45. OA/usr/lib/aliases
  46. # default delivery mode (deliver in background)
  47. Odbackground
  48. # (don't) connect to "expensive" mailers
  49. #Oc
  50. # temporary file mode
  51. OF0600
  52. # default GID
  53. Og1
  54. # location of help file
  55. OH/usr/lib/sendmail.hf
  56. # log level
  57. OL9
  58. # Send to me too (even if I'm in an alias expansion)
  59. Om
  60. # default messages to old style
  61. Oo
  62. # queue directory
  63. OQ/usr/spool/mqueue
  64. # read timeout -- violates protocols (timeout an SMTP idle for 2 hours)
  65. Or2h
  66. # status file
  67. OS/usr/lib/sendmail.st
  68. # queue up everything before starting transmission
  69. Os
  70. # default timeout interval (returns undelivered mail after 3 days)
  71. OT3d
  72. # time zone names (V6 only)
  73. OtPST,PDT
  74. # default UID
  75. Ou1
  76. # encrypted wizard's password (for the undocumented "wiz" SMTP command)
  77. OWnot-likely
  78. # rebuild the aliasfile automagically
  79. #OD
  80. # maximum load average before queueing mail
  81. Ox10
  82. # maximum load average before rejecting connections
  83. OX15
  84.  
  85. ###############################
  86. ###   Message precedences   ###
  87. ###############################
  88.  
  89. Pfirst-class=0
  90. Pspecial-delivery=100
  91. Pbulk=-60
  92. Pjunk=-100
  93.  
  94. #########################
  95. ###   Trusted users   ###
  96. #########################
  97.  
  98. Troot
  99. Tdaemon
  100. Tnews
  101. Tuucp
  102.  
  103. #############################
  104. ###   Format of headers   ###
  105. #############################
  106.  
  107. H?P?Return-Path: <$g>
  108. HReceived: $?sfrom $s$. by $j$?r with $r$. ($v/$V-eef)
  109.     id $i; $b
  110. H?D?Date: $a
  111. H?F?From: $q
  112. H?x?Full-Name: $x
  113. H?M?Message-Id: <$t.$i@$j>
  114. HSubject:
  115. H?D?Resent-Date: $a
  116. H?F?Resent-From: $q
  117. H?M?Resent-Message-Id: <$t.$i@$j>
  118.  
  119.  
  120. ###############################################################################
  121. #        RULESET ZERO PREAMBLE                                         #
  122. ###############################################################################
  123.  
  124. S0
  125.  
  126. # first make canonical
  127. R$*<$*>$*        $1$2$3                defocus
  128. R$+            $:$>3$1                make canonical
  129.  
  130. # handle special cases.....
  131. R@            $#local$:$n            handle <> form
  132. R$*<@[$+]>$*        $#tcp$@[$2]$:$1@[$2]$3        numeric internet spec
  133.  
  134. # now delete the local info
  135. R$*<$*$=w.UUCP>$*    $1<$2>$4            thishost
  136. R$*<$*$=w.$D>$*        $1<$2>$4            thishost
  137. R$*<$*$=w>$*        $1<$2>$4            thishost
  138. R$*<$*.>$*        $1<$2>$3            drop trailing dot
  139. R<@>:$*            $@$>0$1                retry after route strip
  140. R$*<@>            $@$>0$1                strip null trash & retry
  141.  
  142. # return uucp mail that looks like decvax!ittvax!marsvax! since it
  143. # will be rejected at the final site with no username on it
  144. R$*!<@$-.UUCP>        $#error$:Destination address truncated
  145.  
  146.  
  147.  
  148. ###############################################################################
  149. ###   Machine dependent part of ruleset zero (where we decide what to do)   ###
  150. ###############################################################################
  151.  
  152. # resolve various and sundry other unofficial networks
  153. R$*<@$+.MAILNET>$*    $#tcp$@mit-multics.arpa$:$1@$2.MAILNET$3    MAILNET
  154. R$*<@$+.BITNET>$*    $#tcp$@cunyvm.cuny.edu$:$1@$2.BITNET$3        BITNET
  155. R$*<@$+.MFENET>$*    $#tcp$@nmfecc.arpa$:$1@$2.MFENET$3        MFENET
  156. R$*<@$+.CSNET>$*    $#tcp$@relay.cs.net$:$1@$2.CSNET$3        CSNET
  157.  
  158.  
  159.  
  160. # when all else fails, look up the whole name in the host table
  161. R$*<@$+>$*        $#tcp$@$2$:$1@$2$3            user@domain
  162.  
  163. # remaining names must be local
  164. R@            $n                    fix magic token
  165. R$+            $#local$:$1                everything else
  166.  
  167. ###############################################################################
  168. ###   End of ruleset zero                                                   ###
  169. ###############################################################################
  170.  
  171. ###########################
  172. #  Name Canonicalization  #
  173. ###########################
  174. S3
  175.  
  176. # handle "from:<>" special case
  177. R<>            $@@                resolve into magic token
  178.  
  179. # basic textual canonicalization
  180. R$*<$*<$*<$+>$*>$*>$*    $4                3-level <> nesting
  181. R$*<$*<$+>$*>$*        $3                2-level <> nesting
  182. R$*<$+>$*        $2                basic RFC821/822 parsing
  183. R$+ at $+        $1@$2                "at" -> "@" for RFC 822
  184. R$*<$*>$*        $1$2$3                in case recursive
  185.  
  186. # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
  187. R@$+,$+            @$1:$2                change all "," to ":"
  188.  
  189. # localize and dispose of domain-based addresses
  190. R@$+:$+            $@$>6<@$1>:$2            handle <route-addr>
  191.  
  192. # more miscellaneous cleanup
  193. R$+            $:$>8$1                host dependent cleanup
  194. R$+:$*;@$+        $@$1:$2;@$3            list syntax
  195. R$+@$+            $:$1<@$2>            focus on domain
  196. R$+<$+@$+>        $1$2<@$3>            move gaze right
  197. R$+<@$+>        $@$>6$1<@$2>            already canonical
  198.  
  199. # convert old-style addresses to a domain-based address
  200. R$+^$+            $1!$2                convert ^ to !
  201. R$+!$+            $@$>9$1!$2            uucp name hackery
  202. R$+%$+            $:$>5$1%$2            user%host%host
  203. R$+<@$+>        $@$>6$1<@$2>            canonical
  204.  
  205. # Given multiple %'s change rightmost % to @.
  206. S5
  207. R$*<$*>$*        $1$2$3                defocus
  208. R$*%$*            $1@$2                First make them all @'s.
  209. R$*@$*@$*        $1%$2@$3            Undo all but the last.
  210. R$*@$*            $@$1<@$2>            Put back the brackets.
  211.  
  212. ###############################################################################
  213. ####   Assorted name hackery to make things simple for people              ####
  214. ###############################################################################
  215.  
  216. # here we look for addresses of the form: user%host.domain@gateway
  217. # and strip off the gateway name (for the ones that we know)
  218.  
  219. S6
  220.  
  221. # conventional percent format
  222.  
  223. R$+%$+.MAILNET<@mit-multics.arpa>    $>5$1<%$2.MAILNET>    strip
  224. R$+%$+.MFENET<@nmfecc.arpa>        $>5$1<%$2.MFENET>    strip
  225. R$+%$+.BITNET<@cunyvm.cuny.edu>        $>5$1<%$2.BITNET>    strip
  226. R$+%$+.CSNET<@relay.cs.net>        $>5$1<%$2.CSNET>    strip
  227.  
  228. # regulation route-addr format
  229.  
  230. R<@mit-multics.arpa>:$+@$+.MAILNET    $1<@$2.MAILNET>        strip
  231. R<@nmfecc.arpa>:$+@$+.MFENET        $1<@$2.MFENET>        strip
  232. R<@cunyvm.cuny.edu>:$+@$+.BITNET    $1<@$2.BITNET>        strip
  233. R<@relay.cs.net>:$+@$+.CSNET        $1<@$2.CSNET>        strip
  234.  
  235. # mung up names for the outside world - called from tcp mailer
  236.  
  237. S7
  238. R$+@$+.MAILNET        $1%$2.MAILNET@mit-multics.arpa    user@host.MAILNET
  239. R$+@$+.MFENET        $1%$2.MFENET@nmfecc.arpa    user@host.MFENET
  240. R$+@$+.BITNET        $1%$2.BITNET@cunyvm.cuny.edu    user@host.BITNET
  241. R$+@$+.CSNET        $1%$2.CSNET@relay.cs.net    user@host.CSNET
  242.  
  243. ###############################################################################
  244. ####   UUCP address hackery                                                ####
  245. ###############################################################################
  246.  
  247. S9
  248. R$+!$=w!$+        $3                collapse loops
  249. R$-.$+!$+        $@$>6$3<@$1.$2>            do.main!user
  250. R$-!$+            $@$>6$2<@$1.UUCP>        host!user
  251.  
  252. ################################
  253. #  Sender Field Pre-rewriting  #
  254. ################################
  255. S1
  256. R$*<$*>$*        $1$2$3                defocus
  257.  
  258. ###################################
  259. #  Recipient Field Pre-rewriting  #
  260. ###################################
  261. S2
  262. R$*<$*>$*        $1$2$3                defocus
  263.  
  264. ###################################
  265. #  Final Output Post-rewriting    #
  266. #  Standard Domain-based version  #
  267. ###################################
  268. S4
  269. R@            $n                handle <> error addr
  270.  
  271. # externalize local domain info
  272. R@$+:$+:$+        $@@$1,$2:$3            <route-addr> canonical
  273.  
  274. # UUCP must always be presented in old form
  275. R$+@$-.UUCP        $2!$1                u@h.UUCP => h!u
  276.  
  277. ###############################################################################
  278. ###   Local, and Program Mailer specifications                              ###
  279. ###############################################################################
  280.  
  281. # Nota Bene: what mailer flags you use depends upon what version of /bin/mail
  282. # you have:
  283. #
  284. # 4th Berkeley Software Distribution (4.1 BSD or later)
  285. Mlocal, P=/bin/mail, F=SlsDFMPpmnxr, S=10, R=20, A=mail -d $u
  286. #
  287. # USG UNIX (System III, System V, Xenix 3.0 or later)
  288. # Mlocal, P=/bin/mail, F=SlsDFMPpmnx, S=10, R=20, A=mail $u
  289. #
  290. # Also, if you are using System V, you should get the Berkeley version of
  291. # /bin/mail as soon as you can and junk the one you've got: it doesn't
  292. # believe in sendmail, so the wrong thing will happen when someone types
  293. # mail user@host (i.e. it will attempt local delivery, rather than call
  294. # sendmail)
  295.  
  296. Mprog, P=/bin/sh, F=lsDFMpxehu, S=10, R=20, A=sh -c $u
  297.  
  298. S10
  299.  
  300. S20
  301.  
  302.  
  303. ###############################################################################
  304. ####    IP/TCP/SMTP mailer (going out to internet land)                    ####
  305. ###############################################################################
  306.  
  307. Mtcp,    P=[IPC], F=AmnDFMpueXLC, S=14, R=14, A=IPC $h, E=\r\n
  308.  
  309. S14
  310. R$*@[$+]$*        $@$1@[$2]$3        already ok (inet addr spec)
  311. R@$+@$+            $@@$1@$2        already ok (route-addr)
  312. R$+@$=X.UUCP        $2!$1@$X        fix remote UUCP
  313. R$+@$=Y.UUCP        $2!$1@$Y        fix remote UUCP
  314. R$+@$=Z.UUCP        $2!$1@$Z        fix remote UUCP
  315. R$+@$-.UUCP        $2!$1@$j        undo local UUCP hack
  316. R$+@$+            $@$>7$1@$2        fix up names for the internet
  317. R$+            $@$1@$j            add our official host name
  318.  
  319.  
  320.