📄 sendmail.cf
字号:
O OperatorChars=.:%@!^/[]+# shall I avoid calling initgroups(3) because of high NIS costs?#O DontInitGroups=False# are group-writable :include: and .forward files (un)trustworthy?# True (the default) means they are not trustworthy.#O UnsafeGroupWrites=True# where do errors that occur when sending errors get sent?#O DoubleBounceAddress=postmaster# where to save bounces if all else fails#O DeadLetterDrop=/var/tmp/dead.letter# what user id do we assume for the majority of the processing?#O RunAsUser=sendmail# maximum number of recipients per SMTP envelope#O MaxRecipientsPerMessage=100# limit the rate recipients per SMTP envelope are accepted# once the threshold number of recipients have been rejected#O BadRcptThrottle=20# shall we get local names from our installed interfaces?O DontProbeInterfaces=true# Return-Receipt-To: header implies DSN request#O RrtImpliesDsn=False# override connection address (for testing)#O ConnectOnlyTo=0.0.0.0# Trusted user for file ownership and starting the daemonO TrustedUser=smmsp# Control socket for daemon management#O ControlSocketName=/var/spool/mqueue/.control# Maximum MIME header length to protect MUAs#O MaxMimeHeaderLength=0/0# Maximum length of the sum of all headers#O MaxHeadersLength=32768# Maximum depth of alias recursion#O MaxAliasRecursion=10# location of pid file#O PidFile=/var/run/sendmail.pid# Prefix string for the process title shown on 'ps' listings#O ProcessTitlePrefix=prefix# Data file (df) memory-buffer file maximum size#O DataFileBufferSize=4096# Transcript file (xf) memory-buffer file maximum size#O XscriptFileBufferSize=4096# lookup type to find information about local mailboxes#O MailboxDatabase=pw# list of authentication mechanisms#O AuthMechanisms=EXTERNAL GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5# default authentication information for outgoing connections#O DefaultAuthInfo=/etc/mail/default-auth-info# SMTP AUTH flagsO AuthOptions=A# SMTP AUTH maximum encryption strength#O AuthMaxBits# SMTP STARTTLS server options#O TLSSrvOptions# Input mail filters#O InputMailFilters# CA directory#O CACertPath# CA file#O CACertFile# Server Cert#O ServerCertFile# Server private key#O ServerKeyFile# Client Cert#O ClientCertFile# Client private key#O ClientKeyFile# DHParameters (only required if DSA/DH is used)#O DHParameters# Random data source (required for systems without /dev/urandom under OpenSSL)#O RandFile############################# QUEUE GROUP DEFINITIONS ######################################################### Message precedences ############################Pfirst-class=0Pspecial-delivery=100Plist=-30Pbulk=-60Pjunk=-100###################### Trusted users ####################### this is equivalent to setting class "t"Ft/etc/mail/trusted-usersTrootTdaemonTuucp########################## Format of headers ##########################H?P?Return-Path: <$g>HReceived: $?sfrom $s $.$?_($?s$|from $.$_) $.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_ssf}$.) $.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version} (version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u for $u; $|; $.$bH?D?Resent-Date: $aH?D?Date: $aH?F?Resent-From: $?x$x <$g>$|$g$.H?F?From: $?x$x <$g>$|$g$.H?x?Full-Name: $x# HPosted-Date: $a# H?l?Received-Date: $bH?M?Resent-Message-Id: <$t.$i@$j>H?M?Message-Id: <$t.$i@$j>####################################################################################################################################################### REWRITING RULES################################################################################################################################################################################################ Ruleset 3 -- Name Canonicalization ###############################################Scanonify=3# handle null input (translate to <@> special case)R$@ $@ <@># strip group: syntax (not inside angle brackets!) and trailing semicolonR$* $: $1 <@> mark addressesR$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>R@ $* <@> $: @ $1 unmark @host:...R$* [ IPv6 : $+ ] <@> $: $1 [ IPv6 : $2 ] unmark IPv6 addrR$* :: $* <@> $: $1 :: $2 unmark node::addrR:include: $* <@> $: :include: $1 unmark :include:...R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colonR$* : $* <@> $: $2 strip colon if markedR$* <@> $: $1 unmarkR$* ; $1 strip trailing semiR$* < $+ :; > $* $@ $2 :; <@> catch <list:;>R$* < $* ; > $1 < $2 > bogus bracketed semi# null input now results from list:; syntaxR$@ $@ :; <@># strip angle brackets -- note RFC733 heuristic to get innermost itemR$* $: < $1 > housekeeping <>R$+ < $* > < $2 > strip excess on leftR< $* > $+ < $1 > strip excess on rightR<> $@ < @ > MAIL FROM:<> caseR< $+ > $: $1 remove housekeeping <># strip route address <@a,@b,@c:user@d> -> <user@d>R@ $+ , $+ $2R@ [ $* ] : $+ $2R@ $+ : $+ $2# find focus for list syntaxR $+ : $* ; @ $+ $@ $>Canonify2 $1 : $2 ; < @ $3 > list syntaxR $+ : $* ; $@ $1 : $2; list syntax# find focus for @ syntax addressesR$+ @ $+ $: $1 < @ $2 > focus on domainR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze rightR$+ < @ $+ > $@ $>Canonify2 $1 < @ $2 > already canonical# convert old-style addresses to a domain-based addressR$- ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > resolve uucp namesR$+ . $- ! $+ $@ $>Canonify2 $3 < @ $1 . $2 > domain uucpsR$+ ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > uucp subdomains# if we have % signs, take the rightmost oneR$* % $* $1 @ $2 First make them all @s.R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish# else we must be a local nameR$* $@ $>Canonify2 $1################################################### Ruleset 96 -- bottom half of ruleset 3 ###################################################SCanonify2=96# handle special cases for local namesR$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at allR$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domainR$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain# check for IPv4/IPv6 domain literalR$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [addr]R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literalR$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr# if really UUCP, handle it immediately# try UUCP traffic as a local addressR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3# hostnames ending in class P are always canonicalR$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4R$* < @ $* $~P > $* $: $&{daemon_flags} $| $1 < @ $2 $3 > $4R$* CC $* $| $* < @ $+.$+ > $* $: $3 < @ $4.$5 . > $6R$* CC $* $| $* $: $3# pass to name server to make hostname canonicalR$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4R$* $| $* $: $2# local host aliases and pseudo-domains are always canonicalR$* < @ $=w > $* $: $1 < @ $2 . > $3R$* < @ $=M > $* $: $1 < @ $2 . > $3R$* < @ $={VirtHost} > $* $: $1 < @ $2 . > $3R$* < @ $* . . > $* $1 < @ $2 . > $3##################################################### Ruleset 4 -- Final Output Post-rewriting #####################################################Sfinal=4R$+ :; <@> $@ $1 : handle <list:;>R$* <@> $@ handle <> and list:;# strip trailing dot off possibly canonical nameR$* < @ $+ . > $* $1 < @ $2 > $3# eliminate internal codeR$* < @ *LOCAL* > $* $1 < @ $j > $2# externalize local domain infoR$* < $+ > $* $1 $2 $3 defocusR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonicalR@ $* $@ @ $1 ... and exit# UUCP must always be presented in old formR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u# delete duplicate local namesR$+ % $=w @ $=w $1 @ $2 u%host@host => u@host################################################################# Ruleset 97 -- recanonicalize and call ruleset zero ###### (used for recursive calls) #################################################################SRecurse=97R$* $: $>canonify $1R$* $@ $>parse $1######################################### Ruleset 0 -- Parse Address #########################################Sparse=0R$* $: $>Parse0 $1 initial parsingR<@> $#local $: <@> special case error msgsR$* $: $>ParseLocal $1 handle local hacksR$* $: $>Parse1 $1 final parsing## Parse0 -- do initial syntax checking and eliminate local addresses.# This should either return with the (possibly modified) input# or return with a #error mailer. It should not return with a# #mailer other than the #error mailer.#SParse0R<@> $@ <@> special case error msgsR$* : $* ; <@> $#error $@ 5.1.3 $: "553 List:; syntax illegal for recipient addresses"R@ <@ $* > < @ $1 > catch "@@host" bogosityR<@ $+> $#error $@ 5.1.3 $: "553 User address required"R$+ <@> $#error $@ 5.1.3 $: "553 Hostname required"R$* $: <> $1R<> $* < @ [ $* ] : $+ > $* $1 < @ [ $2 ] : $3 > $4R<> $* < @ [ $* ] , $+ > $* $1 < @ [ $2 ] , $3 > $4R<> $* < @ [ $* ] $+ > $* $#error $@ 5.1.2 $: "553 Invalid address"R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "553 Colon illegal in host name part"R<> $* $1R$* < @ . $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"R$* < @ $* @ > $* $#error $@ 5.1.2 $: "553 Invalid route address"R$* @ $* < @ $* > $* $#error $@ 5.1.3 $: "553 Invalid route address"R$* , $~O $* $#error $@ 5.1.3 $: "553 Invalid route address"# now delete the local info -- note $=O to find characters that cause forwardingR$* < @ > $* $@ $>Parse0 $>canonify $1 user@ => userR< @ $=w . > : $* $@ $>Parse0 $>canonify $2 @here:... -> ...R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@hereR< @ $+ > $#error $@ 5.1.3 $: "553 User address required"R$* $=O $* < @ $=w . > $@ $>Parse0 $>canonify $1 $2 $3 ...@here -> ...R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"R< @ *LOCAL* > $#error $@ 5.1.3 $: "553 User address required"R$* $=O $* < @ *LOCAL* > $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ...R$* < @ *LOCAL* > $: $1## Parse1 -- the bottom half of ruleset 0.#SParse1# handle numeric address specR$* < @ [ $+ ] > $* $: $>ParseLocal $1 < @ [ $2 ] > $3 numeric internet specR$* < @ [ $+ ] > $* $1 < @ [ $2 ] : $S > $3 Add smart host to pathR$* < @ [ $+ ] : > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 no smarthost: sendR$* < @ [ $+ ] : $- : $*> $* $#$3 $@ $4 $: $1 < @ [$2] > $5 smarthost with mailerR$* < @ [ $+ ] : $+ > $* $#esmtp $@ $3 $: $1 < @ [$2] > $4 smarthost without mailer# handle virtual usersR$+ $: <!> $1 Mark for lookupR<!> $+ < @ $={VirtHost} . > $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >R<!> $+ < @ $=w . > $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >R<@> $+ + $+ < @ $* . > $: < $(virtuser $1 + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >R<@> $+ + $* < @ $* . > $: < $(virtuser $1 + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >R<@> $+ + $* < @ $* . > $: < $(virtuser $1 @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >R<@> $+ + $+ < @ $+ . > $: < $(virtuser + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >R<@> $+ + $* < @ $+ . > $: < $(virtuser + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >R<@> $+ + $* < @ $+ . > $: < $(virtuser @ $3 $@ $1 $@ $2 $@ +$2 $: ! $) > $1 + $2 < @ $3 . >R<@> $+ < @ $+ . > $: < $(virtuser @ $2 $@ $1 $: @ $) > $1 < @ $2 . >R<@> $+ $: $1R<!> $+ $: $1R< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2R< $+ > $+ < @ $+ > $: $>Recurse $1# short circuit local delivery so forwarded email worksR$=L < @ $=w . > $#local $: @ $1 special local namesR$+ < @ $=w . > $#local $: $1 regular local name# not local -- try mailer table lookupR$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host nameR< $+ . > $* $: < $1 > $2 strip trailing dotR< $+ > $* $: < $(mailertable $1 $) > $2 lookupR< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3 check -- resolved?R< $+ > $* $: $>Mailertable <$1> $2 try domain# resolve remotely connected UUCP links (if any)# resolve fake top level domains by forwarding to other hosts# pass names that still have a host to a smarthost (if defined)R$* < @ $* > $* $: $>MailerToTriple < $S > $1 < @ $2 > $3 glue on smarthost name# deal with other remote namesR$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain# handle locally delivered namesR$=L $#local $: @ $1 special local namesR$+ $#local $: $1 regular local names############################################################################## Ruleset 5 -- special rewriting after aliases have been expanded ##############################################################################SLocal_localaddrSlocaladdr=5R$+ $: $1 $| $>"Local_localaddr" $1R$+ $| $#ok $@ $1 no changeR$+ $| $#$* $#$2R$+ $| $* $: $1# deal with plussed users so aliases work nicelyR$+ + * $#local $@ $&h $: $1R$+ + $* $#local $@ + $2 $: $1 + *# prepend an empty "forward host" on the frontR$+ $: <> $1R< > $+ $: < > < $1 <> $&h > nope, restore +detailR< > < $+ <> + $* > $: < > < $1 + $2 > check whether +detailR< > < $+ <> $* > $: < > < $1 > else discardR< > < $+ + $* > $* < > < $1 > + $2 $3 find the user partR< > < $+ > + $* $#local $@ $2 $: @ $1 strip the extra +R< > < $+ > $@ $1 no +detailR$+ $: $1 <> $&h add +detail back inR$+ <> + $* $: $1 + $2 check whether +detailR$+ <> $* $: $1 else discardR< local : $* > $* $: $>MailerToTriple < local : $1 > $2 no host extensionR< error : $* > $* $: $>MailerToTriple < error : $1 > $2 no host extensionR< $~[ : $+ > $+ $: $>MailerToTriple < $1 : $2 > $3 < @ $2 >R< $+ > $+ $@ $>MailerToTriple < $1 > $2 < @ $1 >
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -