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