2 # Copyright (c) 1998-2002 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.2 2003/03/11 21:24:20 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.4 2002/12/29 03:54:34 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.17 2003/03/28 17:20:53 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< local : $* > $* $>CanonLocal < $1 > $2
839 R< $~[ : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
840 R< $~[ : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
841 R< $=w > $* $@ $2 delete local host
842 R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
844 ###################################################################
845 ### Ruleset CanonLocal -- canonify local: syntax ###
846 ###################################################################
849 # strip local host from routed addresses
850 R< $* > < @ $+ > : $+ $@ $>Recurse $3
851 R< $* > $+ $=O $+ < @ $+ > $@ $>Recurse $2 $3 $4
853 # strip trailing dot from any host name that may appear
854 R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
856 # handle local: syntax -- use old user, either with or without host
857 R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
858 R< > $+ $#local $@ $1 $: $1
860 # handle local:user@host syntax -- ignore host part
861 R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
863 # handle local:user syntax
864 R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
865 R< $+ > $* $#local $@ $2 $: $1
867 ###################################################################
868 ### Ruleset 93 -- convert header names to masqueraded form ###
869 ###################################################################
874 # do not masquerade anything in class N
875 R$* < @ $* $=N . > $@ $1 < @ $2 $3 . >
877 R$* < @ *LOCAL* > $@ $1 < @ $j . >
879 ###################################################################
880 ### Ruleset 94 -- convert envelope names to masqueraded form ###
881 ###################################################################
884 R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
886 ###################################################################
887 ### Ruleset 98 -- local part of ruleset zero (can be null) ###
888 ###################################################################
895 ######################################################################
896 ### CanonAddr -- Convert an address into a standard form for
897 ### relay checking. Route address syntax is
898 ### crudely converted into a %-hack address.
901 ### $1 -- full recipient address
904 ### parsed address, not in source route form
905 ######################################################################
908 R$* $: $>Parse0 $>canonify $1 make domain canonical
911 ######################################################################
912 ### ParseRecipient -- Strip off hosts in $=R as well as possibly
913 ### $* $=m or the access database.
914 ### Check user portion for host separators.
917 ### $1 -- full recipient address
920 ### parsed, non-local-relaying address
921 ######################################################################
924 R$* $: <?> $>CanonAddr $1
925 R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
926 R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
928 # if no $=O character, no host in the user portion, we are done
929 R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
933 R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
937 R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
941 ######################################################################
942 ### check_relay -- check hostname/address on SMTP startup
943 ######################################################################
947 R$* $: $1 $| $>"Local_check_relay" $1
948 R$* $| $* $| $#$* $#$3
949 R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
952 # check for deferred delivery mode
953 R$* $: < $&{deliveryMode} > $1
954 R< d > $* $@ deferred
960 ######################################################################
961 ### check_mail -- check SMTP `MAIL FROM:' command argument
962 ######################################################################
966 R$* $: $1 $| $>"Local_check_mail" $1
968 R$* $| $* $@ $>"Basic_check_mail" $1
971 # check for deferred delivery mode
972 R$* $: < $&{deliveryMode} > $1
973 R< d > $* $@ deferred
977 R$* $: $1 $| $>"tls_client" $&{verify} $| MAIL
981 R<> $@ <OK> we MUST accept <> (RFC 1123)
985 R$* $: $&{daemon_flags} $| $1
986 R$* f $* $| <@> < $* @ $- > $: < ? $&{client_name} > < $3 @ $4 >
987 R$* u $* $| <@> < $* > $: <?> < $3 >
989 # handle case of @localhost on address
990 R<@> < $* @ localhost > $: < ? $&{client_name} > < $1 @ localhost >
991 R<@> < $* @ [127.0.0.1] >
992 $: < ? $&{client_name} > < $1 @ [127.0.0.1] >
993 R<@> < $* @ localhost.$m >
994 $: < ? $&{client_name} > < $1 @ localhost.$m >
995 R<@> < $* @ localhost.UUCP >
996 $: < ? $&{client_name} > < $1 @ localhost.UUCP >
997 R<@> $* $: $1 no localhost as domain
998 R<? $=w> $* $: $2 local client: ok
999 R<? $+> <$+> $#error $@ 5.5.4 $: "553 Real domain name required for sender address"
1001 R$* $: <?> $>CanonAddr $1 canonify sender address and mark it
1002 R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
1003 # handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
1004 R<?> $* < @ $* $=P > $: <OKR> $1 < @ $2 $3 >
1005 R<?> $* < @ $j > $: <OKR> $1 < @ $j >
1006 R<?> $* < @ $+ > $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 >
1007 R<? $* <$->> $* < @ $+ >
1011 # handle case of no @domain on address
1012 R<?> $* $: $&{daemon_flags} $| <?> $1
1013 R$* u $* $| <?> $* $: <OKR> $3
1015 R<?> $* $: < ? $&{client_addr} > $1
1016 R<?> $* $@ <OKR> ...local unqualed ok
1017 R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required for sender address " $&f
1020 R<?> $* $: @ $1 mark address: nothing known about it
1021 R<$={ResOk}> $* $@ <OKR> domain ok: stop
1022 R<TEMP> $* $#error $@ 4.1.8 $: "451 Domain of sender address " $&f " does not resolve"
1023 R<PERM> $* $#error $@ 5.1.8 $: "553 Domain of sender address " $&f " does not exist"
1025 ######################################################################
1026 ### check_rcpt -- check SMTP `RCPT TO:' command argument
1027 ######################################################################
1031 R$* $: $1 $| $>"Local_check_rcpt" $1
1033 R$* $| $* $@ $>"Basic_check_rcpt" $1
1037 R<> $#error $@ nouser $: "553 User address required"
1038 R$@ $#error $@ nouser $: "553 User address required"
1039 # check for deferred delivery mode
1040 R$* $: < $&{deliveryMode} > $1
1041 R< d > $* $@ deferred
1045 ######################################################################
1046 R$* $: $1 $| @ $>"Rcpt_ok" $1
1047 R$* $| @ $#TEMP $+ $: $1 $| T $2
1049 R$* $| @ RELAY $@ RELAY
1050 R$* $| @ $* $: O $| $>"Relay_ok" $1
1051 R$* $| T $+ $: T $2 $| $>"Relay_ok" $1
1052 R$* $| $#TEMP $+ $#error $2
1054 R$* $| RELAY $@ RELAY
1055 R T $+ $| $* $#error $1
1056 # anything else is bogus
1057 R$* $#error $@ 5.7.1 $: "550 Relaying denied"
1060 ######################################################################
1061 ### Rcpt_ok: is the recipient ok?
1062 ######################################################################
1064 R$* $: $>ParseRecipient $1 strip relayable hosts
1069 # authenticated via TLS?
1070 R$* $: $1 $| $>RelayTLS client authenticated?
1071 R$* $| $# $+ $# $2 error/ok?
1074 R$* $: $1 $| $>"Local_Relay_Auth" $&{auth_type}
1077 R$* $| $* $: $1 $| $&{auth_type}
1079 R$* $| $={TrustAuthMech} $# RELAY
1081 # anything terminating locally is ok
1082 R$+ < @ $=w > $@ RELAY
1083 R$+ < @ $* $=R > $@ RELAY
1087 # check for local user (i.e. unqualified address)
1089 R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
1094 ######################################################################
1095 ### Relay_ok: is the relay/sender ok?
1096 ######################################################################
1098 # anything originating locally is ok
1100 R$* $: $&{client_addr}
1101 R$@ $@ RELAY originated locally
1102 R0 $@ RELAY originated locally
1103 R127.0.0.1 $@ RELAY originated locally
1104 RIPv6:::1 $@ RELAY originated locally
1105 R$=R $* $@ RELAY relayable IP address
1106 R$* $: [ $1 ] put brackets around it...
1107 R$=w $@ RELAY ... and see if it is local
1110 # check client name: first: did it resolve?
1111 R$* $: < $&{client_resolve} >
1112 R<TEMP> $#TEMP $@ 4.7.1 $: "450 Relaying temporarily denied. Cannot resolve PTR record for " $&{client_addr}
1113 R<FORGED> $#error $@ 5.7.1 $: "550 Relaying denied. IP name possibly forged " $&{client_name}
1114 R<FAIL> $#error $@ 5.7.1 $: "550 Relaying denied. IP name lookup failed " $&{client_name}
1115 R$* $: <@> $&{client_name}
1116 # pass to name server to make hostname canonical
1117 R<@> $* $=P $:<?> $1 $2
1118 R<@> $+ $:<?> $[ $1 $]
1119 R$* . $1 strip trailing dots
1121 R<?> $* $=R $@ RELAY
1126 ######################################################################
1127 ### trust_auth: is user trusted to authenticate as someone else?
1130 ### $1: AUTH= parameter from MAIL command
1131 ######################################################################
1135 R$* $: $&{auth_type} $| $1
1136 # required by RFC 2554 section 4.
1137 R$@ $| $* $#error $@ 5.7.1 $: "550 not authenticated"
1138 R$* $| $&{auth_authen} $@ identical
1139 R$* $| <$&{auth_authen}> $@ identical
1140 R$* $| $* $: $1 $| $>"Local_trust_auth" $1
1142 R$* $#error $@ 5.7.1 $: "550 " $&{auth_authen} " not allowed to act as " $&{auth_author}
1144 ######################################################################
1145 ### Relay_Auth: allow relaying based on authentication?
1148 ### $1: ${auth_type}
1149 ######################################################################
1154 ######################################################################
1155 ### tls_client: is connection with client "good" enough?
1156 ### (done in server)
1159 ### ${verify} $| (MAIL|STARTTLS)
1160 ######################################################################
1162 R$* $| $* $@ $>"TLS_connection" $1
1164 ######################################################################
1165 ### tls_server: is connection with server "good" enough?
1166 ### (done in client)
1170 ######################################################################
1172 R$* $@ $>"TLS_connection" $1
1174 ######################################################################
1175 ### TLS_connection: is TLS connection "good" enough?
1179 ### Requirement: RHS from access map, may be ? for none.
1180 ######################################################################
1182 RSOFTWARE $#error $@ 4.7.0 $: "403 TLS handshake."
1185 ######################################################################
1186 ### RelayTLS: allow relaying based on TLS authentication
1190 ######################################################################
1194 ######################################################################
1195 ### authinfo: lookup authinfo in the access map
1198 ### $1: {server_name}
1199 ### $2: {server_addr}
1200 ######################################################################
1207 R$+ $: $>ParseRecipient $1
1208 R$* < @ $+ > $* $#relay $@ ${MTAHost} $: $1 < @ $2 > $3
1210 R$+ :: $+ $#relay $@ ${MTAHost} $: $1 :: $2
1211 R$* $#relay $@ ${MTAHost} $: $1 < @ $j >
1213 ######################################################################
1214 ######################################################################
1216 ##### MAIL FILTER DEFINITIONS
1218 ######################################################################
1219 ######################################################################
1222 ######################################################################
1223 ######################################################################
1225 ##### MAILER DEFINITIONS
1227 ######################################################################
1228 ######################################################################
1231 ##################################################
1232 ### Local and Program Mailer specification ###
1233 ##################################################
1235 ##### $Id: local.m4,v 8.58 2000/10/26 01:58:29 ca Exp $ #####
1238 # Envelope sender rewriting
1241 R<@> $n errors to mailer-daemon
1242 R@ <@ $*> $n temporarily bypass Sun bogosity
1243 R$+ $: $>AddDomain $1 add local domain if needed
1244 R$* $: $>MasqEnv $1 do masquerading
1247 # Envelope recipient rewriting
1250 R$+ < @ $* > $: $1 strip host part
1251 R$+ + $* $: < $&{addr_type} > $1 + $2 mark with addr type
1252 R<e s> $+ + $* $: $1 remove +detail for sender
1253 R< $* > $+ $: $2 else remove mark
1256 # Header sender rewriting
1259 R<@> $n errors to mailer-daemon
1260 R@ <@ $*> $n temporarily bypass Sun bogosity
1261 R$+ $: $>AddDomain $1 add local domain if needed
1262 R$* $: $>MasqHdr $1 do masquerading
1265 # Header recipient rewriting
1268 R$+ $: $>AddDomain $1 add local domain if needed
1269 R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
1272 # Common code to add local domain name (only if always-add-domain)
1276 Mlocal, P=[IPC], F=lmDFMuXkw5, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
1279 Mprog, P=[IPC], F=lmDFMuXk5, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, D=$z:/,
1280 T=X-Unix/X-Unix/X-Unix,
1283 #####################################
1284 ### SMTP Mailer specification ###
1285 #####################################
1287 ##### $Id: smtp.m4,v 8.64 2001/04/03 01:52:54 gshapiro Exp $ #####
1290 # common sender and masquerading recipient rewriting
1293 R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
1294 R$+ $@ $1 < @ *LOCAL* > add local qualification
1297 # convert pseudo-domain addresses to real domain addresses
1301 # pass <route-addr>s through
1302 R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
1304 # output fake domains as user%fake@relay
1306 # do UUCP heuristics; note that these are shared with UUCP mailers
1307 R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
1308 R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
1310 # leave these in .UUCP form to avoid further tampering
1311 R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
1312 R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
1313 R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
1314 R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
1315 R$+ < @ $~[ $* : $+ > $@ $1 < @ $4 > strip mailer: part
1316 R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY
1320 # envelope sender rewriting
1323 R$+ $: $>PseudoToReal $1 sender/recipient common
1324 R$* :; <@> $@ list:; special case
1325 R$* $: $>MasqSMTP $1 qualify unqual'ed names
1326 R$+ $: $>MasqEnv $1 do masquerading
1330 # envelope recipient rewriting --
1331 # also header recipient if not masquerading recipients
1334 R$+ $: $>PseudoToReal $1 sender/recipient common
1335 R$+ $: $>MasqSMTP $1 qualify unqual'ed names
1336 R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
1339 # header sender and masquerading header recipient rewriting
1342 R$+ $: $>PseudoToReal $1 sender/recipient common
1343 R:; <@> $@ list:; special case
1345 # do special header rewriting
1346 R$* <@> $* $@ $1 <@> $2 pass null host through
1347 R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
1348 R$* $: $>MasqSMTP $1 qualify unqual'ed names
1349 R$+ $: $>MasqHdr $1 do masquerading
1353 # relay mailer header masquerading recipient rewriting
1356 R$+ $: $>MasqSMTP $1
1359 Msmtp, P=[IPC], F=mDFMuXk5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1362 Mesmtp, P=[IPC], F=mDFMuXak5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1365 Msmtp8, P=[IPC], F=mDFMuX8k5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1368 Mdsmtp, P=[IPC], F=mDFMuXa%k5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1371 Mrelay, P=[IPC], F=mDFMuXa8k, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L=2040,