home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / sendmail.cf / cf.m4 next >
Encoding:
Text File  |  1987-08-06  |  13.0 KB  |  496 lines

  1. ############################################################
  2. ############################################################
  3. #####
  4. #####        SENDMAIL CONFIGURATION FILE
  5. #####
  6. ############################################################
  7. ############################################################
  8.  
  9. ######################
  10. #   General Macros   #
  11. ######################
  12.  
  13. include(defines)
  14.  
  15. include(localdomain)
  16.  
  17. include(hostnames)
  18.  
  19. # my official (Domain) hostname
  20. ifdef(`DOMAININNAME',
  21. `Dj$w'
  22. ,
  23. `Dj$w.$D')
  24.  
  25. # my offical (Domain) return address
  26. ifdef(`DOMAININNAME',
  27. `DA$J'
  28. ,
  29. `DA$J.$D')
  30.  
  31. # known top-level domains (other than ARPA domains)
  32. CDLOCAL UUCP BITNET DEC UTEXAS CSNET MAILNET CCNET
  33. # known ARPA domains
  34. FA/usr/local/lib/mail/mailhosts.arpadomains
  35. # domains with ARPA gateways
  36. CCDEC UTEXAS CSNET MAILNET
  37. # known BITNET domains, or domains with BITNET gateways
  38. CZBITNET CCNET
  39.  
  40. include(relays)
  41.  
  42.  
  43. #########################
  44. ###   Trusted users   ###
  45. #########################
  46.  
  47. include(trusted)
  48.  
  49.  
  50. ############################################################
  51. #
  52. #    General configuration information
  53. #
  54. #    This information is basically just "boiler-plate"; it must be
  55. #    there, but is essentially constant.
  56. #
  57. #    Information in this file should be independent of location --
  58. #    i.e., although there are some policy decisions made, they are
  59. #    not specific to Berkeley per se.
  60. #
  61. #
  62. ############################################################
  63.  
  64. DVa0.25
  65.  
  66. ##########################
  67. ###   Special macros   ###
  68. ##########################
  69.  
  70. # my name
  71. DnMAILER-DAEMON
  72. # UNIX header format
  73. DlFrom $g  $d
  74. # delimiter (operator) characters
  75. Do.:%@!^=/[],;
  76. # format of a total name
  77. Dq$g$?x ($x)$.
  78. # SMTP login message
  79. De$j Sendmail $v/$V ready at $b
  80.  
  81. ###################
  82. ###   Options   ###
  83. ###################
  84.  
  85. include(options)
  86.  
  87. ###############################
  88. ###   Message precedences   ###
  89. ###############################
  90.  
  91. Pfirst-class=0
  92. Pspecial-delivery=100
  93. Pjunk=-100
  94.  
  95. #############################
  96. ###   Format of headers   ###
  97. #############################
  98.  
  99. H?P?Return-Path: <$g>
  100. H?R?Received: $?sfrom $s $.by $j$?r with $r$.; $b
  101. H?D?Date: $a
  102. H?F?Resent-From: $q
  103. H?F?From: $q
  104. HSubject:
  105.  
  106.  
  107. ###########################
  108. ###   Rewriting rules   ###
  109. ###########################
  110.  
  111.  
  112. ################################
  113. #  Sender Field Pre-rewriting  #
  114. ################################
  115. S1
  116.  
  117. ###################################
  118. #  Recipient Field Pre-rewriting  #
  119. ###################################
  120. S2
  121.  
  122. #################################
  123. #  Final Output Post-rewriting  #
  124. #################################
  125. S4
  126.  
  127. R@            $@                handle <> error addr
  128.  
  129. # call local externalizing ruleset
  130. R$+            $:$>8$1
  131.  
  132. # kludge for internet spec
  133. R$+<@>            $:$1
  134.  
  135. # remove focus
  136. R$*<$+>$*        $1$2$3                defocus
  137.  
  138. # change mixed-mode '@' and '!' into route-addr if appropriate
  139. R$+!$+@$+        $:$>9$1!$2@$3
  140.  
  141. # turn multiple-'@' to route-addr
  142. R$+@$+@$+        $:<:$1@$2>@$3
  143. R<:$*>@$+@$+        <@$2:$1>@$3
  144. R<:$*>@$+        $@@$2:$1
  145. R<@$*>@$+@$+        <@$2,@$1>@$3
  146. R<$*>@$+        $@@$2,$1
  147.  
  148. #################################
  149. #  Local externalization        #
  150. #################################
  151. S8
  152.  
  153. # make sure UUCP is in old form
  154. R$+<@$*.UUCP>        $@$2!$1                u@host.UUCP => host!u
  155.  
  156. # externalize local domain info
  157. R$*<@$*.LOCAL>        $@$1<@$2>            change local info
  158.  
  159. # handle other external cases
  160. R$+<@$+>        $@$1<@$2>
  161.  
  162. #################################
  163. #  UUCP -> ARPA route-addr    #
  164. #################################
  165. S9
  166. # focus on first uucp address
  167. R$+!$+@$+        $:<!$1>$2@$3
  168. # if the first bang-host is arpa-style, turn it into an '@'
  169. R<!$+.$=A>$+@$+        $@$>9$3@$1.$2@$4
  170. # else simply return as mixed-mode
  171. R<!$+>$+@$+        $@$1!$2@$3
  172.  
  173. ###########################
  174. #  Name Canonicalization  #
  175. ###########################
  176. S3
  177.  
  178. # handle "from:<>" special case
  179. R<>            $@@                turn into magic token
  180.  
  181. # basic textual canonicalization
  182. R$*<$+>$*        $2                basic RFC821/822 parsing
  183. R$+ at $+        $1@$2                "at" -> "@" for RFC 822
  184.  
  185. # handle route-addr (ARPA routing syntax)
  186. # in general, change @a,@b:user@c <=> user@c@b@a
  187. # prepare to focus
  188. #
  189. # KLUDGE - strip stupid uucp path from front of route-addrs - gd 8/6/87
  190. #  foo!@bar:user@gag <=> @bar:user@gag
  191. R$+!@$+:$+@$+        $:@$2:$3@$4
  192. # recognize route-addr
  193. R@$+            $:@$1<>
  194. # change @b,@c:user@d<@a> <=> @c:user@d<@b@a>
  195. R@$+,@$+:$+<$*>        @$2:$3<@$1$4>
  196. # change @a:user@b <=> user@b<@a>
  197. R@$+:$+<$*>        $2<@$1$3>
  198. # defocus, and treat as simple 'user@site' below
  199. R$+<$*>            $1$2
  200.  
  201. # focus on destination host.domain
  202. R$+@$+            $:$1<@$2>            focus on domain
  203. # This is repeated until focused on the rightmost '@'
  204. R$+<$+@$+>        $1$2<@$3>            move gaze right
  205. # canonical - do local rewriting
  206. R$+<@$+>        $@$>6$1<@$2>
  207.  
  208. # convert old-style addresses to a domain-based address
  209. # (has to come after recognition of user@site, else bad recursion)
  210. #
  211. # user%host
  212. R$+%$+            $:$1<@$2>            user%host
  213. R$+<@$+%$+>        $1%$2<@$3>            move right
  214. R$+<@$*>        $@$>6$1<@$2>            already canonical
  215. #
  216. # host^user or host!user
  217. # host!user is the same as 'user@host' for known local hosts, or
  218. # 'user@host.UUCP' for other hosts.
  219. R$+^$+            $1!$2                convert ^ to !
  220. R$-!$+            $:$2<@$1>            resolve uucp names
  221. R$+<@$=L>        $@$>6$1<@$2>            canonicalize local host
  222. R$+<@$->        $@$>6$1<@$2.UUCP>        add UUCP domain
  223. # harvard.ARPA!root <=> root<@harvard.ARPA>
  224. # NOTE: this relies on matching the FIRST "!" in the address
  225. R$-.$+!$+        $@$>6$3<@$1.$2>            keep domain info
  226.  
  227. #
  228. # host::user
  229. # host::user is the same as 'user@host' for known local hosts, or
  230. # 'user@host.DECNET' for other hosts.
  231. R$-::$+            $:$2<@$1>            resolve decnet names
  232. R$+<@$=L>        $@$>6$1<@$2>            canonicalize local host
  233. R$+<@$->        $@$>6$1<@$2.DECNET>        add DECNET domain
  234. # harvard.ARPA::root <=> root<@harvard.ARPA>
  235. # NOTE: this relies on matching the FIRST "::" in the address
  236. R$-.$+::$+        $@$>6$3<@$1.$2>            harvard.ARPA::root
  237.  
  238. #
  239. # host:user
  240. # ':' represents BITNET just like '!' represents UUCP - kludge for sob
  241. # host:user is the same as 'user@host' for known local hosts, or
  242. # 'user@host.BITNET' for other hosts.
  243. # NOTE: ":" parsed after "!" so that site1!site2:user parsed as
  244. #  site2:user<@site1.UUCP>
  245. R$-:$+            $:$2<@$1>            resolve BITNET names
  246. R$+<@$=L>        $@$>6$1<@$2>            canonicalize local host
  247. R$+<@$->        $@$>6$1<@$2.BITNET>        add BITNET domain
  248. # harvard.ARPA:root <=> root<@harvard.ARPA>
  249. # NOTE: this relies on matching the FIRST ":" in the address
  250. R$-.$+:$+        $@$>6$3<@$1.$2>            harvard.ARPA:root
  251.  
  252. #################################
  253. #  Local Name Canonicalization  #
  254. #################################
  255. S6
  256.  
  257. # Make canonical (using /etc/hosts)
  258. # Note that the domain may not be returned from /etc/hosts, but that's ok
  259. ifdef(`NODOMAINS',
  260. `R$*<@$-.$D>        $:$1<@$[$2$]>
  261. R$*<@$->        $:$1<@$[$2$]>'
  262. ,
  263. `# Use our domain in lookup to avoid ambiguities (like seismo.harvard.edu)
  264. R$*<@$->        $:$1<@$2.$D>
  265. R$*<@$-.$D>        $:$1<@$[$2.$D$]>')
  266.  
  267. # Kludge around BITNET mail bug - strip BITNET if destination host
  268. # really in DOMAIN syntax
  269. R$*<@$*$=A.BITNET>    $:$1<@$2$3>
  270.  
  271. # Convert LOCAL to our local domain
  272. R$*<@$-.LOCAL>        $1<@$2.$D>
  273. # Local hosts are recognized later by the fact that there is NO domain
  274. #  in the focus.  Strip our domain here.
  275. R$*<@$-.$D>        $1<@$2>
  276.  
  277. # Pass thru mail specifier
  278. # foo!bar;nopath<@seismo> <=> foo!bar<@seismo;nopath>
  279. R$*;$-<@$*>        $1<@$3;$2>
  280.  
  281.  
  282. ############################################################
  283. ############################################################
  284. #####
  285. #####        RULESET ZERO
  286. #####
  287. ############################################################
  288. ############################################################
  289.  
  290. S0
  291.  
  292. # handle special cases.....
  293. R@            $#local$:MAILER-DAEMON        handle <> form
  294.  
  295. # handle numeric internet spec
  296. #  do not pass host address to mailer rulesets, cause host won't recognize its
  297. #  own address.  Need the '@' so we don't tack local hostname on the end.
  298. R$*<@[$+]>        $#arpa-mailer$@[$2]$:$1<@>    numeric internet spec
  299.  
  300. ##################################
  301. #  End of ruleset zero preamble  #
  302. ##################################
  303.  
  304. #
  305. # find our host
  306. # user@ourhost <=> user
  307. R$+<@$=J>        $@$>7$1            user@harvard
  308. # Check for UUCP
  309. R$+<@$=U.UUCP>        $@$>7$1            user@harvard.UUCP
  310. # Check for BITNET
  311. R$+<@$=B.BITNET>    $@$>7$1            user@harvard.BITNET
  312.  
  313. ifdef(`ANYDOMAIN',
  314. `# These are sorta dangerous, if our canonical name is not unique
  315. # user@ourhost.ARPA <=> user
  316. R$+<@$=J.ARPA>        $@$>7$1            user@harvard.ARPA (sigh)
  317. # user@ourhost.FOONET <=> user
  318. R$+<@$=J.$=D>        $@$>7$1            user@harvard.BITNET',`')
  319.  
  320. # find our domain, and do something appropriate (send to machine harvard)
  321. R$+<@$D>        $@$>7$1@harvard        user@HARVARD.EDU
  322.  
  323. #
  324. # watch for UUCP to us
  325. # harvard!user<@site.UUCP> <=> user
  326. R$=U!$+<@$+.UUCP>    $@$>7$2            harvard!user@site.UUCP
  327. # watch for uucp-type forwarding to ARPA
  328. # harvard!user<@site.NOTUUCP> <=> user<@site.NOTUUCP>
  329. R$=U!$+<@$+>        $2<@$3>            harvard!USER@SITE.ARPA
  330. # Other forwarding to ARPA - try not to be too amibitious here, use only
  331. #  the canonical hostname
  332. # harvard:user<@site.ANYTHING> <=> user<@site.ANYTHING>
  333. R$=J:$+<@$+>        $2<@$3>            harvard:USER@SITE.ARPA
  334.  
  335. #
  336. # mailer specified addresses
  337. #
  338. # These are here for emergencies and mail testing
  339. #
  340. ifdef(`BITNETRELAY',
  341. `# force to BITNET relay
  342. R$*<@$*;bitnet>        $@$>7$1@$2;bitnet@$F
  343. R$*<@$*;ccnet>        $@$>7$1@$2;ccnet@$F'
  344. ,
  345. `# force to BITNET
  346. R$*<@$-$*;bitnet>    $#bitnet-mailer$@$2$:$1
  347. # problem here - does mailer need user@site.CCNET for destination???
  348. R$*<@$-$*;ccnet>    $#ccnet-mailer$@$2$:$1')
  349.  
  350. ifdef(`ARPARELAY',
  351. `# force to ARPA relay
  352. R$*<@$*;arpa>        $@$>7$1@$2;arpa@$C'
  353. ,
  354. `# force to ARPA
  355. R$*<@$*;arpa>        $#arpa-mailer$@$2$:$1<@$2>')
  356.  
  357. # force to uucp
  358. R$*<@$-$*;uucp>        $#uucp-mailer$@$2$:$1
  359.  
  360. # force to pathalias
  361. R$*<@$*;pathalias>    $#path-mailer$@pathalias:$2!$1
  362.  
  363. ifdef(`ETHERRELAY',
  364. `# force to ether relay
  365. R$*<@$*;ether>        $@$>7$1@$2;ether@$G'
  366. ,
  367. `# force to ether
  368. R$+@$+<@$*;ether>    $#ether-mailer$@$3$:$1@$2
  369. R$*<@$*;ether>        $#ether-mailer$@$2$:$1<@$2>')
  370.  
  371. # put relaying here, before trying to resolve addresses
  372. include(relayrules)
  373.  
  374. #
  375. # non-local addresses
  376. #
  377.  
  378. # resolve UUCP links
  379. ifdef(`PATHALIAS',
  380. `# watch for hosts listed in L.sys but should be pathaliased anyway
  381. R$*<@$=Y.UUCP>        $#path-mailer$@pathalias$:$2!$1',`')
  382. # uucp direct to non-local host
  383. R$*<@$=E.UUCP>        $#uucp-mailer$@$2$:$1    user@host.UUCP
  384. ifdef(`PATHALIAS',
  385. `R$*<@$=E.UUCP;nopath>    $#uucp-mailer$@$2$:$1',`')
  386.  
  387. ifdef(`PATHALIAS',
  388. `# uucp (non-direct) to non-local host - try pathalias
  389. R$*<@$*.UUCP>        $#path-mailer$@pathalias$:$2!$1
  390. # Already tried pathalias, so remove "nopath" specifier
  391. R$*<@$*;nopath>        $1<@$2>            already tried pathalias
  392. R$*;nopath        $1            pathaliased to this host',`')
  393.  
  394. ifdef(`UUCPRELAY',
  395. `# uucp (non-direct) to non-local host - send to UUCP relay host
  396. R$*<@$*.UUCP>        $@$>7$1@$2.UUCP@$E    user@somewhere.UUCP'
  397. ,
  398. `# uucp to unknown host - try uucp anyway
  399. R$*<@$*.UUCP>        $#uucp-mailer$@$2$:$1    user@somewhere.UUCP')
  400.  
  401. ifdef(`BITNETRELAY',
  402. `# BITNET to non-local host - send to local BITNET relay
  403. R$*<@$*.$=Z>        $@$>7$1@$2.$3@$F    user@somewhere.BITNET'
  404. ,
  405. `# BITNET to non-local host direct
  406. R$*<@$*.BITNET>        $#bitnet-mailer$@$2$:$1
  407. R$*<@$*.CCNET>        $#ccnet-mailer$@$2$:$1@$2.CCNET')
  408.  
  409. ifdef(`DECNETRELAY',
  410. `# DECNET to non-local host - send to local DECNET relay
  411. R$*<@$*.DECNET>        $@$>7$1@$2.DECNET@$H    user@somewhere.DECNET'
  412. ,
  413. `# DECNET to non-local host direct
  414. R$*<@$*.DECNET>        $#decnet-mailer$@$2$:$1')
  415.  
  416. ifdef(`ARPARELAY',
  417. `# ARPA to non-local host - send to local ARPA relay
  418. R$*<@$*.$=A>        $@$>7$1@$2.$3@$C    user@somewhere.ARPA
  419. R$*<@$*.$=C>        $@$>7$1@$2.$3@$C    user@somewhere.CSNET'
  420. ,
  421. `# ARPA to non-local host direct
  422. R$*<@$-.$*$=A>        $#arpa-mailer$@$2.$3$4$:$1<@$2.$3$4>
  423. R$*<@$*.DEC>        $#arpa-mailer$@decwrl.dec.com$:$1<@$2.DEC>
  424. R$*<@$*.UTEXAS>        $#arpa-mailer$@sally.utexas.edu$:$1<@$2.UTEXAS>
  425. R$*<@$*.CSNET>        $#arpa-mailer$@relay.cs.net$:$1<@$2.CSNET>
  426. R$*<@$*.MAILNET>    $#arpa-mailer$@mit-multics.arpa$:$1<@$2.MAILNET>')
  427.  
  428. #
  429. # resolve local addresses
  430. #
  431.  
  432. ifdef(`MAILSLAVES',
  433. `# mail to local users on our mail slaves can be delivered directly
  434. R$-<@$=R>        $1')
  435.  
  436. ifdef(`BITNETRELAY',
  437. `# BITNET to local host - send to local BITNET relay
  438. R$*<@$=F>        $@$>7$1@$2.BITNET@$F'
  439. ,
  440. `# BITNET to local host direct
  441. R$*<@$=F>        $#bitnet-mailer$@$2$:$1')
  442.  
  443. ifdef(`DECNETRELAY',
  444. `# decnet to local host - send to local DECNET relay
  445. R$*<@$=H>        $@$>7$1@$2.DECNET@$H'
  446. ,
  447. `# decnet to local host direct
  448. R$*<@$=H>        $#decnet-mailer$@$2$:$1')
  449.  
  450. ifdef(`ETHERRELAY',
  451. `# ethernet to local host - send to local ETHER relay
  452. R$*<@$=G>        $@$>7$1@$2@$G'
  453. ,
  454. `# ethernet to local host direct
  455. R$+@$+<@$=G>        $#ether-mailer$@$3$:$1@$2
  456. R$*<@$=G>        $#ether-mailer$@$2$:$1<@$2>')
  457.  
  458. # uucp to local host
  459. R$*<@$=E>        $#uucp-mailer$@$2$:$1        person@localuucphost
  460.  
  461. ifdef(`LOCALRELAY',
  462. `# to other local hosts - send to local generic LOCAL relay
  463. R$*<@$->        $@$>7$1@$2@$L'
  464. ,
  465. `# unknown local host
  466. ifdef(`DEFAULTMAILER',
  467. `# try default mailer
  468. R$*<@$->        $#$M$@$2$:$1',
  469. `# the buck stops here - local host unknown
  470. R$*<@$*>        $#error$@x$:$2: Unknown local host')')
  471.  
  472. ifdef(`DEFAULTRELAY',
  473. `# Forward to a host which is smarter than us
  474. R$*<@$*>        $@$>7$1@$2@$N        user@unknowndomain',
  475. `# unknown destination host/domain - bounce
  476. R$*<@$*>        $#error$@x$:$2: Unknown host/domain')
  477.  
  478. # remaining names must be local
  479. ifdef(`MAILRELAY',
  480. `# Relay all local mail
  481. R$+            $@$>7$1@$R        everything else'
  482. ,
  483. `R$+            $#local$:$1        everything else')
  484.  
  485.  
  486. #####################################################
  487. #  Code to retry through Rulesets 3 and 0           #
  488. #####################################################
  489. S7
  490.  
  491. # Make canonical
  492. R$+            $:$>3$1
  493. # Retry
  494. R$+            $@$>0$1
  495.  
  496.