home *** CD-ROM | disk | FTP | other *** search
/ ftptest.leeds.ac.uk / 2015.02.ftptest.leeds.ac.uk.tar / ftptest.leeds.ac.uk / pub / pmail / cbiol.cf next >
Text File  |  1999-06-14  |  32KB  |  1,148 lines

  1.  
  2. #
  3. # Copyright (c) 1998 Sendmail, Inc.  All rights reserved.
  4. # Copyright (c) 1983, 1995 Eric P. Allman.  All rights reserved.
  5. # Copyright (c) 1988, 1993
  6. #    The Regents of the University of California.  All rights reserved.
  7. #
  8. # By using this file, you agree to the terms and conditions set
  9. # forth in the LICENSE file which can be found at the top level of
  10. # the sendmail distribution.
  11. #
  12. #
  13.  
  14. ######################################################################
  15. ######################################################################
  16. #####
  17. #####        SENDMAIL CONFIGURATION FILE
  18. #####
  19. ##### built by root@gps1 on Tue Jun 15 13:20:30 BST 1999
  20. ##### in /var/local/src/sendmail/sendmail-8.9.3/cf/leeds
  21. ##### using ../ as configuration include directory
  22. #####
  23. ######################################################################
  24. ######################################################################
  25.  
  26. #####  @(#)cfhead.m4    8.23 (Berkeley) 10/6/1998  #####
  27. #####  @(#)cf.m4    8.29 (Berkeley) 5/19/1998  #####
  28.  
  29. #####  @(#)sgiserv3.mc    1.0 (UCS Leeds) 5-Jun-96  #####
  30.  
  31. #####  @(#)irix5.m4    8.11 (Berkeley) 10/6/1998  #####
  32.  
  33.  
  34. #####  @(#)access_db.m4    8.8 (Berkeley) 5/19/1998  #####
  35.  
  36. #####  @(#)allmasquerade.m4    8.7 (Berkeley) 5/19/1998  #####
  37.  
  38. #####  @(#)masquerade_envelope.m4    8.6 (Berkeley) 5/19/1998  #####
  39.  
  40. #####  @(#)relay_entire_domain.m4    8.7 (Berkeley) 5/19/1998  #####
  41.  
  42. #####  @(#)rbl.m4    8.8 (Berkeley) 5/19/1998  #####
  43. Cwphsatrium.leeds.ac.uk
  44. Cwcbiol.leeds.ac.uk
  45.  
  46.  
  47.  
  48.  
  49. #####  @(#)proto.m4    8.243 (Berkeley) 2/2/1999  #####
  50.  
  51.  
  52. # level 8 config file format
  53. V8/Berkeley
  54.  
  55. # override file safeties - setting this option compromises system security
  56. # need to set this now for the sake of class files
  57. #O DontBlameSendmail=safe
  58.  
  59. ##################
  60. #   local info   #
  61. ##################
  62.  
  63. Cwlocalhost
  64.  
  65. # my official domain name
  66. # ... define this only if sendmail cannot automatically determine your domain
  67. #Dj$w.Foo.COM
  68.  
  69.  
  70. CP.
  71.  
  72. # UUCP relay host
  73. DYuknet.ac.uk
  74. CPUUCP
  75.  
  76. #  BITNET relay host
  77. DBearn-relay.ac.uk
  78. CPBITNET
  79.  
  80. # "Smart" relay host (may be null)
  81. DS
  82.  
  83.  
  84. # operators that cannot be in local usernames (i.e., network indicators)
  85. CO @ % !
  86.  
  87. # a class with just dot (for identifying canonical names)
  88. C..
  89.  
  90. # a class with just a left bracket (for identifying domain literals)
  91. C[[
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99. # Access list database (for spam stomping)
  100. Kaccess dbm /etc/mail/access_db
  101.  
  102.  
  103. # Resolve map (to check if a host exists in check_mail)
  104. Kresolve host -a<OK> -T<TEMP>
  105.  
  106. # Hosts that will permit relaying ($=R)
  107. FR-o /etc/mail/relay-domains
  108.  
  109. # who I send unqualified names to (null means deliver locally)
  110. DR
  111.  
  112. # who gets all local email traffic ($R has precedence for unqualified names)
  113. DH
  114.  
  115. # dequoting map
  116. Kdequote dequote
  117.  
  118. # class E: names that should be exposed as from this host, even if we masquerade
  119. # class L: names that should be delivered locally, even if we have a relay
  120. # class M: domains that should be converted to $M
  121. #CL root
  122. CE root
  123.  
  124. # who I masquerade as (null for no masquerading) (see also $=M)
  125. DMcbiol.leeds.ac.uk
  126.  
  127. # my name for error messages
  128. DnMAILER-DAEMON
  129.  
  130.  
  131. # Configuration version number
  132. DZ8.9.3
  133.  
  134.  
  135. ###############
  136. #   Options   #
  137. ###############
  138.  
  139. # strip message body to 7 bits on input?
  140. O SevenBitInput=False
  141.  
  142. # 8-bit data handling
  143. O EightBitMode=pass8
  144.  
  145.  
  146. # wait for alias file rebuild (default units: minutes)
  147. O AliasWait=10
  148.  
  149. # location of alias file
  150. O AliasFile=/etc/aliases
  151.  
  152. # minimum number of free blocks on filesystem
  153. O MinFreeBlocks=100
  154.  
  155. # maximum message size
  156. #O MaxMessageSize=1000000
  157.  
  158. # substitution for space (blank) characters
  159. O BlankSub=.
  160.  
  161. # avoid connecting to "expensive" mailers on initial submission?
  162. O HoldExpensive=False
  163.  
  164. # checkpoint queue runs after every N successful deliveries
  165. #O CheckpointInterval=10
  166.  
  167. # default delivery mode
  168. O DeliveryMode=background
  169.  
  170. # automatically rebuild the alias database?
  171. #O AutoRebuildAliases
  172.  
  173. # error message header/file
  174. #O ErrorHeader=/etc/sendmail.oE
  175.  
  176. # error mode
  177. #O ErrorMode=print
  178.  
  179. # save Unix-style "From_" lines at top of header?
  180. #O SaveFromLine
  181.  
  182. # temporary file mode
  183. O TempFileMode=0600
  184.  
  185. # match recipients against GECOS field?
  186. #O MatchGECOS
  187.  
  188. # maximum hop count
  189. O MaxHopCount=30
  190.  
  191. # location of help file
  192. O HelpFile=/etc/sendmail.hf
  193.  
  194. # ignore dots as terminators in incoming messages?
  195. #O IgnoreDots
  196.  
  197. # name resolver options
  198. #O ResolverOptions=+AAONLY
  199.  
  200. # deliver MIME-encapsulated error messages?
  201. O SendMimeErrors=False
  202.  
  203. # Forward file search path
  204. O ForwardPath=$z/.forward.$w:$z/.forward
  205.  
  206. # open connection cache size
  207. O ConnectionCacheSize=2
  208.  
  209. # open connection cache timeout
  210. O ConnectionCacheTimeout=5m
  211.  
  212. # persistent host status directory
  213. #O HostStatusDirectory=.hoststat
  214.  
  215. # single thread deliveries (requires HostStatusDirectory)?
  216. #O SingleThreadDelivery
  217.  
  218. # use Errors-To: header?
  219. O UseErrorsTo=False
  220.  
  221. # log level
  222. O LogLevel=9
  223.  
  224. # send to me too, even in an alias expansion?
  225. #O MeToo
  226.  
  227. # verify RHS in newaliases?
  228. O CheckAliases=False
  229.  
  230. # default messages to old style headers if no special punctuation?
  231. O OldStyleHeaders=True
  232.  
  233. # SMTP daemon options
  234. #O DaemonPortOptions=Port=esmtp
  235.  
  236. # privacy flags
  237. O PrivacyOptions=authwarnings
  238.  
  239. # who (if anyone) should get extra copies of error messages
  240. #O PostMasterCopy=Postmaster
  241.  
  242. # slope of queue-only function
  243. #O QueueFactor=600000
  244.  
  245. # queue directory
  246. O QueueDirectory=/var/spool/mqueue
  247.  
  248. # timeouts (many of these)
  249. #O Timeout.initial=5m
  250. #O Timeout.connect=5m
  251. #O Timeout.iconnect=5m
  252. #O Timeout.helo=5m
  253. #O Timeout.mail=10m
  254. #O Timeout.rcpt=1h
  255. #O Timeout.datainit=5m
  256. #O Timeout.datablock=1h
  257. #O Timeout.datafinal=1h
  258. #O Timeout.rset=5m
  259. #O Timeout.quit=2m
  260. #O Timeout.misc=2m
  261. #O Timeout.command=1h
  262. #O Timeout.ident=30s
  263. #O Timeout.fileopen=60s
  264. O Timeout.queuereturn=5d
  265. #O Timeout.queuereturn.normal=5d
  266. #O Timeout.queuereturn.urgent=2d
  267. #O Timeout.queuereturn.non-urgent=7d
  268. O Timeout.queuewarn=4h
  269. #O Timeout.queuewarn.normal=4h
  270. #O Timeout.queuewarn.urgent=1h
  271. #O Timeout.queuewarn.non-urgent=12h
  272. #O Timeout.hoststatus=30m
  273.  
  274. # should we not prune routes in route-addr syntax addresses?
  275. #O DontPruneRoutes
  276.  
  277. # queue up everything before forking?
  278. O SuperSafe=True
  279.  
  280. # status file
  281. O StatusFile=/var/sendmail.st
  282.  
  283. # time zone handling:
  284. #  if undefined, use system default
  285. #  if defined but null, use TZ envariable passed in
  286. #  if defined and non-null, use that info
  287. O TimeZoneSpec=
  288.  
  289. # default UID (can be username or userid:groupid)
  290. O DefaultUser=998:998
  291.  
  292. # list of locations of user database file (null means no lookup)
  293. #O UserDatabaseSpec=/etc/userdb
  294.  
  295. # fallback MX host
  296. #O FallbackMXhost=fall.back.host.net
  297.  
  298. # if we are the best MX host for a site, try it directly instead of config err
  299. #O TryNullMXList
  300.  
  301. # load average at which we just queue messages
  302. O QueueLA=12
  303.  
  304. # load average at which we refuse connections
  305. O RefuseLA=24
  306.  
  307. # maximum number of children we allow at one time
  308. #O MaxDaemonChildren=12
  309.  
  310. # maximum number of new connections per second
  311. #O ConnectionRateThrottle=3
  312.  
  313. # work recipient factor
  314. #O RecipientFactor=30000
  315.  
  316. # deliver each queued job in a separate process?
  317. #O ForkEachJob
  318.  
  319. # work class factor
  320. #O ClassFactor=1800
  321.  
  322. # work time factor
  323. #O RetryFactor=90000
  324.  
  325. # shall we sort the queue by hostname first?
  326. #O QueueSortOrder=priority
  327.  
  328. # minimum time in queue before retry
  329. #O MinQueueAge=30m
  330.  
  331. # default character set
  332. #O DefaultCharSet=iso-8859-1
  333.  
  334. # service switch file (ignored on Solaris, Ultrix, OSF/1, others)
  335. #O ServiceSwitchFile=/etc/service.switch
  336.  
  337. # hosts file (normally /etc/hosts)
  338. #O HostsFile=/etc/hosts
  339.  
  340. # dialup line delay on connection failure
  341. #O DialDelay=10s
  342.  
  343. # action to take if there are no recipients in the message
  344. #O NoRecipientAction=add-to-undisclosed
  345.  
  346. # chrooted environment for writing to files
  347. #O SafeFileEnvironment=/arch
  348.  
  349. # are colons OK in addresses?
  350. #O ColonOkInAddr
  351.  
  352. # how many jobs can you process in the queue?
  353. #O MaxQueueRunSize=10000
  354.  
  355. # shall I avoid expanding CNAMEs (violates protocols)?
  356. #O DontExpandCnames
  357.  
  358. # SMTP initial login message (old $e macro)
  359. O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
  360.  
  361. # UNIX initial From header format (old $l macro)
  362. O UnixFromLine=From $g  $d
  363.  
  364. # From: lines that have embedded newlines are unwrapped onto one line
  365. #O SingleLineFromHeader=False
  366.  
  367. # Allow HELO SMTP command that does not include a host name
  368. #O AllowBogusHELO=False
  369.  
  370. # Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
  371. #O MustQuoteChars=.
  372.  
  373. # delimiter (operator) characters (old $o macro)
  374. O OperatorChars=.:%@!^/[]+
  375.  
  376. # shall I avoid calling initgroups(3) because of high NIS costs?
  377. #O DontInitGroups
  378.  
  379. # are group-writable :include: and .forward files (un)trustworthy?
  380. #O UnsafeGroupWrites
  381.  
  382. # where do errors that occur when sending errors get sent?
  383. #O DoubleBounceAddress=postmaster
  384.  
  385. # what user id do we assume for the majority of the processing?
  386. #O RunAsUser=sendmail
  387.  
  388. # maximum number of recipients per SMTP envelope
  389. #O MaxRecipientsPerMessage=100
  390.  
  391. # shall we get local names from our installed interfaces?
  392. #O DontProbeInterfaces
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399. ###########################
  400. #   Message precedences   #
  401. ###########################
  402.  
  403. Pfirst-class=0
  404. Pspecial-delivery=100
  405. Plist=-30
  406. Pbulk=-60
  407. Pjunk=-100
  408.  
  409. #####################
  410. #   Trusted users   #
  411. #####################
  412.  
  413. # this is equivalent to setting class "t"
  414. #Ft/etc/sendmail.ct
  415. Troot
  416. Tdaemon
  417. Tuucp
  418.  
  419. #########################
  420. #   Format of headers   #
  421. #########################
  422.  
  423. H?P?Return-Path: <$g>
  424. HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
  425.     $.by $j ($v/$Z)$?r with $r$. id $i$?u
  426.     for $u; $|;
  427.     $.$b
  428. H?D?Resent-Date: $a
  429. H?D?Date: $a
  430. H?F?Resent-From: $?x$x <$g>$|$g$.
  431. H?F?From: $?x$x <$g>$|$g$.
  432. H?x?Full-Name: $x
  433. # HPosted-Date: $a
  434. # H?l?Received-Date: $b
  435. H?M?Resent-Message-Id: <$t.$i@$j>
  436. H?M?Message-Id: <$t.$i@$j>
  437. #
  438. ######################################################################
  439. ######################################################################
  440. #####
  441. #####            REWRITING RULES
  442. #####
  443. ######################################################################
  444. ######################################################################
  445.  
  446. ############################################
  447. ###  Ruleset 3 -- Name Canonicalization  ###
  448. ############################################
  449. S3
  450.  
  451. # handle null input (translate to <@> special case)
  452. R$@            $@ <@>
  453.  
  454. # strip group: syntax (not inside angle brackets!) and trailing semicolon
  455. R$*            $: $1 <@>            mark addresses
  456. R$* < $* > $* <@>    $: $1 < $2 > $3            unmark <addr>
  457. R@ $* <@>        $: @ $1                unmark @host:...
  458. R$* :: $* <@>        $: $1 :: $2            unmark node::addr
  459. R:include: $* <@>    $: :include: $1            unmark :include:...
  460. R$* [ $* : $* ] <@>    $: $1 [ $2 : $3 ]        unmark IPv6 addrs
  461. R$* : $* [ $* ]        $: $1 : $2 [ $3 ] <@>        remark if leading colon
  462. R$* : $* <@>        $: $2                strip colon if marked
  463. R$* <@>            $: $1                unmark
  464. R$* ;               $1                strip trailing semi
  465. R$* < $* ; >           $1 < $2 >            bogus bracketed semi
  466.  
  467. # null input now results from list:; syntax
  468. R$@            $@ :; <@>
  469.  
  470. # strip angle brackets -- note RFC733 heuristic to get innermost item
  471. R$*            $: < $1 >            housekeeping <>
  472. R$+ < $* >           < $2 >            strip excess on left
  473. R< $* > $+           < $1 >            strip excess on right
  474. R<>            $@ < @ >            MAIL FROM:<> case
  475. R< $+ >            $: $1                remove housekeeping <>
  476.  
  477. # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
  478. R@ $+ , $+        @ $1 : $2            change all "," to ":"
  479.  
  480. # localize and dispose of route-based addresses
  481. R@ $+ : $+        $@ $>96 < @$1 > : $2        handle <route-addr>
  482.  
  483. # find focus for list syntax
  484. R $+ : $* ; @ $+    $@ $>96 $1 : $2 ; < @ $3 >    list syntax
  485. R $+ : $* ;        $@ $1 : $2;            list syntax
  486.  
  487. # find focus for @ syntax addresses
  488. R$+ @ $+        $: $1 < @ $2 >            focus on domain
  489. R$+ < $+ @ $+ >        $1 $2 < @ $3 >            move gaze right
  490. R$+ < @ $+ >        $@ $>96 $1 < @ $2 >        already canonical
  491.  
  492. # do some sanity checking
  493. R$* < @ $* : $* > $*    $1 < @ $2 $3 > $4        nix colons in addrs
  494.  
  495. # convert old-style addresses to a domain-based address
  496. R$- ! $+        $@ $>96 $2 < @ $1 .UUCP >    resolve uucp names
  497. R$+ . $- ! $+        $@ $>96 $3 < @ $1 . $2 >        domain uucps
  498. R$+ ! $+        $@ $>96 $2 < @ $1 .UUCP >    uucp subdomains
  499.  
  500. # if we have % signs, take the rightmost one
  501. R$* % $*        $1 @ $2                First make them all @s.
  502. R$* @ $* @ $*        $1 % $2 @ $3            Undo all but the last.
  503. R$* @ $*        $@ $>96 $1 < @ $2 >        Insert < > and finish
  504.  
  505. # else we must be a local name
  506. R$*            $@ $>96 $1
  507.  
  508.  
  509. ################################################
  510. ###  Ruleset 96 -- bottom half of ruleset 3  ###
  511. ################################################
  512.  
  513. S96
  514.  
  515. # handle special cases for local names
  516. R$* < @ localhost > $*        $: $1 < @ $j . > $2        no domain at all
  517. R$* < @ localhost . $m > $*    $: $1 < @ $j . > $2        local domain
  518. R$* < @ localhost . UUCP > $*    $: $1 < @ $j . > $2        .UUCP domain
  519. R$* < @ [ $+ ] > $*        $: $1 < @@ [ $2 ] > $3        mark [a.b.c.d]
  520. R$* < @@ $=w > $*        $: $1 < @ $j . > $3        self-literal
  521. R$* < @@ $+ > $*        $@ $1 < @ $2 > $3        canon IP addr
  522.  
  523.  
  524.  
  525.  
  526.  
  527. # pass UUCP addresses straight through
  528. R$* < @ $+ . UUCP > $*        $@ $1 < @ $2 . UUCP . > $3
  529. # pass to name server to make hostname canonical
  530. R$* < @ $* $~P > $*        $: $1 < @ $[ $2 $3 $] > $4
  531.  
  532. # local host aliases and pseudo-domains are always canonical
  533. R$* < @ $=w > $*        $: $1 < @ $2 . > $3
  534. R$* < @ $j > $*            $: $1 < @ $j . > $2
  535. R$* < @ $=M > $*        $: $1 < @ $2 . > $3
  536. R$* < @ $* $=P > $*        $: $1 < @ $2 $3 . > $4
  537. R$* < @ $* . . > $*        $1 < @ $2 . > $3
  538.  
  539.  
  540. ##################################################
  541. ###  Ruleset 4 -- Final Output Post-rewriting  ###
  542. ##################################################
  543. S4
  544.  
  545. R$* <@>            $@                handle <> and list:;
  546.  
  547. # strip trailing dot off possibly canonical name
  548. R$* < @ $+ . > $*    $1 < @ $2 > $3
  549.  
  550. # eliminate internal code -- should never get this far!
  551. R$* < @ *LOCAL* > $*    $1 < @ $j > $2
  552.  
  553. # externalize local domain info
  554. R$* < $+ > $*        $1 $2 $3            defocus
  555. R@ $+ : @ $+ : $+    @ $1 , @ $2 : $3        <route-addr> canonical
  556. R@ $*            $@ @ $1                ... and exit
  557.  
  558. # UUCP must always be presented in old form
  559. R$+ @ $- . UUCP        $2!$1                u@h.UUCP => h!u
  560.  
  561. # delete duplicate local names
  562. R$+ % $=w @ $=w        $1 @ $2                u%host@host => u@host
  563.  
  564.  
  565.  
  566. ##############################################################
  567. ###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
  568. ###           (used for recursive calls)           ###
  569. ##############################################################
  570.  
  571. S97
  572. R$*            $: $>3 $1
  573. R$*            $@ $>0 $1
  574.  
  575.  
  576. ######################################
  577. ###   Ruleset 0 -- Parse Address   ###
  578. ######################################
  579.  
  580. S0
  581.  
  582. R$*            $: $>Parse0 $1        initial parsing
  583. R<@>            $#local $: <@>        special case error msgs
  584. R$*            $: $>98 $1        handle local hacks
  585. R$*            $: $>Parse1 $1        final parsing
  586.  
  587. #
  588. #  Parse0 -- do initial syntax checking and eliminate local addresses.
  589. #    This should either return with the (possibly modified) input
  590. #    or return with a #error mailer.  It should not return with a
  591. #    #mailer other than the #error mailer.
  592. #
  593.  
  594. SParse0
  595. R<@>            $@ <@>            special case error msgs
  596. R$* : $* ; <@>        $#error $@ 5.1.3 $: "List:; syntax illegal for recipient addresses"
  597. #R@ <@ $* >        < @ $1 >        catch "@@host" bogosity
  598. R<@ $+>            $#error $@ 5.1.3 $: "User address required"
  599. R$*            $: <> $1
  600. R<> $* < @ [ $+ ] > $*    $1 < @ [ $2 ] > $3
  601. R<> $* <$* : $* > $*    $#error $@ 5.1.3 $: "Colon illegal in host name part"
  602. R<> $*            $1
  603. R$* < @ . $* > $*    $#error $@ 5.1.2 $: "Invalid host name"
  604. R$* < @ $* .. $* > $*    $#error $@ 5.1.2 $: "Invalid host name"
  605.  
  606. # now delete the local info -- note $=O to find characters that cause forwarding
  607. R$* < @ > $*        $@ $>Parse0 $>3 $1        user@ => user
  608. R< @ $=w . > : $*    $@ $>Parse0 $>3 $2        @here:... -> ...
  609. R$- < @ $=w . >        $: $(dequote $1 $) < @ $2 . >    dequote "foo"@here
  610. R< @ $+ >        $#error $@ 5.1.3 $: "User address required"
  611. R$* $=O $* < @ $=w . >    $@ $>Parse0 $>3 $1 $2 $3    ...@here -> ...
  612. R$-             $: $(dequote $1 $) < @ *LOCAL* >    dequote "foo"
  613. R< @ *LOCAL* >        $#error $@ 5.1.3 $: "User address required"
  614. R$* $=O $* < @ *LOCAL* >
  615.             $@ $>Parse0 $>3 $1 $2 $3    ...@*LOCAL* -> ...
  616. R$* < @ *LOCAL* >    $: $1
  617.  
  618. #
  619. #  Parse1 -- the bottom half of ruleset 0.
  620. #
  621.  
  622. SParse1
  623. # handle numeric address spec
  624. R$* < @ [ $+ ] > $*    $: $>98 $1 < @ [ $2 ] > $3    numeric internet spec
  625. R$* < @ [ $+ ] > $*    $#esmtp $@ [$2] $: $1 < @ [$2] > $3    still numeric: send
  626.  
  627.  
  628. # short circuit local delivery so forwarded email works
  629. R$=L < @ $=w . >    $#local $: @ $1        special local names
  630. R$+ < @ $=w . >        $#local $: $1            regular local name
  631.  
  632.  
  633. # resolve remotely connected UUCP links (if any)
  634.  
  635. # resolve fake top level domains by forwarding to other hosts
  636. R$*<@$+.BITNET.>$*    $: $>95 < $B > $1 <@$2.BITNET.> $3    user@host.BITNET
  637.  
  638. # forward non-local UUCP traffic to our UUCP relay
  639. R$*<@$*.UUCP.>$*        $: $>95 < $Y > $1 <@$2.UUCP.> $3    uucp mail
  640.  
  641.  
  642. # pass names that still have a host to a smarthost (if defined)
  643. R$* < @ $* > $*        $: $>95 < $S > $1 < @ $2 > $3    glue on smarthost name
  644.  
  645. # deal with other remote names
  646. R$* < @$* > $*        $#esmtp $@ $2 $: $1 < @ $2 > $3        user@host.domain
  647.  
  648. # handle locally delivered names
  649. R$=L            $#local $: @ $1            special local names
  650. R$+            $#local $: $1            regular local names
  651.  
  652. ###########################################################################
  653. ###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
  654. ###########################################################################
  655.  
  656. S5
  657.  
  658. # deal with plussed users so aliases work nicely
  659. R$+ + *            $#local $@ $&h $: $1
  660. R$+ + $*        $#local $@ + $2 $: $1 + *
  661.  
  662. # prepend an empty "forward host" on the front
  663. R$+            $: <> $1
  664.  
  665.  
  666. # see if we have a relay or a hub
  667. R< > $+            $: < $H > $1            try hub
  668. R< > $+            $: < $R > $1            try relay
  669. R< > $+            $: < > < $1 $&h >        nope, restore +detail
  670. R< > < $+ + $* > $*       < > < $1 > + $2 $3        find the user part
  671. R< > < $+ > + $*    $#local $@ $2 $: @ $1        strip the extra +
  672. R< > < $+ >        $@ $1                no +detail
  673. R$+            $: $1 <> $&h            add +detail back in
  674. R$+ <> + $*        $: $1 + $2            check whether +detail
  675. R$+ <> $*        $: $1                else discard
  676. R< local : $* > $*    $: $>95 < local : $1 > $2    no host extension
  677. R< error : $* > $*    $: $>95 < error : $1 > $2    no host extension
  678. R< $- : $+ > $+        $: $>95 < $1 : $2 > $3 < @ $2 >
  679. R< $+ > $+        $@ $>95 < $1 > $2 < @ $1 >
  680.  
  681.  
  682. ###################################################################
  683. ###  Ruleset 95 -- canonify mailer:[user@]host syntax to triple    ###
  684. ###################################################################
  685.  
  686. S95
  687. R< > $*                $@ $1            strip off null relay
  688. R< error : $- $+ > $*        $#error $@ $(dequote $1 $) $: $2
  689. R< local : $* > $*        $>CanonLocal < $1 > $2
  690. R< $- : $+ @ $+ > $*<$*>$*    $# $1 $@ $3 $: $2<@$3>    use literal user
  691. R< $- : $+ > $*            $# $1 $@ $2 $: $3    try qualified mailer
  692. R< $=w > $*            $@ $2            delete local host
  693. R< $+ > $*            $#relay $@ $1 $: $2    use unqualified mailer
  694.  
  695. ###################################################################
  696. ###  Ruleset CanonLocal -- canonify local: syntax        ###
  697. ###################################################################
  698.  
  699. SCanonLocal
  700. # strip local host from routed addresses
  701. R< $* > < @ $+ > : $+        $@ $>97 $3
  702. R< $* > $+ $=O $+ < @ $+ >    $@ $>97 $2 $3 $4
  703.  
  704. # strip trailing dot from any host name that may appear
  705. R< $* > $* < @ $* . >        $: < $1 > $2 < @ $3 >
  706.  
  707. # handle local: syntax -- use old user, either with or without host
  708. R< > $* < @ $* > $*        $#local $@ $1@$2 $: $1
  709. R< > $+                $#local $@ $1    $: $1
  710.  
  711. # handle local:user@host syntax -- ignore host part
  712. R< $+ @ $+ > $* < @ $* >    $: < $1 > $3 < @ $4 >
  713.  
  714. # handle local:user syntax
  715. R< $+ > $* <@ $* > $*        $#local $@ $2@$3 $: $1
  716. R< $+ > $*             $#local $@ $2    $: $1
  717.  
  718. ###################################################################
  719. ###  Ruleset 93 -- convert header names to masqueraded form    ###
  720. ###################################################################
  721.  
  722. S93
  723.  
  724.  
  725. # special case the users that should be exposed
  726. R$=E < @ *LOCAL* >    $@ $1 < @ $j . >        leave exposed
  727. R$=E < @ $=M . >    $@ $1 < @ $2 . >
  728. R$=E < @ $=w . >    $@ $1 < @ $2 . >
  729.  
  730. # handle domain-specific masquerading
  731. R$* < @ $=M . > $*    $: $1 < @ $2 . @ $M > $3    convert masqueraded doms
  732. R$* < @ $=w . > $*    $: $1 < @ $2 . @ $M > $3
  733. R$* < @ *LOCAL* > $*    $: $1 < @ $j . @ $M > $2
  734. R$* < @ $+ @ > $*    $: $1 < @ $2 > $3        $M is null
  735. R$* < @ $+ @ $+ > $*    $: $1 < @ $3 . > $4        $M is not null
  736.  
  737. ###################################################################
  738. ###  Ruleset 94 -- convert envelope names to masqueraded form    ###
  739. ###################################################################
  740.  
  741. S94
  742. R$+            $@ $>93 $1
  743.  
  744. ###################################################################
  745. ###  Ruleset 98 -- local part of ruleset zero (can be null)    ###
  746. ###################################################################
  747.  
  748. S98
  749.  
  750.  
  751. ######################################################################
  752. ###  LookUpDomain -- search for domain in access database
  753. ###
  754. ###    Parameters:
  755. ###        <$1> -- key (domain name)
  756. ###        <$2> -- default (what to return if not found in db)
  757. ###        <$3> -- passthru (additional data passed unchanged through)
  758. ######################################################################
  759.  
  760. SLookUpDomain
  761. R<$+> <$+> <$*>        $: < $(access $1 $: ? $) > <$1> <$2> <$3>
  762. R<?> <$+.$+> <$+> <$*>    $@ $>LookUpDomain <$2> <$3> <$4>
  763. R<?> <$+> <$+> <$*>    $@ <$2> <$3>
  764. R<$*> <$+> <$+> <$*>    $@ <$1> <$4>
  765.  
  766. ######################################################################
  767. ###  LookUpAddress -- search for host address in access database
  768. ###
  769. ###    Parameters:
  770. ###        <$1> -- key (dot quadded host address)
  771. ###        <$2> -- default (what to return if not found in db)
  772. ###        <$3> -- passthru (additional data passed through)
  773. ######################################################################
  774.  
  775. SLookUpAddress
  776. R<$+> <$+> <$*>        $: < $(access $1 $: ? $) > <$1> <$2> <$3>
  777. R<?> <$+.$-> <$+> <$*>    $@ $>LookUpAddress <$1> <$3> <$4>
  778. R<?> <$+> <$+> <$*>    $@ <$2> <$3>
  779. R<$*> <$+> <$+> <$*>    $@ <$1> <$4>
  780.  
  781. ######################################################################
  782. ###  CanonAddr --    Convert an address into a standard form for
  783. ###            relay checking.  Route address syntax is
  784. ###            crudely converted into a %-hack address.
  785. ###
  786. ###    Parameters:
  787. ###        $1 -- full recipient address
  788. ###
  789. ###    Returns:
  790. ###        parsed address, not in source route form
  791. ######################################################################
  792.  
  793. SCanonAddr
  794. R$*            $: $>Parse0 $>3 $1    make domain canonical
  795. R< @ $+ > : $* @ $*    < @ $1 > : $2 % $3    change @ to % in src route
  796. R$* < @ $+ > : $* : $*    $3 $1 < @ $2 > : $4    change to % hack.
  797. R$* < @ $+ > : $*    $3 $1 < @ $2 >
  798.  
  799. ######################################################################
  800. ###  ParseRecipient --    Strip off hosts in $=R as well as possibly
  801. ###            $* $=m or the access database.
  802. ###            Check user portion for host separators.
  803. ###
  804. ###    Parameters:
  805. ###        $1 -- full recipient address
  806. ###
  807. ###    Returns:
  808. ###        parsed, non-local-relaying address
  809. ######################################################################
  810.  
  811. SParseRecipient
  812. R$*                $: <?> $>CanonAddr $1
  813. R<?> $* < @ $* . >        <?> $1 < @ $2 >            strip trailing dots
  814. R<?> $- < @ $* >        $: <?> $(dequote $1 $) < @ $2 >    dequote local part
  815.  
  816. # if no $=O character, no host in the user portion, we are done
  817. R<?> $* $=O $* < @ $* >        $: <NO> $1 $2 $3 < @ $4>
  818. R<?> $*                $@ $1
  819.  
  820. # if we relay, check username portion for user%host so host can be checked also
  821. R<NO> $* < @ $* $=m >        $: <RELAY> $1 < @ $2 $3 >
  822.  
  823.  
  824. R<NO> $* < @ $* $=R >        $: <RELAY> $1 < @ $2 $3 >
  825. R<NO> $* < @ $+ >        $: $>LookUpDomain <$2> <NO> <$1 < @ $2 >>
  826. R<$+> <$+>            $: <$1> $2
  827.  
  828. R<RELAY> $* < @ $* >        $@ $>ParseRecipient $1
  829. R<$-> $*            $@ $2
  830.  
  831. ######################################################################
  832. ###  check_relay -- check hostname/address on SMTP startup
  833. ######################################################################
  834.  
  835. SLocal_check_relay
  836. Scheck_relay
  837. R$*            $: $1 $| $>"Local_check_relay" $1
  838. R$* $| $* $| $#$*    $#$3
  839. R$* $| $* $| $*        $@ $>"Basic_check_relay" $1 $| $2
  840.  
  841. SBasic_check_relay
  842. # check for deferred delivery mode
  843. R$*            $: < ${deliveryMode} > $1
  844. R< d > $*        $@ deferred
  845. R< $* > $*        $: $2
  846.  
  847. R$+ $| $+        $: $>LookUpDomain < $1 > <?> < $2 >
  848. R<?> < $+ >        $: $>LookUpAddress < $1 > <?> < $1 >
  849. R<?> < $+ >        $: $1
  850. R<OK> < $* >        $@ OK
  851. R<RELAY> < $* >        $@ RELAY
  852. R<REJECT> $*        $#error $@ 5.7.1 $: "550 Access denied"
  853. R<DISCARD> $*        $#discard $: discard
  854. R<$+> $*        $#error $@ 5.7.1 $: $1
  855.  
  856. # DNS based IP address spam lists
  857. R$*            $: $&{client_addr}
  858. R$-.$-.$-.$-        $: $(host $4.$3.$2.$1.rbl.maps.vix.com. $: OK $)
  859. ROK            $@ OK
  860. R$+            $#error $@ 5.7.1 $: "Mail from " $&{client_addr} " refused by blackhole site rbl.maps.vix.com"
  861.  
  862. ######################################################################
  863. ###  check_mail -- check SMTP `MAIL FROM:' command argument
  864. ######################################################################
  865.  
  866. SLocal_check_mail
  867. Scheck_mail
  868. R$*            $: $1 $| $>"Local_check_mail" $1
  869. R$* $| $#$*        $#$2
  870. R$* $| $*        $@ $>"Basic_check_mail" $1
  871.  
  872. SBasic_check_mail
  873. # check for deferred delivery mode
  874. R$*            $: < ${deliveryMode} > $1
  875. R< d > $*        $@ deferred
  876. R< $* > $*        $: $2
  877.  
  878. R<>            $@ <OK>
  879. R$*            $: <?> $>CanonAddr $1
  880. R<?> $* < @ $+ . >    <?> $1 < @ $2 >            strip trailing dots
  881. # handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
  882. R<?> $* < $* $=P > $*    $: <OK> $1 < @ $2 $3 > $4
  883. R<?> $* < @ $+ > $*    $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > $3
  884. R<? $* <$->> $* < @ $+ > $*
  885.             $: <$2> $3 < @ $4 > $5
  886.  
  887. # handle case of @localhost on address
  888. R<$+> $* < @localhost >    $: < ? $&{client_name} > <$1> $2 < @localhost >
  889. R<$+> $* < @localhost.$m >
  890.             $: < ? $&{client_name} > <$1> $2 < @localhost.$m >
  891. R<$+> $* < @localhost.UUCP >
  892.             $: < ? $&{client_name} > <$1> $2 < @localhost.UUCP >
  893. R<? $=w> <$+> $*    <?> <$2> $3
  894. R<? $+> <$+> $*        $#error $@ 5.5.4 $: "553 Real domain name required"
  895. R<?> <$+> $*        $: <$1> $2
  896.  
  897. # lookup localpart (user@)
  898. R<$+> $* < @ $+ > $*    $: <USER $(access $2@ $: ? $) > <$1> $2 < @ $3 > $4
  899. # no match, try full address (user@domain rest)
  900. R<USER ?> <$+> $* < @ $* > $*
  901.             $: <USER $(access $2@$3$4 $: ? $) > <$1> $2 < @ $3 > $4
  902. # no match, try address (user@domain)
  903. R<USER ?> <$+> $+ < @ $+ > $*
  904.             $: <USER $(access $2@$3 $: ? $) > <$1> $2 < @ $3 > $4
  905. # no match, try (sub)domain (domain)
  906. R<USER ?> <$+> $* < @ $+ > $*
  907.             $: $>LookUpDomain <$3> <$1> <>
  908. # check unqualified user in access database
  909. R<?> $*            $: <USER $(access $1@ $: ? $) > <?> $1
  910. # retransform for further use
  911. R<USER $+> <$+> $*    $: <$1> $3
  912.  
  913. # handle case of no @domain on address
  914. R<?> $*            $: < ? $&{client_name} > $1
  915. R<?> $*            $@ <OK>                ...local unqualed ok
  916. R<? $+> $*        $#error $@ 5.5.4 $: "553 Domain name required"
  917.                             ...remote is not
  918. # check results
  919. R<?> $*            $@ <OK>
  920. R<OK> $*        $@ <OK>
  921. R<TEMP> $*        $#error $@ 4.1.8 $: "451 Sender domain must resolve"
  922. R<PERM> $*        $#error $@ 5.1.8 $: "501 Sender domain must exist"
  923. R<RELAY> $*        $@ <RELAY>
  924. R<DISCARD> $*        $#discard $: discard
  925. R<REJECT> $*        $#error $@ 5.7.1 $: "550 Access denied"
  926. R<$+> $*        $#error $@ 5.7.1 $: $1        error from access db
  927.  
  928. ######################################################################
  929. ###  check_rcpt -- check SMTP `RCPT TO:' command argument
  930. ######################################################################
  931.  
  932. SLocal_check_rcpt
  933. Scheck_rcpt
  934. R$*            $: $1 $| $>"Local_check_rcpt" $1
  935. R$* $| $#$*        $#$2
  936. R$* $| $*        $@ $>"Basic_check_rcpt" $1
  937.  
  938. SBasic_check_rcpt
  939. # check for deferred delivery mode
  940. R$*            $: < ${deliveryMode} > $1
  941. R< d > $*        $@ deferred
  942. R< $* > $*        $: $2
  943.  
  944. R$*            $: $>ParseRecipient $1        strip relayable hosts
  945.  
  946.  
  947.  
  948.  
  949. # anything terminating locally is ok
  950. R$+ < @ $* $=m >    $@ OK
  951. R$+ < @ $=w >        $@ OK
  952. R$+ < @ $* $=R >    $@ OK
  953. R$+ < @ $* >        $: $>LookUpDomain <$2> <?> <$1 < @ $2 >>
  954. R<RELAY> $*        $@ RELAY
  955. R<$*> <$*>        $: $2
  956.  
  957.  
  958. # check for local user (i.e. unqualified address)
  959. R$*            $: <?> $1
  960. R<?> $* < @ $+ >    $: <REMOTE> $1 < @ $2 >
  961. # local user is ok
  962. R<?> $+            $@ OK
  963. R<$+> $*        $: $2
  964.  
  965. # anything originating locally is ok
  966. R$*            $: <?> $&{client_name}
  967. # check if bracketed IP address (forward lookup != reverse lookup)
  968. R<?> [$+]        $: <BAD> [$1]
  969. # pass to name server to make hostname canonical
  970. R<?> $* $~P         $: <?> $[ $1 $2 $]
  971. R<$-> $*        $: $2
  972. R$* .            $1                strip trailing dots
  973. R$@            $@ OK
  974. R$* $=m            $@ OK
  975. R$=w            $@ OK
  976. R$* $=R            $@ OK
  977. R$*            $: $>LookUpDomain <$1> <?> <$1>
  978. R<RELAY> $*        $@ RELAY
  979. R<$*> <$*>        $: $2
  980.  
  981. # check IP address
  982. R$*            $: $&{client_addr}
  983. R$@            $@ OK            originated locally
  984. R0            $@ OK            originated locally
  985. R$=R $*            $@ OK            relayable IP address
  986. R$*            $: $>LookUpAddress <$1> <?> <$1>
  987. R<RELAY> $*         $@ RELAY        relayable IP address
  988. R<$*> <$*>        $: $2
  989. R$*            $: [ $1 ]        put brackets around it...
  990. R$=w            $@ OK            ... and see if it is local
  991.  
  992.  
  993. # anything else is bogus
  994. R$*            $#error $@ 5.7.1 $: "550 Relaying denied"
  995.  
  996. #
  997. ######################################################################
  998. ######################################################################
  999. #####
  1000. #####            MAILER DEFINITIONS
  1001. #####
  1002. ######################################################################
  1003. ######################################################################
  1004.  
  1005.  
  1006. ##################################################
  1007. ###   Local and Program Mailer specification   ###
  1008. ##################################################
  1009.  
  1010. #####  @(#)local.m4    8.30 (Berkeley) 6/30/1998  #####
  1011.  
  1012. Mlocal,        P=/bin/mail, F=lsDFMAw5:/|@qEhmu9, S=10/30, R=20/40,
  1013.         C=iso-8859-1, T=DNS/RFC822/X-Unix,
  1014.         A=mail -s -d $u
  1015. Mprog,        P=/bin/sh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
  1016.         T=X-Unix,
  1017.         A=sh -c $u
  1018.  
  1019. #
  1020. #  Envelope sender rewriting
  1021. #
  1022. S10
  1023. R<@>            $n            errors to mailer-daemon
  1024. R@ <@ $*>        $n            temporarily bypass Sun bogosity
  1025. R$+            $: $>50 $1        add local domain if needed
  1026. R$*            $: $>94 $1        do masquerading
  1027.  
  1028. #
  1029. #  Envelope recipient rewriting
  1030. #
  1031. S20
  1032. R$+ < @ $* >        $: $1            strip host part
  1033.  
  1034. #
  1035. #  Header sender rewriting
  1036. #
  1037. S30
  1038. R<@>            $n            errors to mailer-daemon
  1039. R@ <@ $*>        $n            temporarily bypass Sun bogosity
  1040. R$+            $: $>50 $1        add local domain if needed
  1041. R$*            $: $>93 $1        do masquerading
  1042.  
  1043. #
  1044. #  Header recipient rewriting
  1045. #
  1046. S40
  1047. R$+            $: $>50 $1        add local domain if needed
  1048. R$*            $: $>93 $1        do all-masquerading
  1049.  
  1050. #
  1051. #  Common code to add local domain name (only if always-add-domain)
  1052. #
  1053. S50
  1054.  
  1055. #####################################
  1056. ###   SMTP Mailer specification   ###
  1057. #####################################
  1058.  
  1059. #####  @(#)smtp.m4    8.38 (Berkeley) 5/19/1998  #####
  1060.  
  1061. Msmtp,        P=[IPC], F=mDFMuX, S=11/31, R=21/31, E=\r\n, L=990,
  1062.         T=DNS/RFC822/SMTP,
  1063.         A=IPC $h
  1064. Mesmtp,        P=[IPC], F=mDFMuXa, S=11/31, R=21/31, E=\r\n, L=990,
  1065.         T=DNS/RFC822/SMTP,
  1066.         A=IPC $h
  1067. Msmtp8,        P=[IPC], F=mDFMuX8, S=11/31, R=21/31, E=\r\n, L=990,
  1068.         T=DNS/RFC822/SMTP,
  1069.         A=IPC $h
  1070. Mrelay,        P=[IPC], F=mDFMuXa8, S=11/31, R=61/71, E=\r\n, L=2040,
  1071.         T=DNS/RFC822/SMTP,
  1072.         A=IPC $h
  1073.  
  1074. #
  1075. #  envelope sender rewriting
  1076. #
  1077. S11
  1078. R$+            $: $>51 $1            sender/recipient common
  1079. R$* :; <@>        $@                list:; special case
  1080. R$*            $: $>61 $1            qualify unqual'ed names
  1081. R$+            $: $>94 $1            do masquerading
  1082.  
  1083.  
  1084. #
  1085. #  envelope recipient rewriting --
  1086. #  also header recipient if not masquerading recipients
  1087. #
  1088. S21
  1089. R$+            $: $>51 $1            sender/recipient common
  1090. R$+            $: $>61 $1            qualify unqual'ed names
  1091.  
  1092.  
  1093. #
  1094. #  header sender and masquerading header recipient rewriting
  1095. #
  1096. S31
  1097. R$+            $: $>51 $1            sender/recipient common
  1098. R:; <@>            $@                list:; special case
  1099.  
  1100. # do special header rewriting
  1101. R$* <@> $*        $@ $1 <@> $2            pass null host through
  1102. R< @ $* > $*        $@ < @ $1 > $2            pass route-addr through
  1103. R$*            $: $>61 $1            qualify unqual'ed names
  1104. R$+            $: $>93 $1            do masquerading
  1105.  
  1106.  
  1107. #
  1108. #  convert pseudo-domain addresses to real domain addresses
  1109. #
  1110. S51
  1111.  
  1112. # pass <route-addr>s through
  1113. R< @ $+ > $*        $@ < @ $1 > $2            resolve <route-addr>
  1114.  
  1115. # output fake domains as user%fake@relay
  1116. R$+ <@ $+ .BITNET. >    $: $1 % $2 .BITNET < @ $B >    user@host.BITNET
  1117. R$+.BITNET <@ $+:$+ >    $: $1 .BITNET < @ $3 >        strip mailer: part
  1118.  
  1119. # do UUCP heuristics; note that these are shared with UUCP mailers
  1120. R$+ < @ $+ .UUCP. >    $: < $2 ! > $1            convert to UUCP form
  1121. R$+ < @ $* > $*        $@ $1 < @ $2 > $3        not UUCP form
  1122.  
  1123. # leave these in .UUCP form to avoid further tampering
  1124. R< $&h ! > $- ! $+    $@ $2 < @ $1 .UUCP. >
  1125. R< $&h ! > $-.$+ ! $+    $@ $3 < @ $1.$2 >
  1126. R< $&h ! > $+        $@ $1 < @ $&h .UUCP. >
  1127. R< $+ ! > $+        $: $1 ! $2 < @ $Y >        use uknet.ac.uk
  1128. R$+ < @ $+ : $+ >    $@ $1 < @ $3 >            strip mailer: part
  1129. R$+ < @ >        $: $1 < @ *LOCAL* >        if no uknet.ac.uk
  1130.  
  1131.  
  1132. #
  1133. #  common sender and masquerading recipient rewriting
  1134. #
  1135. S61
  1136.  
  1137. R$* < @ $* > $*        $@ $1 < @ $2 > $3        already fully qualified
  1138. R$+            $@ $1 < @ *LOCAL* >        add local qualification
  1139.  
  1140.  
  1141. #
  1142. #  relay mailer header masquerading recipient rewriting
  1143. #
  1144. S71
  1145.  
  1146. R$+            $: $>61 $1
  1147. R$+            $: $>93 $1
  1148.