sendmail transition: Do not pre-generate sendmail.cf
[dragonfly.git] / contrib / sendmail-8.14 / cf / cf / generic-linux.cf
1 #
2 # Copyright (c) 1998-2004, 2009, 2010 Sendmail, Inc. and its suppliers.
3 #       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 ca@wiz.smi.sendmail.com on Sat May 14 21:31:13 PDT 2011
20 ##### in /extra/home/ca/sm-8.14.5/OpenSource/sendmail-8.14.5/cf/cf
21 ##### using ../ as configuration include directory
22 #####
23 ######################################################################
24 #####
25 #####   DO NOT EDIT THIS FILE!  Only edit the source .mc file.
26 #####
27 ######################################################################
28 ######################################################################
29
30 #####  $Id: cfhead.m4,v 8.121 2010/01/07 18:20:19 ca Exp $  #####
31 #####  $Id: cf.m4,v 8.32 1999/02/07 07:26:14 gshapiro Exp $  #####
32 #####  $Id: generic-linux.mc,v 8.1 1999/09/24 22:48:05 gshapiro Exp $  #####
33
34 #####  $Id: linux.m4,v 8.13 2000/09/17 17:30:00 gshapiro Exp $  #####
35
36
37
38 #####  $Id: local_procmail.m4,v 8.22 2002/11/17 04:24:19 ca Exp $  #####
39
40
41 #####  $Id: generic.m4,v 8.15 1999/04/04 00:51:09 ca Exp $  #####
42
43 #####  $Id: redirect.m4,v 8.15 1999/08/06 01:47:36 gshapiro Exp $  #####
44
45 #####  $Id: use_cw_file.m4,v 8.11 2001/08/26 20:58:57 gshapiro Exp $  #####
46
47
48
49 #####  $Id: proto.m4,v 8.744 2010/11/23 20:29:47 guenther Exp $  #####
50
51 # level 10 config file format
52 V10/Berkeley
53
54 # override file safeties - setting this option compromises system security,
55 # addressing the actual file configuration problem is preferred
56 # need to set this before any file actions are encountered in the cf file
57 #O DontBlameSendmail=safe
58
59 # default LDAP map specification
60 # need to set this now before any LDAP maps are defined
61 #O LDAPDefaultSpec=-h localhost
62
63 ##################
64 #   local info   #
65 ##################
66
67 # my LDAP cluster
68 # need to set this before any LDAP lookups are done (including classes)
69 #D{sendmailMTACluster}$m
70
71 Cwlocalhost
72 # file containing names of hosts for which we receive email
73 Fw/etc/mail/local-host-names
74
75 # my official domain name
76 # ... define this only if sendmail cannot automatically determine your domain
77 #Dj$w.Foo.COM
78
79 # host/domain names ending with a token in class P are canonical
80 CP.
81
82 # "Smart" relay host (may be null)
83 DS
84
85
86 # operators that cannot be in local usernames (i.e., network indicators)
87 CO @ % !
88
89 # a class with just dot (for identifying canonical names)
90 C..
91
92 # a class with just a left bracket (for identifying domain literals)
93 C[[
94
95
96 # Resolve map (to check if a host exists in check_mail)
97 Kresolve host -a<OKR> -T<TEMP>
98 C{ResOk}OKR
99
100
101 # Hosts for which relaying is permitted ($=R)
102 FR-o /etc/mail/relay-domains
103
104 # arithmetic map
105 Karith arith
106
107
108
109
110
111 # dequoting map
112 Kdequote dequote
113
114 # class E: names that should be exposed as from this host, even if we masquerade
115 # class L: names that should be delivered locally, even if we have a relay
116 # class M: domains that should be converted to $M
117 # class N: domains that should not be converted to $M
118 #CL root
119 C{E}root
120
121
122
123 # my name for error messages
124 DnMAILER-DAEMON
125
126
127 CPREDIRECT
128
129 # Configuration version number
130 DZ8.14.5
131
132
133 ###############
134 #   Options   #
135 ###############
136
137 # strip message body to 7 bits on input?
138 O SevenBitInput=False
139
140 # 8-bit data handling
141 #O EightBitMode=pass8
142
143 # wait for alias file rebuild (default units: minutes)
144 O AliasWait=10
145
146 # location of alias file
147 O AliasFile=/etc/mail/aliases
148
149 # minimum number of free blocks on filesystem
150 O MinFreeBlocks=100
151
152 # maximum message size
153 #O MaxMessageSize=0
154
155 # substitution for space (blank) characters
156 O BlankSub=.
157
158 # avoid connecting to "expensive" mailers on initial submission?
159 O HoldExpensive=False
160
161 # checkpoint queue runs after every N successful deliveries
162 #O CheckpointInterval=10
163
164 # default delivery mode
165 O DeliveryMode=background
166
167 # error message header/file
168 #O ErrorHeader=/etc/mail/error-header
169
170 # error mode
171 #O ErrorMode=print
172
173 # save Unix-style "From_" lines at top of header?
174 #O SaveFromLine=False
175
176 # queue file mode (qf files)
177 #O QueueFileMode=0600
178
179 # temporary file mode
180 O TempFileMode=0600
181
182 # match recipients against GECOS field?
183 #O MatchGECOS=False
184
185 # maximum hop count
186 #O MaxHopCount=25
187
188 # location of help file
189 O HelpFile=/etc/mail/helpfile
190
191 # ignore dots as terminators in incoming messages?
192 #O IgnoreDots=False
193
194 # name resolver options
195 #O ResolverOptions=+AAONLY
196
197 # deliver MIME-encapsulated error messages?
198 O SendMimeErrors=True
199
200 # Forward file search path
201 O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward
202
203 # open connection cache size
204 O ConnectionCacheSize=2
205
206 # open connection cache timeout
207 O ConnectionCacheTimeout=5m
208
209 # persistent host status directory
210 #O HostStatusDirectory=.hoststat
211
212 # single thread deliveries (requires HostStatusDirectory)?
213 #O SingleThreadDelivery=False
214
215 # use Errors-To: header?
216 O UseErrorsTo=False
217
218 # log level
219 O LogLevel=9
220
221 # send to me too, even in an alias expansion?
222 #O MeToo=True
223
224 # verify RHS in newaliases?
225 O CheckAliases=False
226
227 # default messages to old style headers if no special punctuation?
228 O OldStyleHeaders=True
229
230 # SMTP daemon options
231 O DaemonPortOptions=Name=MTA
232 O DaemonPortOptions=Port=587, Name=MSA, M=E
233
234 # SMTP client options
235 #O ClientPortOptions=Family=inet, Address=0.0.0.0
236
237 # Modifiers to define {daemon_flags} for direct submissions
238 #O DirectSubmissionModifiers
239
240 # Use as mail submission program? See sendmail/SECURITY
241 #O UseMSP
242
243 # privacy flags
244 O PrivacyOptions=authwarnings
245
246 # who (if anyone) should get extra copies of error messages
247 #O PostmasterCopy=Postmaster
248
249 # slope of queue-only function
250 #O QueueFactor=600000
251
252 # limit on number of concurrent queue runners
253 #O MaxQueueChildren
254
255 # maximum number of queue-runners per queue-grouping with multiple queues
256 #O MaxRunnersPerQueue=1
257
258 # priority of queue runners (nice(3))
259 #O NiceQueueRun
260
261 # shall we sort the queue by hostname first?
262 #O QueueSortOrder=priority
263
264 # minimum time in queue before retry
265 #O MinQueueAge=30m
266
267 # how many jobs can you process in the queue?
268 #O MaxQueueRunSize=0
269
270 # perform initial split of envelope without checking MX records
271 #O FastSplit=1
272
273 # queue directory
274 O QueueDirectory=/var/spool/mqueue
275
276 # key for shared memory; 0 to turn off, -1 to auto-select
277 #O SharedMemoryKey=0
278
279 # file to store auto-selected key for shared memory (SharedMemoryKey = -1)
280 #O SharedMemoryKeyFile
281
282 # timeouts (many of these)
283 #O Timeout.initial=5m
284 #O Timeout.connect=5m
285 #O Timeout.aconnect=0s
286 #O Timeout.iconnect=5m
287 #O Timeout.helo=5m
288 #O Timeout.mail=10m
289 #O Timeout.rcpt=1h
290 #O Timeout.datainit=5m
291 #O Timeout.datablock=1h
292 #O Timeout.datafinal=1h
293 #O Timeout.rset=5m
294 #O Timeout.quit=2m
295 #O Timeout.misc=2m
296 #O Timeout.command=1h
297 #O Timeout.ident=5s
298 #O Timeout.fileopen=60s
299 #O Timeout.control=2m
300 O Timeout.queuereturn=5d
301 #O Timeout.queuereturn.normal=5d
302 #O Timeout.queuereturn.urgent=2d
303 #O Timeout.queuereturn.non-urgent=7d
304 #O Timeout.queuereturn.dsn=5d
305 O Timeout.queuewarn=4h
306 #O Timeout.queuewarn.normal=4h
307 #O Timeout.queuewarn.urgent=1h
308 #O Timeout.queuewarn.non-urgent=12h
309 #O Timeout.queuewarn.dsn=4h
310 #O Timeout.hoststatus=30m
311 #O Timeout.resolver.retrans=5s
312 #O Timeout.resolver.retrans.first=5s
313 #O Timeout.resolver.retrans.normal=5s
314 #O Timeout.resolver.retry=4
315 #O Timeout.resolver.retry.first=4
316 #O Timeout.resolver.retry.normal=4
317 #O Timeout.lhlo=2m
318 #O Timeout.auth=10m
319 #O Timeout.starttls=1h
320
321 # time for DeliverBy; extension disabled if less than 0
322 #O DeliverByMin=0
323
324 # should we not prune routes in route-addr syntax addresses?
325 #O DontPruneRoutes=False
326
327 # queue up everything before forking?
328 O SuperSafe=True
329
330 # status file
331 #O StatusFile
332
333 # time zone handling:
334 #  if undefined, use system default
335 #  if defined but null, use TZ envariable passed in
336 #  if defined and non-null, use that info
337 #O TimeZoneSpec=
338
339 # default UID (can be username or userid:groupid)
340 #O DefaultUser=mailnull
341
342 # list of locations of user database file (null means no lookup)
343 #O UserDatabaseSpec=/etc/mail/userdb
344
345 # fallback MX host
346 #O FallbackMXhost=fall.back.host.net
347
348 # fallback smart host
349 #O FallbackSmartHost=fall.back.host.net
350
351 # if we are the best MX host for a site, try it directly instead of config err
352 #O TryNullMXList=False
353
354 # load average at which we just queue messages
355 #O QueueLA=8
356
357 # load average at which we refuse connections
358 #O RefuseLA=12
359
360 # log interval when refusing connections for this long
361 #O RejectLogInterval=3h
362
363 # load average at which we delay connections; 0 means no limit
364 #O DelayLA=0
365
366 # maximum number of children we allow at one time
367 #O MaxDaemonChildren=0
368
369 # maximum number of new connections per second
370 #O ConnectionRateThrottle=0
371
372 # Width of the window 
373 #O ConnectionRateWindowSize=60s
374
375 # work recipient factor
376 #O RecipientFactor=30000
377
378 # deliver each queued job in a separate process?
379 #O ForkEachJob=False
380
381 # work class factor
382 #O ClassFactor=1800
383
384 # work time factor
385 #O RetryFactor=90000
386
387 # default character set
388 #O DefaultCharSet=unknown-8bit
389
390 # service switch file (name hardwired on Solaris, Ultrix, OSF/1, others)
391 #O ServiceSwitchFile=/etc/mail/service.switch
392
393 # hosts file (normally /etc/hosts)
394 #O HostsFile=/etc/hosts
395
396 # dialup line delay on connection failure
397 #O DialDelay=0s
398
399 # action to take if there are no recipients in the message
400 #O NoRecipientAction=none
401
402 # chrooted environment for writing to files
403 #O SafeFileEnvironment
404
405 # are colons OK in addresses?
406 #O ColonOkInAddr=True
407
408 # shall I avoid expanding CNAMEs (violates protocols)?
409 #O DontExpandCnames=False
410
411 # SMTP initial login message (old $e macro)
412 O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
413
414 # UNIX initial From header format (old $l macro)
415 O UnixFromLine=From $g $d
416
417 # From: lines that have embedded newlines are unwrapped onto one line
418 #O SingleLineFromHeader=False
419
420 # Allow HELO SMTP command that does not include a host name
421 #O AllowBogusHELO=False
422
423 # Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
424 #O MustQuoteChars=.
425
426 # delimiter (operator) characters (old $o macro)
427 O OperatorChars=.:%@!^/[]+
428
429 # shall I avoid calling initgroups(3) because of high NIS costs?
430 #O DontInitGroups=False
431
432 # are group-writable :include: and .forward files (un)trustworthy?
433 # True (the default) means they are not trustworthy.
434 #O UnsafeGroupWrites=True
435
436
437 # where do errors that occur when sending errors get sent?
438 #O DoubleBounceAddress=postmaster
439
440 # issue temporary errors (4xy) instead of permanent errors (5xy)?
441 #O SoftBounce=False
442
443 # where to save bounces if all else fails
444 #O DeadLetterDrop=/var/tmp/dead.letter
445
446 # what user id do we assume for the majority of the processing?
447 #O RunAsUser=sendmail
448
449 # maximum number of recipients per SMTP envelope
450 #O MaxRecipientsPerMessage=0
451
452 # limit the rate recipients per SMTP envelope are accepted
453 # once the threshold number of recipients have been rejected
454 #O BadRcptThrottle=0
455
456
457 # shall we get local names from our installed interfaces?
458 #O DontProbeInterfaces=False
459
460 # Return-Receipt-To: header implies DSN request
461 #O RrtImpliesDsn=False
462
463 # override connection address (for testing)
464 #O ConnectOnlyTo=0.0.0.0
465
466 # Trusted user for file ownership and starting the daemon
467 #O TrustedUser=root
468
469 # Control socket for daemon management
470 #O ControlSocketName=/var/spool/mqueue/.control
471
472 # Maximum MIME header length to protect MUAs
473 #O MaxMimeHeaderLength=0/0
474
475 # Maximum length of the sum of all headers
476 O MaxHeadersLength=32768
477
478 # Maximum depth of alias recursion
479 #O MaxAliasRecursion=10
480
481 # location of pid file
482 #O PidFile=/var/run/sendmail.pid
483
484 # Prefix string for the process title shown on 'ps' listings
485 #O ProcessTitlePrefix=prefix
486
487 # Data file (df) memory-buffer file maximum size
488 #O DataFileBufferSize=4096
489
490 # Transcript file (xf) memory-buffer file maximum size
491 #O XscriptFileBufferSize=4096
492
493 # lookup type to find information about local mailboxes
494 #O MailboxDatabase=pw
495
496 # override compile time flag REQUIRES_DIR_FSYNC
497 #O RequiresDirfsync=true
498
499 # list of authentication mechanisms
500 #O AuthMechanisms=EXTERNAL GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5
501
502 # Authentication realm
503 #O AuthRealm
504
505 # default authentication information for outgoing connections
506 #O DefaultAuthInfo=/etc/mail/default-auth-info
507
508 # SMTP AUTH flags
509 #O AuthOptions
510
511 # SMTP AUTH maximum encryption strength
512 #O AuthMaxBits
513
514 # SMTP STARTTLS server options
515 #O TLSSrvOptions
516
517
518 # Input mail filters
519 #O InputMailFilters
520
521
522 # CA directory
523 #O CACertPath
524 # CA file
525 #O CACertFile
526 # Server Cert
527 #O ServerCertFile
528 # Server private key
529 #O ServerKeyFile
530 # Client Cert
531 #O ClientCertFile
532 # Client private key
533 #O ClientKeyFile
534 # File containing certificate revocation lists 
535 #O CRLFile
536 # DHParameters (only required if DSA/DH is used)
537 #O DHParameters
538 # Random data source (required for systems without /dev/urandom under OpenSSL)
539 #O RandFile
540
541 # Maximum number of "useless" commands before slowing down
542 #O MaxNOOPCommands=20
543
544 # Name to use for EHLO (defaults to $j)
545 #O HeloName
546
547 ############################
548 # QUEUE GROUP DEFINITIONS  #
549 ############################
550
551
552 ###########################
553 #   Message precedences   #
554 ###########################
555
556 Pfirst-class=0
557 Pspecial-delivery=100
558 Plist=-30
559 Pbulk=-60
560 Pjunk=-100
561
562 #####################
563 #   Trusted users   #
564 #####################
565
566 # this is equivalent to setting class "t"
567 #Ft/etc/mail/trusted-users
568 Troot
569 Tdaemon
570 Tuucp
571
572 #########################
573 #   Format of headers   #
574 #########################
575
576 H?P?Return-Path: <$g>
577 HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
578         $.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_ssf}$.)
579         $.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
580         (version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u
581         for $u; $|;
582         $.$b
583 H?D?Resent-Date: $a
584 H?D?Date: $a
585 H?F?Resent-From: $?x$x <$g>$|$g$.
586 H?F?From: $?x$x <$g>$|$g$.
587 H?x?Full-Name: $x
588 # HPosted-Date: $a
589 # H?l?Received-Date: $b
590 H?M?Resent-Message-Id: <$t.$i@$j>
591 H?M?Message-Id: <$t.$i@$j>
592
593 #\f
594 ######################################################################
595 ######################################################################
596 #####
597 #####                   REWRITING RULES
598 #####
599 ######################################################################
600 ######################################################################
601
602 ############################################
603 ###  Ruleset 3 -- Name Canonicalization  ###
604 ############################################
605 Scanonify=3
606
607 # handle null input (translate to <@> special case)
608 R$@                     $@ <@>
609
610 # strip group: syntax (not inside angle brackets!) and trailing semicolon
611 R$*                     $: $1 <@>                       mark addresses
612 R$* < $* > $* <@>       $: $1 < $2 > $3                 unmark <addr>
613 R@ $* <@>               $: @ $1                         unmark @host:...
614 R$* [ IPv6 : $+ ] <@>   $: $1 [ IPv6 : $2 ]             unmark IPv6 addr
615 R$* :: $* <@>           $: $1 :: $2                     unmark node::addr
616 R:include: $* <@>       $: :include: $1                 unmark :include:...
617 R$* : $* [ $* ]         $: $1 : $2 [ $3 ] <@>           remark if leading colon
618 R$* : $* <@>            $: $2                           strip colon if marked
619 R$* <@>                 $: $1                           unmark
620 R$* ;                      $1                           strip trailing semi
621 R$* < $+ :; > $*        $@ $2 :; <@>                    catch <list:;>
622 R$* < $* ; >               $1 < $2 >                    bogus bracketed semi
623
624 # null input now results from list:; syntax
625 R$@                     $@ :; <@>
626
627 # strip angle brackets -- note RFC733 heuristic to get innermost item
628 R$*                     $: < $1 >                       housekeeping <>
629 R$+ < $* >                 < $2 >                       strip excess on left
630 R< $* > $+                 < $1 >                       strip excess on right
631 R<>                     $@ < @ >                        MAIL FROM:<> case
632 R< $+ >                 $: $1                           remove housekeeping <>
633
634 # strip route address <@a,@b,@c:user@d> -> <user@d>
635 R@ $+ , $+              $2
636 R@ [ $* ] : $+          $2
637 R@ $+ : $+              $2
638
639 # find focus for list syntax
640 R $+ : $* ; @ $+        $@ $>Canonify2 $1 : $2 ; < @ $3 >       list syntax
641 R $+ : $* ;             $@ $1 : $2;                     list syntax
642
643 # find focus for @ syntax addresses
644 R$+ @ $+                $: $1 < @ $2 >                  focus on domain
645 R$+ < $+ @ $+ >         $1 $2 < @ $3 >                  move gaze right
646 R$+ < @ $+ >            $@ $>Canonify2 $1 < @ $2 >      already canonical
647
648
649 # convert old-style addresses to a domain-based address
650 R$- ! $+                $@ $>Canonify2 $2 < @ $1 .UUCP >        resolve uucp names
651 R$+ . $- ! $+           $@ $>Canonify2 $3 < @ $1 . $2 >         domain uucps
652 R$+ ! $+                $@ $>Canonify2 $2 < @ $1 .UUCP >        uucp subdomains
653
654 # if we have % signs, take the rightmost one
655 R$* % $*                $1 @ $2                         First make them all @s.
656 R$* @ $* @ $*           $1 % $2 @ $3                    Undo all but the last.
657 R$* @ $*                $@ $>Canonify2 $1 < @ $2 >      Insert < > and finish
658
659 # else we must be a local name
660 R$*                     $@ $>Canonify2 $1
661
662
663 ################################################
664 ###  Ruleset 96 -- bottom half of ruleset 3  ###
665 ################################################
666
667 SCanonify2=96
668
669 # handle special cases for local names
670 R$* < @ localhost > $*          $: $1 < @ $j . > $2             no domain at all
671 R$* < @ localhost . $m > $*     $: $1 < @ $j . > $2             local domain
672 R$* < @ localhost . UUCP > $*   $: $1 < @ $j . > $2             .UUCP domain
673
674 # check for IPv4/IPv6 domain literal
675 R$* < @ [ $+ ] > $*             $: $1 < @@ [ $2 ] > $3          mark [addr]
676 R$* < @@ $=w > $*               $: $1 < @ $j . > $3             self-literal
677 R$* < @@ $+ > $*                $@ $1 < @ $2 > $3               canon IP addr
678
679
680
681
682
683 # if really UUCP, handle it immediately
684
685 # try UUCP traffic as a local address
686 R$* < @ $+ . UUCP > $*          $: $1 < @ $[ $2 $] . UUCP . > $3
687 R$* < @ $+ . . UUCP . > $*      $@ $1 < @ $2 . > $3
688
689 # hostnames ending in class P are always canonical
690 R$* < @ $* $=P > $*             $: $1 < @ $2 $3 . > $4
691 R$* < @ $* $~P > $*             $: $&{daemon_flags} $| $1 < @ $2 $3 > $4
692 R$* CC $* $| $* < @ $+.$+ > $*  $: $3 < @ $4.$5 . > $6
693 R$* CC $* $| $*                 $: $3
694 # pass to name server to make hostname canonical
695 R$* $| $* < @ $* > $*           $: $2 < @ $[ $3 $] > $4
696 R$* $| $*                       $: $2
697
698 # local host aliases and pseudo-domains are always canonical
699 R$* < @ $=w > $*                $: $1 < @ $2 . > $3
700 R$* < @ $=M > $*                $: $1 < @ $2 . > $3
701 R$* < @ $* . . > $*             $1 < @ $2 . > $3
702
703
704 ##################################################
705 ###  Ruleset 4 -- Final Output Post-rewriting  ###
706 ##################################################
707 Sfinal=4
708
709 R$+ :; <@>              $@ $1 :                         handle <list:;>
710 R$* <@>                 $@                              handle <> and list:;
711
712 # strip trailing dot off possibly canonical name
713 R$* < @ $+ . > $*       $1 < @ $2 > $3
714
715 # eliminate internal code
716 R$* < @ *LOCAL* > $*    $1 < @ $j > $2
717
718 # externalize local domain info
719 R$* < $+ > $*           $1 $2 $3                        defocus
720 R@ $+ : @ $+ : $+       @ $1 , @ $2 : $3                <route-addr> canonical
721 R@ $*                   $@ @ $1                         ... and exit
722
723 # UUCP must always be presented in old form
724 R$+ @ $- . UUCP         $2!$1                           u@h.UUCP => h!u
725
726 # delete duplicate local names
727 R$+ % $=w @ $=w         $1 @ $2                         u%host@host => u@host
728
729
730
731 ##############################################################
732 ###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
733 ###                (used for recursive calls)              ###
734 ##############################################################
735
736 SRecurse=97
737 R$*                     $: $>canonify $1
738 R$*                     $@ $>parse $1
739
740
741 ######################################
742 ###   Ruleset 0 -- Parse Address   ###
743 ######################################
744
745 Sparse=0
746
747 R$*                     $: $>Parse0 $1          initial parsing
748 R<@>                    $#local $: <@>          special case error msgs
749 R$*                     $: $>ParseLocal $1      handle local hacks
750 R$*                     $: $>Parse1 $1          final parsing
751
752 #
753 #  Parse0 -- do initial syntax checking and eliminate local addresses.
754 #       This should either return with the (possibly modified) input
755 #       or return with a #error mailer.  It should not return with a
756 #       #mailer other than the #error mailer.
757 #
758
759 SParse0
760 R<@>                    $@ <@>                  special case error msgs
761 R$* : $* ; <@>          $#error $@ 5.1.3 $: "553 List:; syntax illegal for recipient addresses"
762 R@ <@ $* >              < @ $1 >                catch "@@host" bogosity
763 R<@ $+>                 $#error $@ 5.1.3 $: "553 User address required"
764 R$+ <@>                 $#error $@ 5.1.3 $: "553 Hostname required"
765 R$*                     $: <> $1
766 R<> $* < @ [ $* ] : $+ > $*     $1 < @ [ $2 ] : $3 > $4
767 R<> $* < @ [ $* ] , $+ > $*     $1 < @ [ $2 ] , $3 > $4
768 R<> $* < @ [ $* ] $+ > $*       $#error $@ 5.1.2 $: "553 Invalid address"
769 R<> $* < @ [ $+ ] > $*          $1 < @ [ $2 ] > $3
770 R<> $* <$* : $* > $*    $#error $@ 5.1.3 $: "553 Colon illegal in host name part"
771 R<> $*                  $1
772 R$* < @ . $* > $*       $#error $@ 5.1.2 $: "553 Invalid host name"
773 R$* < @ $* .. $* > $*   $#error $@ 5.1.2 $: "553 Invalid host name"
774 R$* < @ $* @ > $*       $#error $@ 5.1.2 $: "553 Invalid route address"
775 R$* @ $* < @ $* > $*    $#error $@ 5.1.3 $: "553 Invalid route address"
776 R$* , $~O $*            $#error $@ 5.1.3 $: "553 Invalid route address"
777
778
779 # now delete the local info -- note $=O to find characters that cause forwarding
780 R$* < @ > $*            $@ $>Parse0 $>canonify $1       user@ => user
781 R< @ $=w . > : $*       $@ $>Parse0 $>canonify $2       @here:... -> ...
782 R$- < @ $=w . >         $: $(dequote $1 $) < @ $2 . >   dequote "foo"@here
783 R< @ $+ >               $#error $@ 5.1.3 $: "553 User address required"
784 R$* $=O $* < @ $=w . >  $@ $>Parse0 $>canonify $1 $2 $3 ...@here -> ...
785 R$-                     $: $(dequote $1 $) < @ *LOCAL* >        dequote "foo"
786 R< @ *LOCAL* >          $#error $@ 5.1.3 $: "553 User address required"
787 R$* $=O $* < @ *LOCAL* >
788                         $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ...
789 R$* < @ *LOCAL* >       $: $1
790
791 #
792 #  Parse1 -- the bottom half of ruleset 0.
793 #
794
795 SParse1
796
797 # handle numeric address spec
798 R$* < @ [ $+ ] > $*     $: $>ParseLocal $1 < @ [ $2 ] > $3      numeric internet spec
799 R$* < @ [ $+ ] > $*     $: $1 < @ [ $2 ] : $S > $3      Add smart host to path
800 R$* < @ [ $+ ] : > $*           $#esmtp $@ [$2] $: $1 < @ [$2] > $3     no smarthost: send
801 R$* < @ [ $+ ] : $- : $*> $*    $#$3 $@ $4 $: $1 < @ [$2] > $5  smarthost with mailer
802 R$* < @ [ $+ ] : $+ > $*        $#esmtp $@ $3 $: $1 < @ [$2] > $4       smarthost without mailer
803
804
805 # short circuit local delivery so forwarded email works
806
807
808 R$=L < @ $=w . >        $#local $: @ $1                 special local names
809 R$+ < @ $=w . >         $#local $: $1                   regular local name
810
811
812 # resolve remotely connected UUCP links (if any)
813
814 # resolve fake top level domains by forwarding to other hosts
815
816
817
818 # pass names that still have a host to a smarthost (if defined)
819 R$* < @ $* > $*         $: $>MailerToTriple < $S > $1 < @ $2 > $3       glue on smarthost name
820
821 # deal with other remote names
822 R$* < @$* > $*          $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
823
824 # handle locally delivered names
825 R$=L                    $#local $: @ $1         special local names
826 R$+                     $#local $: $1                   regular local names
827
828 ###########################################################################
829 ###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
830 ###########################################################################
831
832 SLocal_localaddr
833 Slocaladdr=5
834 R$+                     $: $1 $| $>"Local_localaddr" $1
835 R$+ $| $#ok             $@ $1                   no change
836 R$+ $| $#$*             $#$2
837 R$+ $| $*               $: $1
838
839
840
841
842 # deal with plussed users so aliases work nicely
843 R$+ + *                 $#local $@ $&h $: $1
844 R$+ + $*                $#local $@ + $2 $: $1 + *
845
846 # prepend an empty "forward host" on the front
847 R$+                     $: <> $1
848
849
850
851 R< > $+                 $: < > < $1 <> $&h >            nope, restore +detail
852
853 R< > < $+ <> + $* >     $: < > < $1 + $2 >              check whether +detail
854 R< > < $+ <> $* >       $: < > < $1 >                   else discard
855 R< > < $+ + $* > $*        < > < $1 > + $2 $3           find the user part
856 R< > < $+ > + $*        $#local $@ $2 $: @ $1           strip the extra +
857 R< > < $+ >             $@ $1                           no +detail
858 R$+                     $: $1 <> $&h                    add +detail back in
859
860 R$+ <> + $*             $: $1 + $2                      check whether +detail
861 R$+ <> $*               $: $1                           else discard
862 R< local : $* > $*      $: $>MailerToTriple < local : $1 > $2   no host extension
863 R< error : $* > $*      $: $>MailerToTriple < error : $1 > $2   no host extension
864
865 R< $~[ : $+ > $+        $: $>MailerToTriple < $1 : $2 > $3 < @ $2 >
866
867 R< $+ > $+              $@ $>MailerToTriple < $1 > $2 < @ $1 >
868
869
870 ###################################################################
871 ###  Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
872 ###################################################################
873
874 SMailerToTriple=95
875 R< > $*                         $@ $1                   strip off null relay
876 R< error : $-.$-.$- : $+ > $*   $#error $@ $1.$2.$3 $: $4
877 R< error : $- : $+ > $*         $#error $@ $(dequote $1 $) $: $2
878 R< error : $+ > $*              $#error $: $1
879 R< local : $* > $*              $>CanonLocal < $1 > $2
880 R< $~[ : $+ @ $+ > $*<$*>$*     $# $1 $@ $3 $: $2<@$3>  use literal user
881 R< $~[ : $+ > $*                $# $1 $@ $2 $: $3       try qualified mailer
882 R< $=w > $*                     $@ $2                   delete local host
883 R< $+ > $*                      $#relay $@ $1 $: $2     use unqualified mailer
884
885 ###################################################################
886 ###  Ruleset CanonLocal -- canonify local: syntax               ###
887 ###################################################################
888
889 SCanonLocal
890 # strip local host from routed addresses
891 R< $* > < @ $+ > : $+           $@ $>Recurse $3
892 R< $* > $+ $=O $+ < @ $+ >      $@ $>Recurse $2 $3 $4
893
894 # strip trailing dot from any host name that may appear
895 R< $* > $* < @ $* . >           $: < $1 > $2 < @ $3 >
896
897 # handle local: syntax -- use old user, either with or without host
898 R< > $* < @ $* > $*             $#local $@ $1@$2 $: $1
899 R< > $+                         $#local $@ $1    $: $1
900
901 # handle local:user@host syntax -- ignore host part
902 R< $+ @ $+ > $* < @ $* >        $: < $1 > $3 < @ $4 >
903
904 # handle local:user syntax
905 R< $+ > $* <@ $* > $*           $#local $@ $2@$3 $: $1
906 R< $+ > $*                      $#local $@ $2    $: $1
907
908 ###################################################################
909 ###  Ruleset 93 -- convert header names to masqueraded form     ###
910 ###################################################################
911
912 SMasqHdr=93
913
914
915 # do not masquerade anything in class N
916 R$* < @ $* $=N . >      $@ $1 < @ $2 $3 . >
917
918 R$* < @ *LOCAL* >       $@ $1 < @ $j . >
919
920 ###################################################################
921 ###  Ruleset 94 -- convert envelope names to masqueraded form   ###
922 ###################################################################
923
924 SMasqEnv=94
925 R$* < @ *LOCAL* > $*    $: $1 < @ $j . > $2
926
927 ###################################################################
928 ###  Ruleset 98 -- local part of ruleset zero (can be null)     ###
929 ###################################################################
930
931 SParseLocal=98
932
933 # addresses sent to foo@host.REDIRECT will give a 551 error code
934 R$* < @ $+ .REDIRECT. >         $: $1 < @ $2 . REDIRECT . > < ${opMode} >
935 R$* < @ $+ .REDIRECT. > <i>     $: $1 < @ $2 . REDIRECT. >
936 R$* < @ $+ .REDIRECT. > < $- >  $#error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
937
938
939
940
941
942 ######################################################################
943 ###  CanonAddr --       Convert an address into a standard form for
944 ###                     relay checking.  Route address syntax is
945 ###                     crudely converted into a %-hack address.
946 ###
947 ###     Parameters:
948 ###             $1 -- full recipient address
949 ###
950 ###     Returns:
951 ###             parsed address, not in source route form
952 ######################################################################
953
954 SCanonAddr
955 R$*                     $: $>Parse0 $>canonify $1       make domain canonical
956
957
958 ######################################################################
959 ###  ParseRecipient --  Strip off hosts in $=R as well as possibly
960 ###                     $* $=m or the access database.
961 ###                     Check user portion for host separators.
962 ###
963 ###     Parameters:
964 ###             $1 -- full recipient address
965 ###
966 ###     Returns:
967 ###             parsed, non-local-relaying address
968 ######################################################################
969
970 SParseRecipient
971 R$*                             $: <?> $>CanonAddr $1
972 R<?> $* < @ $* . >              <?> $1 < @ $2 >                 strip trailing dots
973 R<?> $- < @ $* >                $: <?> $(dequote $1 $) < @ $2 > dequote local part
974
975 # if no $=O character, no host in the user portion, we are done
976 R<?> $* $=O $* < @ $* >         $: <NO> $1 $2 $3 < @ $4>
977 R<?> $*                         $@ $1
978
979
980 R<NO> $* < @ $* $=R >           $: <RELAY> $1 < @ $2 $3 >
981
982
983
984 R<RELAY> $* < @ $* >            $@ $>ParseRecipient $1
985 R<$+> $*                        $@ $2
986
987
988 ######################################################################
989 ###  check_relay -- check hostname/address on SMTP startup
990 ######################################################################
991
992
993
994 SLocal_check_relay
995 Scheck_relay
996 R$*                     $: $1 $| $>"Local_check_relay" $1
997 R$* $| $* $| $#$*       $#$3
998 R$* $| $* $| $*         $@ $>"Basic_check_relay" $1 $| $2
999
1000 SBasic_check_relay
1001 # check for deferred delivery mode
1002 R$*                     $: < $&{deliveryMode} > $1
1003 R< d > $*               $@ deferred
1004 R< $* > $*              $: $2
1005
1006
1007
1008 ######################################################################
1009 ###  check_mail -- check SMTP `MAIL FROM:' command argument
1010 ######################################################################
1011
1012 SLocal_check_mail
1013 Scheck_mail
1014 R$*                     $: $1 $| $>"Local_check_mail" $1
1015 R$* $| $#$*             $#$2
1016 R$* $| $*               $@ $>"Basic_check_mail" $1
1017
1018 SBasic_check_mail
1019 # check for deferred delivery mode
1020 R$*                     $: < $&{deliveryMode} > $1
1021 R< d > $*               $@ deferred
1022 R< $* > $*              $: $2
1023
1024 # authenticated?
1025 R$*                     $: $1 $| $>"tls_client" $&{verify} $| MAIL
1026 R$* $| $#$+             $#$2
1027 R$* $| $*               $: $1
1028
1029 R<>                     $@ <OK>                 we MUST accept <> (RFC 1123)
1030 R$+                     $: <?> $1
1031 R<?><$+>                $: <@> <$1>
1032 R<?>$+                  $: <@> <$1>
1033 R$*                     $: $&{daemon_flags} $| $1
1034 R$* f $* $| <@> < $* @ $- >     $: < ? $&{client_name} > < $3 @ $4 >
1035 R$* u $* $| <@> < $* >  $: <?> < $3 >
1036 R$* $| $*               $: $2
1037 # handle case of @localhost on address
1038 R<@> < $* @ localhost > $: < ? $&{client_name} > < $1 @ localhost >
1039 R<@> < $* @ [127.0.0.1] >
1040                         $: < ? $&{client_name} > < $1 @ [127.0.0.1] >
1041 R<@> < $* @ localhost.$m >
1042                         $: < ? $&{client_name} > < $1 @ localhost.$m >
1043 R<@> < $* @ localhost.UUCP >
1044                         $: < ? $&{client_name} > < $1 @ localhost.UUCP >
1045 R<@> $*                 $: $1                   no localhost as domain
1046 R<? $=w> $*             $: $2                   local client: ok
1047 R<? $+> <$+>            $#error $@ 5.5.4 $: "553 Real domain name required for sender address"
1048 R<?> $*                 $: $1
1049 R$*                     $: <?> $>CanonAddr $1           canonify sender address and mark it
1050 R<?> $* < @ $+ . >      <?> $1 < @ $2 >                 strip trailing dots
1051 # handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
1052 R<?> $* < @ $* $=P >    $: <OKR> $1 < @ $2 $3 >
1053 R<?> $* < @ $j >        $: <OKR> $1 < @ $j >
1054 R<?> $* < @ $+ >        $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 >
1055 R<? $* <$->> $* < @ $+ >
1056                         $: <$2> $3 < @ $4 >
1057
1058
1059 # handle case of no @domain on address
1060 R<?> $*                 $: $&{daemon_flags} $| <?> $1
1061 R$* u $* $| <?> $*      $: <OKR> $3
1062 R$* $| $*               $: $2
1063 R<?> $*                 $: < ? $&{client_addr} > $1
1064 R<?> $*                 $@ <OKR>                        ...local unqualed ok
1065 R<? $+> $*              $#error $@ 5.5.4 $: "553 Domain name required for sender address " $&f
1066                                                         ...remote is not
1067 # check results
1068 R<?> $*                 $: @ $1         mark address: nothing known about it
1069 R<$={ResOk}> $*         $: @ $2         domain ok
1070 R<TEMP> $*              $#error $@ 4.1.8 $: "451 Domain of sender address " $&f " does not resolve"
1071 R<PERM> $*              $#error $@ 5.1.8 $: "553 Domain of sender address " $&f " does not exist"
1072
1073
1074
1075 ######################################################################
1076 ###  check_rcpt -- check SMTP `RCPT TO:' command argument
1077 ######################################################################
1078
1079 SLocal_check_rcpt
1080 Scheck_rcpt
1081 R$*                     $: $1 $| $>"Local_check_rcpt" $1
1082 R$* $| $#$*             $#$2
1083 R$* $| $*               $@ $>"Basic_check_rcpt" $1
1084
1085 SBasic_check_rcpt
1086 # empty address?
1087 R<>                     $#error $@ nouser $: "553 User address required"
1088 R$@                     $#error $@ nouser $: "553 User address required"
1089 # check for deferred delivery mode
1090 R$*                     $: < $&{deliveryMode} > $1
1091 R< d > $*               $@ deferred
1092 R< $* > $*              $: $2
1093
1094
1095 ######################################################################
1096 R$*                     $: $1 $| @ $>"Rcpt_ok" $1
1097 R$* $| @ $#TEMP $+      $: $1 $| T $2
1098 R$* $| @ $#$*           $#$2
1099 R$* $| @ RELAY          $@ RELAY
1100 R$* $| @ $*             $: O $| $>"Relay_ok" $1
1101 R$* $| T $+             $: T $2 $| $>"Relay_ok" $1
1102 R$* $| $#TEMP $+        $#error $2
1103 R$* $| $#$*             $#$2
1104 R$* $| RELAY            $@ RELAY
1105 R T $+ $| $*            $#error $1
1106 # anything else is bogus
1107 R$*                     $#error $@ 5.7.1 $: "550 Relaying denied"
1108
1109
1110 ######################################################################
1111 ### Rcpt_ok: is the recipient ok?
1112 ######################################################################
1113 SRcpt_ok
1114 R$*                     $: $>ParseRecipient $1          strip relayable hosts
1115
1116
1117
1118
1119 # authenticated via TLS?
1120 R$*                     $: $1 $| $>RelayTLS     client authenticated?
1121 R$* $| $# $+            $# $2                   error/ok?
1122 R$* $| $*               $: $1                   no
1123
1124 R$*                     $: $1 $| $>"Local_Relay_Auth" $&{auth_type}
1125 R$* $| $# $*            $# $2
1126 R$* $| NO               $: $1
1127 R$* $| $*               $: $1 $| $&{auth_type}
1128 R$* $|                  $: $1
1129 R$* $| $={TrustAuthMech}        $# RELAY
1130 R$* $| $*               $: $1
1131 # anything terminating locally is ok
1132 R$+ < @ $=w >           $@ RELAY
1133 R$+ < @ $* $=R >        $@ RELAY
1134
1135
1136
1137
1138 # check for local user (i.e. unqualified address)
1139 R$*                     $: <?> $1
1140 R<?> $* < @ $+ >        $: <REMOTE> $1 < @ $2 >
1141 # local user is ok
1142 R<?> $+                 $@ RELAY
1143 R<$+> $*                $: $2
1144
1145 ######################################################################
1146 ### Relay_ok: is the relay/sender ok?
1147 ######################################################################
1148 SRelay_ok
1149 # anything originating locally is ok
1150 # check IP address
1151 R$*                     $: $&{client_addr}
1152 R$@                     $@ RELAY                originated locally
1153 R0                      $@ RELAY                originated locally
1154 R127.0.0.1              $@ RELAY                originated locally
1155 RIPv6:::1               $@ RELAY                originated locally
1156 R$=R $*                 $@ RELAY                relayable IP address
1157 R$*                     $: [ $1 ]               put brackets around it...
1158 R$=w                    $@ RELAY                ... and see if it is local
1159
1160
1161 # check client name: first: did it resolve?
1162 R$*                     $: < $&{client_resolve} >
1163 R<TEMP>                 $#TEMP $@ 4.4.0 $: "450 Relaying temporarily denied. Cannot resolve PTR record for " $&{client_addr}
1164 R<FORGED>               $#error $@ 5.7.1 $: "550 Relaying denied. IP name possibly forged " $&{client_name}
1165 R<FAIL>                 $#error $@ 5.7.1 $: "550 Relaying denied. IP name lookup failed " $&{client_name}
1166 R$*                     $: <@> $&{client_name}
1167 # pass to name server to make hostname canonical
1168 R<@> $* $=P             $:<?>  $1 $2
1169 R<@> $+                 $:<?>  $[ $1 $]
1170 R$* .                   $1                      strip trailing dots
1171 R<?> $=w                $@ RELAY
1172 R<?> $* $=R                     $@ RELAY
1173
1174
1175
1176
1177
1178 ######################################################################
1179 ###  trust_auth: is user trusted to authenticate as someone else?
1180 ###
1181 ###     Parameters:
1182 ###             $1: AUTH= parameter from MAIL command
1183 ######################################################################
1184
1185 SLocal_trust_auth
1186 Strust_auth
1187 R$*                     $: $&{auth_type} $| $1
1188 # required by RFC 2554 section 4.
1189 R$@ $| $*               $#error $@ 5.7.1 $: "550 not authenticated"
1190 R$* $| $&{auth_authen}          $@ identical
1191 R$* $| <$&{auth_authen}>        $@ identical
1192 R$* $| $*               $: $1 $| $>"Local_trust_auth" $2
1193 R$* $| $#$*             $#$2
1194 R$*                     $#error $@ 5.7.1 $: "550 " $&{auth_authen} " not allowed to act as " $&{auth_author}
1195
1196 ######################################################################
1197 ###  Relay_Auth: allow relaying based on authentication?
1198 ###
1199 ###     Parameters:
1200 ###             $1: ${auth_type}
1201 ######################################################################
1202 SLocal_Relay_Auth
1203
1204 ######################################################################
1205 ###  srv_features: which features to offer to a client?
1206 ###     (done in server)
1207 ######################################################################
1208 Ssrv_features
1209
1210
1211 ######################################################################
1212 ###  try_tls: try to use STARTTLS?
1213 ###     (done in client)
1214 ######################################################################
1215 Stry_tls
1216
1217
1218 ######################################################################
1219 ###  tls_rcpt: is connection with server "good" enough?
1220 ###     (done in client, per recipient)
1221 ###
1222 ###     Parameters:
1223 ###             $1: recipient
1224 ######################################################################
1225 Stls_rcpt
1226
1227
1228 ######################################################################
1229 ###  tls_client: is connection with client "good" enough?
1230 ###     (done in server)
1231 ###
1232 ###     Parameters:
1233 ###             ${verify} $| (MAIL|STARTTLS)
1234 ######################################################################
1235 Stls_client
1236 R$* $| $*       $@ $>"TLS_connection" $1
1237
1238 ######################################################################
1239 ###  tls_server: is connection with server "good" enough?
1240 ###     (done in client)
1241 ###
1242 ###     Parameter:
1243 ###             ${verify}
1244 ######################################################################
1245 Stls_server
1246 R$*             $@ $>"TLS_connection" $1
1247
1248 ######################################################################
1249 ###  TLS_connection: is TLS connection "good" enough?
1250 ###
1251 ###     Parameters:
1252 ###             ${verify}
1253 ###             Requirement: RHS from access map, may be ? for none.
1254 ######################################################################
1255 STLS_connection
1256 RSOFTWARE       $#error $@ 4.7.0 $: "403 TLS handshake."
1257
1258
1259 ######################################################################
1260 ###  RelayTLS: allow relaying based on TLS authentication
1261 ###
1262 ###     Parameters:
1263 ###             none
1264 ######################################################################
1265 SRelayTLS
1266 # authenticated?
1267
1268 ######################################################################
1269 ###  authinfo: lookup authinfo in the access map
1270 ###
1271 ###     Parameters:
1272 ###             $1: {server_name}
1273 ###             $2: {server_addr}
1274 ######################################################################
1275 Sauthinfo
1276
1277
1278
1279
1280
1281 #\f
1282 ######################################################################
1283 ######################################################################
1284 #####
1285 #####                   MAIL FILTER DEFINITIONS
1286 #####
1287 ######################################################################
1288 ######################################################################
1289
1290 #\f
1291 ######################################################################
1292 ######################################################################
1293 #####
1294 #####                   MAILER DEFINITIONS
1295 #####
1296 ######################################################################
1297 ######################################################################
1298
1299
1300 ##################################################
1301 ###   Local and Program Mailer specification   ###
1302 ##################################################
1303
1304 #####  $Id: local.m4,v 8.59 2004/11/23 00:37:25 ca Exp $  #####
1305
1306 #
1307 #  Envelope sender rewriting
1308 #
1309 SEnvFromL
1310 R<@>                    $n                      errors to mailer-daemon
1311 R@ <@ $*>               $n                      temporarily bypass Sun bogosity
1312 R$+                     $: $>AddDomain $1       add local domain if needed
1313 R$*                     $: $>MasqEnv $1         do masquerading
1314
1315 #
1316 #  Envelope recipient rewriting
1317 #
1318 SEnvToL
1319 R$+ < @ $* >            $: $1                   strip host part
1320 R$+ + $*                $: < $&{addr_type} > $1 + $2    mark with addr type
1321 R<e s> $+ + $*          $: $1                   remove +detail for sender
1322 R< $* > $+              $: $2                   else remove mark
1323
1324 #
1325 #  Header sender rewriting
1326 #
1327 SHdrFromL
1328 R<@>                    $n                      errors to mailer-daemon
1329 R@ <@ $*>               $n                      temporarily bypass Sun bogosity
1330 R$+                     $: $>AddDomain $1       add local domain if needed
1331 R$*                     $: $>MasqHdr $1         do masquerading
1332
1333 #
1334 #  Header recipient rewriting
1335 #
1336 SHdrToL
1337 R$+                     $: $>AddDomain $1       add local domain if needed
1338 R$* < @ *LOCAL* > $*    $: $1 < @ $j . > $2
1339
1340 #
1341 #  Common code to add local domain name (only if always-add-domain)
1342 #
1343 SAddDomain
1344
1345 Mlocal,         P=/usr/bin/procmail, F=lsDFMAw5:/|@qSPfhn9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
1346                 T=DNS/RFC822/X-Unix,
1347                 A=procmail -Y -a $h -d $u
1348 Mprog,          P=/bin/sh, F=lsDFMoqeu9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, D=$z:/,
1349                 T=X-Unix/X-Unix/X-Unix,
1350                 A=sh -c $u
1351
1352 #####################################
1353 ###   SMTP Mailer specification   ###
1354 #####################################
1355
1356 #####  $Id: smtp.m4,v 8.65 2006/07/12 21:08:10 ca Exp $  #####
1357
1358 #
1359 #  common sender and masquerading recipient rewriting
1360 #
1361 SMasqSMTP
1362 R$* < @ $* > $*         $@ $1 < @ $2 > $3               already fully qualified
1363 R$+                     $@ $1 < @ *LOCAL* >             add local qualification
1364
1365 #
1366 #  convert pseudo-domain addresses to real domain addresses
1367 #
1368 SPseudoToReal
1369
1370 # pass <route-addr>s through
1371 R< @ $+ > $*            $@ < @ $1 > $2                  resolve <route-addr>
1372
1373 # output fake domains as user%fake@relay
1374
1375 # do UUCP heuristics; note that these are shared with UUCP mailers
1376 R$+ < @ $+ .UUCP. >     $: < $2 ! > $1                  convert to UUCP form
1377 R$+ < @ $* > $*         $@ $1 < @ $2 > $3               not UUCP form
1378
1379 # leave these in .UUCP form to avoid further tampering
1380 R< $&h ! > $- ! $+      $@ $2 < @ $1 .UUCP. >
1381 R< $&h ! > $-.$+ ! $+   $@ $3 < @ $1.$2 >
1382 R< $&h ! > $+           $@ $1 < @ $&h .UUCP. >
1383 R< $+ ! > $+            $: $1 ! $2 < @ $Y >             use UUCP_RELAY
1384 R$+ < @ $~[ $* : $+ >   $@ $1 < @ $4 >                  strip mailer: part
1385 R$+ < @ >               $: $1 < @ *LOCAL* >             if no UUCP_RELAY
1386
1387
1388 #
1389 #  envelope sender rewriting
1390 #
1391 SEnvFromSMTP
1392 R$+                     $: $>PseudoToReal $1            sender/recipient common
1393 R$* :; <@>              $@                              list:; special case
1394 R$*                     $: $>MasqSMTP $1                qualify unqual'ed names
1395 R$+                     $: $>MasqEnv $1                 do masquerading
1396
1397
1398 #
1399 #  envelope recipient rewriting --
1400 #  also header recipient if not masquerading recipients
1401 #
1402 SEnvToSMTP
1403 R$+                     $: $>PseudoToReal $1            sender/recipient common
1404 R$+                     $: $>MasqSMTP $1                qualify unqual'ed names
1405 R$* < @ *LOCAL* > $*    $: $1 < @ $j . > $2
1406
1407 #
1408 #  header sender and masquerading header recipient rewriting
1409 #
1410 SHdrFromSMTP
1411 R$+                     $: $>PseudoToReal $1            sender/recipient common
1412 R:; <@>                 $@                              list:; special case
1413
1414 # do special header rewriting
1415 R$* <@> $*              $@ $1 <@> $2                    pass null host through
1416 R< @ $* > $*            $@ < @ $1 > $2                  pass route-addr through
1417 R$*                     $: $>MasqSMTP $1                qualify unqual'ed names
1418 R$+                     $: $>MasqHdr $1                 do masquerading
1419
1420
1421 #
1422 #  relay mailer header masquerading recipient rewriting
1423 #
1424 SMasqRelay
1425 R$+                     $: $>MasqSMTP $1
1426 R$+                     $: $>MasqHdr $1
1427
1428 Msmtp,          P=[IPC], F=mDFMuX, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1429                 T=DNS/RFC822/SMTP,
1430                 A=TCP $h
1431 Mesmtp,         P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1432                 T=DNS/RFC822/SMTP,
1433                 A=TCP $h
1434 Msmtp8,         P=[IPC], F=mDFMuX8, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1435                 T=DNS/RFC822/SMTP,
1436                 A=TCP $h
1437 Mdsmtp,         P=[IPC], F=mDFMuXa%, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1438                 T=DNS/RFC822/SMTP,
1439                 A=TCP $h
1440 Mrelay,         P=[IPC], F=mDFMuXa8, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L=2040,
1441                 T=DNS/RFC822/SMTP,
1442                 A=TCP $h
1443
1444 ### generic-linux.mc ###
1445 # divert(-1)
1446 # #
1447 # # Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
1448 # #     All rights reserved.
1449 # # Copyright (c) 1983 Eric P. Allman.  All rights reserved.
1450 # # Copyright (c) 1988, 1993
1451 # #     The Regents of the University of California.  All rights reserved.
1452 # #
1453 # # By using this file, you agree to the terms and conditions set
1454 # # forth in the LICENSE file which can be found at the top level of
1455 # # the sendmail distribution.
1456 # #
1457 # #
1458
1459 # #
1460 # #  This is a generic configuration file for Linux.
1461 # #  It has support for local and SMTP mail only.  If you want to
1462 # #  customize it, copy it to a name appropriate for your environment
1463 # #  and do the modifications there.
1464 # #
1465
1466 # divert(0)dnl
1467 # VERSIONID(`$Id: generic-linux.mc,v 8.1 1999/09/24 22:48:05 gshapiro Exp $')
1468 # OSTYPE(linux)dnl
1469 # DOMAIN(generic)dnl
1470 # MAILER(local)dnl
1471 # MAILER(smtp)dnl