2 # Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
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.
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.
14 ######################################################################
15 ######################################################################
17 ##### SENDMAIL CONFIGURATION FILE
20 ######################################################################
22 ##### DO NOT EDIT THIS FILE! Only edit the source .mc file.
24 ######################################################################
25 ######################################################################
27 ##### $Id: cfhead.m4,v 8.108.2.3 2003/04/03 17:51:51 ca Exp $ #####
28 ##### $Id: cf.m4,v 8.32 1999/02/07 07:26:14 gshapiro Exp $ #####
29 ##### $Id: submit.mc,v 8.6.2.7 2003/09/10 22:11:56 ca Exp $ #####
30 ##### $Id: msp.m4,v 1.32 2002/03/26 22:02:03 ca Exp $ #####
32 ##### $Id: no_default_msa.m4,v 8.2 2001/02/14 05:03:22 gshapiro Exp $ #####
35 ##### $Id: proto.m4,v 8.649.2.24 2003/08/04 21:14:26 ca Exp $ #####
37 # level 10 config file format
40 # override file safeties - setting this option compromises system security,
41 # addressing the actual file configuration problem is preferred
42 # need to set this before any file actions are encountered in the cf file
43 #O DontBlameSendmail=safe
45 # default LDAP map specification
46 # need to set this now before any LDAP maps are defined
47 #O LDAPDefaultSpec=-h localhost
54 # need to set this before any LDAP lookups are done (including classes)
55 #D{sendmailMTACluster}$m
59 # my official domain name
60 # ... define this only if sendmail cannot automatically determine your domain
65 # "Smart" relay host (may be null)
69 # operators that cannot be in local usernames (i.e., network indicators)
72 # a class with just dot (for identifying canonical names)
75 # a class with just a left bracket (for identifying domain literals)
79 # Resolve map (to check if a host exists in check_mail)
80 Kresolve host -a<OKR> -T<TEMP>
84 # Hosts for which relaying is permitted ($=R)
85 FR-o /etc/mail/relay-domains
97 # class E: names that should be exposed as from this host, even if we masquerade
98 # class L: names that should be delivered locally, even if we have a relay
99 # class M: domains that should be converted to $M
100 # class N: domains that should not be converted to $M
105 # my name for error messages
109 D{MTAHost}[127.0.0.1]
112 # Configuration version number
120 # strip message body to 7 bits on input?
121 O SevenBitInput=False
123 # 8-bit data handling
124 #O EightBitMode=pass8
126 # wait for alias file rebuild (default units: minutes)
129 # location of alias file
130 #O AliasFile=/etc/mail/aliases
132 # minimum number of free blocks on filesystem
135 # maximum message size
136 #O MaxMessageSize=1000000
138 # substitution for space (blank) characters
141 # avoid connecting to "expensive" mailers on initial submission?
142 O HoldExpensive=False
144 # checkpoint queue runs after every N successful deliveries
145 #O CheckpointInterval=10
147 # default delivery mode
150 # error message header/file
151 #O ErrorHeader=/etc/mail/error-header
156 # save Unix-style "From_" lines at top of header?
157 #O SaveFromLine=False
159 # queue file mode (qf files)
162 # temporary file mode
165 # match recipients against GECOS field?
171 # location of help file
172 O HelpFile=/etc/mail/helpfile
174 # ignore dots as terminators in incoming messages?
177 # name resolver options
178 #O ResolverOptions=+AAONLY
180 # deliver MIME-encapsulated error messages?
181 O SendMimeErrors=True
183 # Forward file search path
186 # open connection cache size
187 O ConnectionCacheSize=2
189 # open connection cache timeout
190 O ConnectionCacheTimeout=5m
192 # persistent host status directory
193 #O HostStatusDirectory=.hoststat
195 # single thread deliveries (requires HostStatusDirectory)?
196 #O SingleThreadDelivery=False
198 # use Errors-To: header?
204 # send to me too, even in an alias expansion?
207 # verify RHS in newaliases?
210 # default messages to old style headers if no special punctuation?
211 O OldStyleHeaders=True
213 # SMTP daemon options
215 O DaemonPortOptions=Name=NoMTA, Addr=127.0.0.1, M=E
217 # SMTP client options
218 #O ClientPortOptions=Family=inet, Address=0.0.0.0
220 # Modifiers to define {daemon_flags} for direct submissions
221 #O DirectSubmissionModifiers
223 # Use as mail submission program? See sendmail/SECURITY
227 O PrivacyOptions=goaway,noetrn,restrictqrun
229 # who (if anyone) should get extra copies of error messages
230 #O PostmasterCopy=Postmaster
232 # slope of queue-only function
233 #O QueueFactor=600000
235 # limit on number of concurrent queue runners
238 # maximum number of queue-runners per queue-grouping with multiple queues
239 #O MaxRunnersPerQueue=1
241 # priority of queue runners (nice(3))
244 # shall we sort the queue by hostname first?
245 #O QueueSortOrder=priority
247 # minimum time in queue before retry
250 # how many jobs can you process in the queue?
251 #O MaxQueueRunSize=10000
253 # perform initial split of envelope without checking MX records
257 O QueueDirectory=/var/spool/clientmqueue
259 # key for shared memory; 0 to turn off
264 # timeouts (many of these)
265 #O Timeout.initial=5m
266 #O Timeout.connect=5m
267 #O Timeout.aconnect=0s
268 #O Timeout.iconnect=5m
272 #O Timeout.datainit=5m
273 #O Timeout.datablock=1h
274 #O Timeout.datafinal=1h
278 #O Timeout.command=1h
280 #O Timeout.fileopen=60s
281 #O Timeout.control=2m
282 O Timeout.queuereturn=5d
283 #O Timeout.queuereturn.normal=5d
284 #O Timeout.queuereturn.urgent=2d
285 #O Timeout.queuereturn.non-urgent=7d
287 O Timeout.queuewarn=4h
288 #O Timeout.queuewarn.normal=4h
289 #O Timeout.queuewarn.urgent=1h
290 #O Timeout.queuewarn.non-urgent=12h
292 #O Timeout.hoststatus=30m
293 #O Timeout.resolver.retrans=5s
294 #O Timeout.resolver.retrans.first=5s
295 #O Timeout.resolver.retrans.normal=5s
296 #O Timeout.resolver.retry=4
297 #O Timeout.resolver.retry.first=4
298 #O Timeout.resolver.retry.normal=4
301 #O Timeout.starttls=1h
303 # time for DeliverBy; extension disabled if less than 0
306 # should we not prune routes in route-addr syntax addresses?
307 #O DontPruneRoutes=False
309 # queue up everything before forking?
313 O StatusFile=/var/spool/clientmqueue/sm-client.st
315 # time zone handling:
316 # if undefined, use system default
317 # if defined but null, use TZ envariable passed in
318 # if defined and non-null, use that info
321 # default UID (can be username or userid:groupid)
322 #O DefaultUser=mailnull
324 # list of locations of user database file (null means no lookup)
325 #O UserDatabaseSpec=/etc/mail/userdb
328 #O FallbackMXhost=fall.back.host.net
330 # if we are the best MX host for a site, try it directly instead of config err
331 #O TryNullMXList=False
333 # load average at which we just queue messages
336 # load average at which we refuse connections
339 # load average at which we delay connections; 0 means no limit
342 # maximum number of children we allow at one time
343 #O MaxDaemonChildren=0
345 # maximum number of new connections per second
346 #O ConnectionRateThrottle=0
348 # work recipient factor
349 #O RecipientFactor=30000
351 # deliver each queued job in a separate process?
360 # default character set
361 #O DefaultCharSet=iso-8859-1
363 # service switch file (name hardwired on Solaris, Ultrix, OSF/1, others)
364 #O ServiceSwitchFile=/etc/mail/service.switch
366 # hosts file (normally /etc/hosts)
367 #O HostsFile=/etc/hosts
369 # dialup line delay on connection failure
372 # action to take if there are no recipients in the message
373 #O NoRecipientAction=add-to-undisclosed
375 # chrooted environment for writing to files
376 #O SafeFileEnvironment=/arch
378 # are colons OK in addresses?
379 #O ColonOkInAddr=True
381 # shall I avoid expanding CNAMEs (violates protocols)?
382 #O DontExpandCnames=False
384 # SMTP initial login message (old $e macro)
385 O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
387 # UNIX initial From header format (old $l macro)
388 O UnixFromLine=From $g $d
390 # From: lines that have embedded newlines are unwrapped onto one line
391 #O SingleLineFromHeader=False
393 # Allow HELO SMTP command that does not include a host name
394 #O AllowBogusHELO=False
396 # Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
399 # delimiter (operator) characters (old $o macro)
400 O OperatorChars=.:%@!^/[]+
402 # shall I avoid calling initgroups(3) because of high NIS costs?
403 O DontInitGroups=True
405 # are group-writable :include: and .forward files (un)trustworthy?
406 # True (the default) means they are not trustworthy.
407 #O UnsafeGroupWrites=True
410 # where do errors that occur when sending errors get sent?
411 #O DoubleBounceAddress=postmaster
413 # where to save bounces if all else fails
414 #O DeadLetterDrop=/var/tmp/dead.letter
416 # what user id do we assume for the majority of the processing?
419 # maximum number of recipients per SMTP envelope
420 #O MaxRecipientsPerMessage=100
422 # limit the rate recipients per SMTP envelope are accepted
423 # once the threshold number of recipients have been rejected
424 #O BadRcptThrottle=20
426 # shall we get local names from our installed interfaces?
427 O DontProbeInterfaces=True
429 # Return-Receipt-To: header implies DSN request
430 #O RrtImpliesDsn=False
432 # override connection address (for testing)
433 #O ConnectOnlyTo=0.0.0.0
435 # Trusted user for file ownership and starting the daemon
438 # Control socket for daemon management
439 #O ControlSocketName=/var/spool/mqueue/.control
441 # Maximum MIME header length to protect MUAs
442 #O MaxMimeHeaderLength=2048/1024
444 # Maximum length of the sum of all headers
445 #O MaxHeadersLength=32768
447 # Maximum depth of alias recursion
448 #O MaxAliasRecursion=10
450 # location of pid file
451 O PidFile=/var/spool/clientmqueue/sm-client.pid
453 # Prefix string for the process title shown on 'ps' listings
454 #O ProcessTitlePrefix=prefix
456 # Data file (df) memory-buffer file maximum size
457 #O DataFileBufferSize=4096
459 # Transcript file (xf) memory-buffer file maximum size
460 #O XscriptFileBufferSize=4096
462 # lookup type to find information about local mailboxes
463 #O MailboxDatabase=pw
465 # list of authentication mechanisms
466 #O AuthMechanisms=EXTERNAL GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5
468 # default authentication information for outgoing connections
469 #O DefaultAuthInfo=/etc/mail/default-auth-info
474 # SMTP AUTH maximum encryption strength
477 # SMTP STARTTLS server options
496 # DHParameters (only required if DSA/DH is used)
498 # Random data source (required for systems without /dev/urandom under OpenSSL)
501 ############################
502 # QUEUE GROUP DEFINITIONS #
503 ############################
506 ###########################
507 # Message precedences #
508 ###########################
511 Pspecial-delivery=100
516 #####################
518 #####################
520 # this is equivalent to setting class "t"
521 #Ft/etc/mail/trusted-users
526 #########################
527 # Format of headers #
528 #########################
530 H?P?Return-Path: <$g>
531 HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
532 $.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_ssf}$.)
533 $.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
534 (version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u
539 H?F?Resent-From: $?x$x <$g>$|$g$.
540 H?F?From: $?x$x <$g>$|$g$.
543 # H?l?Received-Date: $b
544 H?M?Resent-Message-Id: <$t.$i@$j>
545 H?M?Message-Id: <$t.$i@$j>
548 ######################################################################
549 ######################################################################
551 ##### REWRITING RULES
553 ######################################################################
554 ######################################################################
556 ############################################
557 ### Ruleset 3 -- Name Canonicalization ###
558 ############################################
561 # handle null input (translate to <@> special case)
564 # strip group: syntax (not inside angle brackets!) and trailing semicolon
565 R$* $: $1 <@> mark addresses
566 R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
567 R@ $* <@> $: @ $1 unmark @host:...
568 R$* [ IPv6 : $+ ] <@> $: $1 [ IPv6 : $2 ] unmark IPv6 addr
569 R$* :: $* <@> $: $1 :: $2 unmark node::addr
570 R:include: $* <@> $: :include: $1 unmark :include:...
571 R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
572 R$* : $* <@> $: $2 strip colon if marked
574 R$* ; $1 strip trailing semi
575 R$* < $+ :; > $* $@ $2 :; <@> catch <list:;>
576 R$* < $* ; > $1 < $2 > bogus bracketed semi
578 # null input now results from list:; syntax
581 # strip angle brackets -- note RFC733 heuristic to get innermost item
582 R$* $: < $1 > housekeeping <>
583 R$+ < $* > < $2 > strip excess on left
584 R< $* > $+ < $1 > strip excess on right
585 R<> $@ < @ > MAIL FROM:<> case
586 R< $+ > $: $1 remove housekeeping <>
588 # strip route address <@a,@b,@c:user@d> -> <user@d>
593 # find focus for list syntax
594 R $+ : $* ; @ $+ $@ $>Canonify2 $1 : $2 ; < @ $3 > list syntax
595 R $+ : $* ; $@ $1 : $2; list syntax
597 # find focus for @ syntax addresses
598 R$+ @ $+ $: $1 < @ $2 > focus on domain
599 R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
600 R$+ < @ $+ > $@ $>Canonify2 $1 < @ $2 > already canonical
603 # convert old-style addresses to a domain-based address
604 R$- ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > resolve uucp names
605 R$+ . $- ! $+ $@ $>Canonify2 $3 < @ $1 . $2 > domain uucps
606 R$+ ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > uucp subdomains
608 # convert node::user addresses into a domain-based address
609 R$- :: $+ $@ $>Canonify2 $2 < @ $1 .DECNET > resolve DECnet names
610 R$- . $- :: $+ $@ $>Canonify2 $3 < @ $1.$2 .DECNET > numeric DECnet addr
612 # if we have % signs, take the rightmost one
613 R$* % $* $1 @ $2 First make them all @s.
614 R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
615 R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish
617 # else we must be a local name
618 R$* $@ $>Canonify2 $1
621 ################################################
622 ### Ruleset 96 -- bottom half of ruleset 3 ###
623 ################################################
627 # handle special cases for local names
628 R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
629 R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
630 R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
632 # check for IPv4/IPv6 domain literal
633 R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [addr]
634 R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
635 R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
641 # if really UUCP, handle it immediately
643 # try UUCP traffic as a local address
644 R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
645 R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3
647 # hostnames ending in class P are always canonical
648 R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
649 R$* < @ $* $~P > $* $: $&{daemon_flags} $| $1 < @ $2 $3 > $4
650 R$* CC $* $| $* < @ $+.$+ > $* $: $3 < @ $4.$5 . > $6
651 R$* CC $* $| $* $: $3
652 # pass to name server to make hostname canonical
653 R$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4
656 # local host aliases and pseudo-domains are always canonical
657 R$* < @ $=w > $* $: $1 < @ $2 . > $3
658 R$* < @ $=M > $* $: $1 < @ $2 . > $3
659 R$* < @ $* . . > $* $1 < @ $2 . > $3
662 ##################################################
663 ### Ruleset 4 -- Final Output Post-rewriting ###
664 ##################################################
667 R$+ :; <@> $@ $1 : handle <list:;>
668 R$* <@> $@ handle <> and list:;
670 # strip trailing dot off possibly canonical name
671 R$* < @ $+ . > $* $1 < @ $2 > $3
673 # eliminate internal code
674 R$* < @ *LOCAL* > $* $1 < @ $j > $2
676 # externalize local domain info
677 R$* < $+ > $* $1 $2 $3 defocus
678 R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
679 R@ $* $@ @ $1 ... and exit
681 # UUCP must always be presented in old form
682 R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u
684 # put DECnet back in :: form
685 R$+ @ $+ . DECNET $2 :: $1 u@h.DECNET => h::u
686 # delete duplicate local names
687 R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
691 ##############################################################
692 ### Ruleset 97 -- recanonicalize and call ruleset zero ###
693 ### (used for recursive calls) ###
694 ##############################################################
701 ######################################
702 ### Ruleset 0 -- Parse Address ###
703 ######################################
707 R$* $: $>Parse0 $1 initial parsing
708 R<@> $#local $: <@> special case error msgs
709 R$* $: $>ParseLocal $1 handle local hacks
710 R$* $: $>Parse1 $1 final parsing
713 # Parse0 -- do initial syntax checking and eliminate local addresses.
714 # This should either return with the (possibly modified) input
715 # or return with a #error mailer. It should not return with a
716 # #mailer other than the #error mailer.
720 R<@> $@ <@> special case error msgs
721 R$* : $* ; <@> $#error $@ 5.1.3 $: "553 List:; syntax illegal for recipient addresses"
722 R@ <@ $* > < @ $1 > catch "@@host" bogosity
723 R<@ $+> $#error $@ 5.1.3 $: "553 User address required"
724 R$+ <@> $#error $@ 5.1.3 $: "553 Hostname required"
726 R<> $* < @ [ $* ] : $+ > $* $1 < @ [ $2 ] : $3 > $4
727 R<> $* < @ [ $* ] , $+ > $* $1 < @ [ $2 ] , $3 > $4
728 R<> $* < @ [ $* ] $+ > $* $#error $@ 5.1.2 $: "553 Invalid address"
729 R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
730 R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "553 Colon illegal in host name part"
732 R$* < @ . $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"
733 R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"
734 R$* < @ $* @ > $* $#error $@ 5.1.2 $: "553 Invalid route address"
735 R$* @ $* < @ $* > $* $#error $@ 5.1.3 $: "553 Invalid route address"
736 R$* , $~O $* $#error $@ 5.1.3 $: "553 Invalid route address"
739 # now delete the local info -- note $=O to find characters that cause forwarding
740 R$* < @ > $* $@ $>Parse0 $>canonify $1 user@ => user
741 R< @ $=w . > : $* $@ $>Parse0 $>canonify $2 @here:... -> ...
742 R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
743 R< @ $+ > $#error $@ 5.1.3 $: "553 User address required"
744 R$* $=O $* < @ $=w . > $@ $>Parse0 $>canonify $1 $2 $3 ...@here -> ...
745 R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
746 R< @ *LOCAL* > $#error $@ 5.1.3 $: "553 User address required"
747 R$* $=O $* < @ *LOCAL* >
748 $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ...
749 R$* < @ *LOCAL* > $: $1
752 # Parse1 -- the bottom half of ruleset 0.
757 # handle numeric address spec
758 R$* < @ [ $+ ] > $* $: $>ParseLocal $1 < @ [ $2 ] > $3 numeric internet spec
759 R$* < @ [ $+ ] > $* $: $1 < @ [ $2 ] : $S > $3 Add smart host to path
760 R$* < @ [ $+ ] : > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 no smarthost: send
761 R$* < @ [ $+ ] : $- : $*> $* $#$3 $@ $4 $: $1 < @ [$2] > $5 smarthost with mailer
762 R$* < @ [ $+ ] : $+ > $* $#esmtp $@ $3 $: $1 < @ [$2] > $4 smarthost without mailer
765 # short circuit local delivery so forwarded email works
768 R$=L < @ $=w . > $#local $: @ $1 special local names
769 R$+ < @ $=w . > $#local $: $1 regular local name
772 # resolve remotely connected UUCP links (if any)
774 # resolve fake top level domains by forwarding to other hosts
778 # pass names that still have a host to a smarthost (if defined)
779 R$* < @ $* > $* $: $>MailerToTriple < $S > $1 < @ $2 > $3 glue on smarthost name
781 # deal with other remote names
782 R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
784 # handle locally delivered names
785 R$=L $#local $: @ $1 special local names
786 R$+ $#local $: $1 regular local names
788 ###########################################################################
789 ### Ruleset 5 -- special rewriting after aliases have been expanded ###
790 ###########################################################################
794 R$+ $: $1 $| $>"Local_localaddr" $1
795 R$+ $| $#ok $@ $1 no change
802 # deal with plussed users so aliases work nicely
803 R$+ + * $#local $@ $&h $: $1
804 R$+ + $* $#local $@ + $2 $: $1 + *
806 # prepend an empty "forward host" on the front
811 R< > $+ $: < > < $1 <> $&h > nope, restore +detail
813 R< > < $+ <> + $* > $: < > < $1 + $2 > check whether +detail
814 R< > < $+ <> $* > $: < > < $1 > else discard
815 R< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part
816 R< > < $+ > + $* $#local $@ $2 $: @ $1 strip the extra +
817 R< > < $+ > $@ $1 no +detail
818 R$+ $: $1 <> $&h add +detail back in
820 R$+ <> + $* $: $1 + $2 check whether +detail
821 R$+ <> $* $: $1 else discard
822 R< local : $* > $* $: $>MailerToTriple < local : $1 > $2 no host extension
823 R< error : $* > $* $: $>MailerToTriple < error : $1 > $2 no host extension
825 R< $~[ : $+ > $+ $: $>MailerToTriple < $1 : $2 > $3 < @ $2 >
827 R< $+ > $+ $@ $>MailerToTriple < $1 > $2 < @ $1 >
830 ###################################################################
831 ### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
832 ###################################################################
835 R< > $* $@ $1 strip off null relay
836 R< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4
837 R< error : $- : $+ > $* $#error $@ $(dequote $1 $) $: $2
838 R< error : $+ > $* $#error $: $1
839 R< local : $* > $* $>CanonLocal < $1 > $2
840 R< $~[ : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
841 R< $~[ : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
842 R< $=w > $* $@ $2 delete local host
843 R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
845 ###################################################################
846 ### Ruleset CanonLocal -- canonify local: syntax ###
847 ###################################################################
850 # strip local host from routed addresses
851 R< $* > < @ $+ > : $+ $@ $>Recurse $3
852 R< $* > $+ $=O $+ < @ $+ > $@ $>Recurse $2 $3 $4
854 # strip trailing dot from any host name that may appear
855 R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
857 # handle local: syntax -- use old user, either with or without host
858 R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
859 R< > $+ $#local $@ $1 $: $1
861 # handle local:user@host syntax -- ignore host part
862 R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
864 # handle local:user syntax
865 R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
866 R< $+ > $* $#local $@ $2 $: $1
868 ###################################################################
869 ### Ruleset 93 -- convert header names to masqueraded form ###
870 ###################################################################
875 # do not masquerade anything in class N
876 R$* < @ $* $=N . > $@ $1 < @ $2 $3 . >
878 R$* < @ *LOCAL* > $@ $1 < @ $j . >
880 ###################################################################
881 ### Ruleset 94 -- convert envelope names to masqueraded form ###
882 ###################################################################
885 R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
887 ###################################################################
888 ### Ruleset 98 -- local part of ruleset zero (can be null) ###
889 ###################################################################
896 ######################################################################
897 ### CanonAddr -- Convert an address into a standard form for
898 ### relay checking. Route address syntax is
899 ### crudely converted into a %-hack address.
902 ### $1 -- full recipient address
905 ### parsed address, not in source route form
906 ######################################################################
909 R$* $: $>Parse0 $>canonify $1 make domain canonical
912 ######################################################################
913 ### ParseRecipient -- Strip off hosts in $=R as well as possibly
914 ### $* $=m or the access database.
915 ### Check user portion for host separators.
918 ### $1 -- full recipient address
921 ### parsed, non-local-relaying address
922 ######################################################################
925 R$* $: <?> $>CanonAddr $1
926 R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
927 R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
929 # if no $=O character, no host in the user portion, we are done
930 R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
934 R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
938 R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
942 ######################################################################
943 ### check_relay -- check hostname/address on SMTP startup
944 ######################################################################
948 R$* $: $1 $| $>"Local_check_relay" $1
949 R$* $| $* $| $#$* $#$3
950 R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
953 # check for deferred delivery mode
954 R$* $: < $&{deliveryMode} > $1
955 R< d > $* $@ deferred
961 ######################################################################
962 ### check_mail -- check SMTP `MAIL FROM:' command argument
963 ######################################################################
967 R$* $: $1 $| $>"Local_check_mail" $1
969 R$* $| $* $@ $>"Basic_check_mail" $1
972 # check for deferred delivery mode
973 R$* $: < $&{deliveryMode} > $1
974 R< d > $* $@ deferred
978 R$* $: $1 $| $>"tls_client" $&{verify} $| MAIL
982 R<> $@ <OK> we MUST accept <> (RFC 1123)
986 R$* $: $&{daemon_flags} $| $1
987 R$* f $* $| <@> < $* @ $- > $: < ? $&{client_name} > < $3 @ $4 >
988 R$* u $* $| <@> < $* > $: <?> < $3 >
990 # handle case of @localhost on address
991 R<@> < $* @ localhost > $: < ? $&{client_name} > < $1 @ localhost >
992 R<@> < $* @ [127.0.0.1] >
993 $: < ? $&{client_name} > < $1 @ [127.0.0.1] >
994 R<@> < $* @ localhost.$m >
995 $: < ? $&{client_name} > < $1 @ localhost.$m >
996 R<@> < $* @ localhost.UUCP >
997 $: < ? $&{client_name} > < $1 @ localhost.UUCP >
998 R<@> $* $: $1 no localhost as domain
999 R<? $=w> $* $: $2 local client: ok
1000 R<? $+> <$+> $#error $@ 5.5.4 $: "553 Real domain name required for sender address"
1002 R$* $: <?> $>CanonAddr $1 canonify sender address and mark it
1003 R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
1004 # handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
1005 R<?> $* < @ $* $=P > $: <OKR> $1 < @ $2 $3 >
1006 R<?> $* < @ $j > $: <OKR> $1 < @ $j >
1007 R<?> $* < @ $+ > $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 >
1008 R<? $* <$->> $* < @ $+ >
1012 # handle case of no @domain on address
1013 R<?> $* $: $&{daemon_flags} $| <?> $1
1014 R$* u $* $| <?> $* $: <OKR> $3
1016 R<?> $* $: < ? $&{client_addr} > $1
1017 R<?> $* $@ <OKR> ...local unqualed ok
1018 R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required for sender address " $&f
1021 R<?> $* $: @ $1 mark address: nothing known about it
1022 R<$={ResOk}> $* $@ <OKR> domain ok: stop
1023 R<TEMP> $* $#error $@ 4.1.8 $: "451 Domain of sender address " $&f " does not resolve"
1024 R<PERM> $* $#error $@ 5.1.8 $: "553 Domain of sender address " $&f " does not exist"
1026 ######################################################################
1027 ### check_rcpt -- check SMTP `RCPT TO:' command argument
1028 ######################################################################
1032 R$* $: $1 $| $>"Local_check_rcpt" $1
1034 R$* $| $* $@ $>"Basic_check_rcpt" $1
1038 R<> $#error $@ nouser $: "553 User address required"
1039 R$@ $#error $@ nouser $: "553 User address required"
1040 # check for deferred delivery mode
1041 R$* $: < $&{deliveryMode} > $1
1042 R< d > $* $@ deferred
1046 ######################################################################
1047 R$* $: $1 $| @ $>"Rcpt_ok" $1
1048 R$* $| @ $#TEMP $+ $: $1 $| T $2
1050 R$* $| @ RELAY $@ RELAY
1051 R$* $| @ $* $: O $| $>"Relay_ok" $1
1052 R$* $| T $+ $: T $2 $| $>"Relay_ok" $1
1053 R$* $| $#TEMP $+ $#error $2
1055 R$* $| RELAY $@ RELAY
1056 R T $+ $| $* $#error $1
1057 # anything else is bogus
1058 R$* $#error $@ 5.7.1 $: "550 Relaying denied"
1061 ######################################################################
1062 ### Rcpt_ok: is the recipient ok?
1063 ######################################################################
1065 R$* $: $>ParseRecipient $1 strip relayable hosts
1070 # authenticated via TLS?
1071 R$* $: $1 $| $>RelayTLS client authenticated?
1072 R$* $| $# $+ $# $2 error/ok?
1075 R$* $: $1 $| $>"Local_Relay_Auth" $&{auth_type}
1078 R$* $| $* $: $1 $| $&{auth_type}
1080 R$* $| $={TrustAuthMech} $# RELAY
1082 # anything terminating locally is ok
1083 R$+ < @ $=w > $@ RELAY
1084 R$+ < @ $* $=R > $@ RELAY
1088 # check for local user (i.e. unqualified address)
1090 R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
1095 ######################################################################
1096 ### Relay_ok: is the relay/sender ok?
1097 ######################################################################
1099 # anything originating locally is ok
1101 R$* $: $&{client_addr}
1102 R$@ $@ RELAY originated locally
1103 R0 $@ RELAY originated locally
1104 R127.0.0.1 $@ RELAY originated locally
1105 RIPv6:::1 $@ RELAY originated locally
1106 R$=R $* $@ RELAY relayable IP address
1107 R$* $: [ $1 ] put brackets around it...
1108 R$=w $@ RELAY ... and see if it is local
1111 # check client name: first: did it resolve?
1112 R$* $: < $&{client_resolve} >
1113 R<TEMP> $#TEMP $@ 4.7.1 $: "450 Relaying temporarily denied. Cannot resolve PTR record for " $&{client_addr}
1114 R<FORGED> $#error $@ 5.7.1 $: "550 Relaying denied. IP name possibly forged " $&{client_name}
1115 R<FAIL> $#error $@ 5.7.1 $: "550 Relaying denied. IP name lookup failed " $&{client_name}
1116 R$* $: <@> $&{client_name}
1117 # pass to name server to make hostname canonical
1118 R<@> $* $=P $:<?> $1 $2
1119 R<@> $+ $:<?> $[ $1 $]
1120 R$* . $1 strip trailing dots
1122 R<?> $* $=R $@ RELAY
1127 ######################################################################
1128 ### trust_auth: is user trusted to authenticate as someone else?
1131 ### $1: AUTH= parameter from MAIL command
1132 ######################################################################
1136 R$* $: $&{auth_type} $| $1
1137 # required by RFC 2554 section 4.
1138 R$@ $| $* $#error $@ 5.7.1 $: "550 not authenticated"
1139 R$* $| $&{auth_authen} $@ identical
1140 R$* $| <$&{auth_authen}> $@ identical
1141 R$* $| $* $: $1 $| $>"Local_trust_auth" $2
1143 R$* $#error $@ 5.7.1 $: "550 " $&{auth_authen} " not allowed to act as " $&{auth_author}
1145 ######################################################################
1146 ### Relay_Auth: allow relaying based on authentication?
1149 ### $1: ${auth_type}
1150 ######################################################################
1155 ######################################################################
1156 ### tls_client: is connection with client "good" enough?
1157 ### (done in server)
1160 ### ${verify} $| (MAIL|STARTTLS)
1161 ######################################################################
1163 R$* $| $* $@ $>"TLS_connection" $1
1165 ######################################################################
1166 ### tls_server: is connection with server "good" enough?
1167 ### (done in client)
1171 ######################################################################
1173 R$* $@ $>"TLS_connection" $1
1175 ######################################################################
1176 ### TLS_connection: is TLS connection "good" enough?
1180 ### Requirement: RHS from access map, may be ? for none.
1181 ######################################################################
1183 RSOFTWARE $#error $@ 4.7.0 $: "403 TLS handshake."
1186 ######################################################################
1187 ### RelayTLS: allow relaying based on TLS authentication
1191 ######################################################################
1195 ######################################################################
1196 ### authinfo: lookup authinfo in the access map
1199 ### $1: {server_name}
1200 ### $2: {server_addr}
1201 ######################################################################
1208 R$+ $: $>ParseRecipient $1
1209 R$* < @ $+ > $* $#relay $@ ${MTAHost} $: $1 < @ $2 > $3
1211 R$+ :: $+ $#relay $@ ${MTAHost} $: $1 :: $2
1212 R$* $#relay $@ ${MTAHost} $: $1 < @ $j >
1214 ######################################################################
1215 ######################################################################
1217 ##### MAIL FILTER DEFINITIONS
1219 ######################################################################
1220 ######################################################################
1223 ######################################################################
1224 ######################################################################
1226 ##### MAILER DEFINITIONS
1228 ######################################################################
1229 ######################################################################
1232 ##################################################
1233 ### Local and Program Mailer specification ###
1234 ##################################################
1236 ##### $Id: local.m4,v 8.58 2000/10/26 01:58:29 ca Exp $ #####
1239 # Envelope sender rewriting
1242 R<@> $n errors to mailer-daemon
1243 R@ <@ $*> $n temporarily bypass Sun bogosity
1244 R$+ $: $>AddDomain $1 add local domain if needed
1245 R$* $: $>MasqEnv $1 do masquerading
1248 # Envelope recipient rewriting
1251 R$+ < @ $* > $: $1 strip host part
1252 R$+ + $* $: < $&{addr_type} > $1 + $2 mark with addr type
1253 R<e s> $+ + $* $: $1 remove +detail for sender
1254 R< $* > $+ $: $2 else remove mark
1257 # Header sender rewriting
1260 R<@> $n errors to mailer-daemon
1261 R@ <@ $*> $n temporarily bypass Sun bogosity
1262 R$+ $: $>AddDomain $1 add local domain if needed
1263 R$* $: $>MasqHdr $1 do masquerading
1266 # Header recipient rewriting
1269 R$+ $: $>AddDomain $1 add local domain if needed
1270 R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
1273 # Common code to add local domain name (only if always-add-domain)
1277 Mlocal, P=[IPC], F=lmDFMuXkw5, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
1280 Mprog, P=[IPC], F=lmDFMuXk5, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, D=$z:/,
1281 T=X-Unix/X-Unix/X-Unix,
1284 #####################################
1285 ### SMTP Mailer specification ###
1286 #####################################
1288 ##### $Id: smtp.m4,v 8.64 2001/04/03 01:52:54 gshapiro Exp $ #####
1291 # common sender and masquerading recipient rewriting
1294 R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
1295 R$+ $@ $1 < @ *LOCAL* > add local qualification
1298 # convert pseudo-domain addresses to real domain addresses
1302 # pass <route-addr>s through
1303 R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
1305 # output fake domains as user%fake@relay
1307 # do UUCP heuristics; note that these are shared with UUCP mailers
1308 R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
1309 R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
1311 # leave these in .UUCP form to avoid further tampering
1312 R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
1313 R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
1314 R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
1315 R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
1316 R$+ < @ $~[ $* : $+ > $@ $1 < @ $4 > strip mailer: part
1317 R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY
1321 # envelope sender rewriting
1324 R$+ $: $>PseudoToReal $1 sender/recipient common
1325 R$* :; <@> $@ list:; special case
1326 R$* $: $>MasqSMTP $1 qualify unqual'ed names
1327 R$+ $: $>MasqEnv $1 do masquerading
1331 # envelope recipient rewriting --
1332 # also header recipient if not masquerading recipients
1335 R$+ $: $>PseudoToReal $1 sender/recipient common
1336 R$+ $: $>MasqSMTP $1 qualify unqual'ed names
1337 R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
1340 # header sender and masquerading header recipient rewriting
1343 R$+ $: $>PseudoToReal $1 sender/recipient common
1344 R:; <@> $@ list:; special case
1346 # do special header rewriting
1347 R$* <@> $* $@ $1 <@> $2 pass null host through
1348 R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
1349 R$* $: $>MasqSMTP $1 qualify unqual'ed names
1350 R$+ $: $>MasqHdr $1 do masquerading
1354 # relay mailer header masquerading recipient rewriting
1357 R$+ $: $>MasqSMTP $1
1360 Msmtp, P=[IPC], F=mDFMuXk5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1363 Mesmtp, P=[IPC], F=mDFMuXak5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1366 Msmtp8, P=[IPC], F=mDFMuX8k5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1369 Mdsmtp, P=[IPC], F=mDFMuXa%k5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1372 Mrelay, P=[IPC], F=mDFMuXa8k, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L=2040,