📄 sendmail.cf
字号:
###################################################################### Ruleset 90 -- try domain part of mailertable entry ######################################################################SMailertable=90R$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4R$* <$~[ : $* > $* $>MailerToTriple < $2 : $3 > $4 check -- resolved?R$* < . $+ > $* $@ $>Mailertable $1 . <$2> $3 no -- strip & try againR$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "."R< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3 "." found?R< $* > $* $@ $2 no mailertable match###################################################################### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ######################################################################SMailerToTriple=95R< > $* $@ $1 strip off null relayR< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2R< local : $* > $* $>CanonLocal < $1 > $2R< $~[ : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal userR< $~[ : $+ > $* $# $1 $@ $2 $: $3 try qualified mailerR< $=w > $* $@ $2 delete local hostR< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer###################################################################### Ruleset CanonLocal -- canonify local: syntax ######################################################################SCanonLocal# strip local host from routed addressesR< $* > < @ $+ > : $+ $@ $>Recurse $3R< $* > $+ $=O $+ < @ $+ > $@ $>Recurse $2 $3 $4# strip trailing dot from any host name that may appearR< $* > $* < @ $* . > $: < $1 > $2 < @ $3 ># handle local: syntax -- use old user, either with or without hostR< > $* < @ $* > $* $#local $@ $1@$2 $: $1R< > $+ $#local $@ $1 $: $1# handle local:user@host syntax -- ignore host partR< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 ># handle local:user syntaxR< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1R< $+ > $* $#local $@ $2 $: $1###################################################################### Ruleset 93 -- convert header names to masqueraded form ######################################################################SMasqHdr=93# do not masquerade anything in class NR$* < @ $* $=N . > $@ $1 < @ $2 $3 . >R$* < @ *LOCAL* > $@ $1 < @ $j . >###################################################################### Ruleset 94 -- convert envelope names to masqueraded form ######################################################################SMasqEnv=94R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2###################################################################### Ruleset 98 -- local part of ruleset zero (can be null) ######################################################################SParseLocal=98# addresses sent to foo@host.REDIRECT will give a 551 error codeR$* < @ $+ .REDIRECT. > $: $1 < @ $2 . REDIRECT . > < ${opMode} >R$* < @ $+ .REDIRECT. > <i> $: $1 < @ $2 . REDIRECT. >R$* < @ $+ .REDIRECT. > < $- > $#error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>######################################################################### D: LookUpDomain -- search for domain in access database###### Parameters:### <$1> -- key (domain name)### <$2> -- default (what to return if not found in db)### <$3> -- mark (must be <(!|+) single-token>)### ! does lookup only with tag### + does lookup with and without tag### <$4> -- passthru (additional data passed unchanged through)######################################################################SDR<$*> <$+> <$- $-> <$*> $: < $(access $4:$1 $: ? $) > <$1> <$2> <$3 $4> <$5>R<?> <$+> <$+> <+ $-> <$*> $: < $(access $1 $: ? $) > <$1> <$2> <+ $3> <$4>R<?> <[$+.$-]> <$+> <$- $-> <$*> $@ $>D <[$1]> <$3> <$4 $5> <$6>R<?> <[$+::$-]> <$+> <$- $-> <$*> $: $>D <[$1]> <$3> <$4 $5> <$6>R<?> <[$+:$-]> <$+> <$- $-> <$*> $: $>D <[$1]> <$3> <$4 $5> <$6>R<?> <$+.$+> <$+> <$- $-> <$*> $@ $>D <$2> <$3> <$4 $5> <$6>R<?> <$+> <$+> <$- $-> <$*> $@ <$2> <$5>R<$* <TMPF>> <$+> <$+> <$- $-> <$*> $@ <<TMPF>> <$6>R<$*> <$+> <$+> <$- $-> <$*> $@ <$1> <$6>######################################################################### A: LookUpAddress -- search for host address in access database###### Parameters:### <$1> -- key (dot quadded host address)### <$2> -- default (what to return if not found in db)### <$3> -- mark (must be <(!|+) single-token>)### ! does lookup only with tag### + does lookup with and without tag### <$4> -- passthru (additional data passed through)######################################################################SAR<$+> <$+> <$- $-> <$*> $: < $(access $4:$1 $: ? $) > <$1> <$2> <$3 $4> <$5>R<?> <$+> <$+> <+ $-> <$*> $: < $(access $1 $: ? $) > <$1> <$2> <+ $3> <$4>R<?> <$+::$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6>R<?> <$+:$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6>R<?> <$+.$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6>R<?> <$+> <$+> <$- $-> <$*> $@ <$2> <$5>R<$* <TMPF>> <$+> <$+> <$- $-> <$*> $@ <<TMPF>> <$6>R<$*> <$+> <$+> <$- $-> <$*> $@ <$1> <$6>######################################################################### CanonAddr -- Convert an address into a standard form for### relay checking. Route address syntax is### crudely converted into a %-hack address.###### Parameters:### $1 -- full recipient address###### Returns:### parsed address, not in source route form######################################################################SCanonAddrR$* $: $>Parse0 $>canonify $1 make domain canonical######################################################################### ParseRecipient -- Strip off hosts in $=R as well as possibly### $* $=m or the access database.### Check user portion for host separators.###### Parameters:### $1 -- full recipient address###### Returns:### parsed, non-local-relaying address######################################################################SParseRecipientR$* $: <?> $>CanonAddr $1R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dotsR<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part# if no $=O character, no host in the user portion, we are doneR<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>R<?> $* $@ $1R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >R<NO> $* < @ $+ > $: $>D <$2> <NO> <+ To> <$1 < @ $2 >>R<$+> <$+> $: <$1> $2R<RELAY> $* < @ $* > $@ $>ParseRecipient $1R<$+> $* $@ $2######################################################################### check_relay -- check hostname/address on SMTP startup######################################################################SLocal_check_relayScheck_relayR$* $: $1 $| $>"Local_check_relay" $1R$* $| $* $| $#$* $#$3R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2SBasic_check_relay# check for deferred delivery modeR$* $: < $&{deliveryMode} > $1R< d > $* $@ deferredR< $* > $* $: $2R$+ $| $+ $: $>D < $1 > <?> <+ Connect> < $2 >R $| $+ $: $>A < $1 > <?> <+ Connect> <> empty client_nameR<?> <$+> $: $>A < $1 > <?> <+ Connect> <> no: another lookupR<?> <$*> $: OK found nothingR<$={Accept}> <$*> $@ $1 return value of lookupR<REJECT> <$*> $#error $@ 5.7.1 $: "550 Access denied"R<DISCARD> <$*> $#discard $: discardR<ERROR:$-.$-.$-:$+> <$*> $#error $@ $1.$2.$3 $: $4R<ERROR:$+> <$*> $#error $: $1R<$* <TMPF>> <$*> $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."R<$+> <$*> $#error $: $1######################################################################### check_mail -- check SMTP `MAIL FROM:' command argument######################################################################SLocal_check_mailScheck_mailR$* $: $1 $| $>"Local_check_mail" $1R$* $| $#$* $#$2R$* $| $* $@ $>"Basic_check_mail" $1SBasic_check_mail# check for deferred delivery modeR$* $: < $&{deliveryMode} > $1R< d > $* $@ deferredR< $* > $* $: $2# authenticated?R$* $: $1 $| $>"tls_client" $&{verify} $| MAILR$* $| $#$+ $#$2R$* $| $* $: $1R<> $@ <OK> we MUST accept <> (RFC 1123)R$+ $: <?> $1R<?><$+> $: <@> <$1>R<?>$+ $: <@> <$1>R$* $: $&{daemon_flags} $| $1R$* f $* $| <@> < $* @ $- > $: < ? $&{client_name} > < $3 @ $4 >R$* u $* $| <@> < $* > $: <?> < $3 >R$* $| $* $: $2# handle case of @localhost on addressR<@> < $* @ localhost > $: < ? $&{client_name} > < $1 @ localhost >R<@> < $* @ [127.0.0.1] > $: < ? $&{client_name} > < $1 @ [127.0.0.1] >R<@> < $* @ localhost.$m > $: < ? $&{client_name} > < $1 @ localhost.$m >R<@> < $* @ localhost.UUCP > $: < ? $&{client_name} > < $1 @ localhost.UUCP >R<@> $* $: $1 no localhost as domainR<? $=w> $* $: $2 local client: okR<? $+> <$+> $#error $@ 5.5.4 $: "553 Real domain name required for sender address"R<?> $* $: $1R$* $: <?> $>CanonAddr $1 canonify sender address and mark itR<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)R<?> $* < @ $* $=P > $: <OKR> $1 < @ $2 $3 >R<?> $* < @ $j > $: <OKR> $1 < @ $j >R<?> $* < @ $+ > $: <OKR> $1 < @ $2 > ... unresolvable OK# check sender address: user@address, user@, addressR<$+> $+ < @ $* > $: @<$1> <$2 < @ $3 >> $| <F:$2@$3> <U:$2@> <D:$3>R<$+> $+ $: @<$1> <$2> $| <U:$2@>R@ <$+> <$*> $| <$+> $: <@> <$1> <$2> $| $>SearchList <+ From> $| <$3> <>R<@> <$+> <$*> $| <$*> $: <$3> <$1> <$2> reverse result# retransform for further useR<?> <$+> <$*> $: <$1> $2 no matchR<$+> <$+> <$*> $: <$1> $3 relevant result, keep it# handle case of no @domain on addressR<?> $* $: $&{daemon_flags} $| <?> $1R$* u $* $| <?> $* $: <OKR> $3R$* $| $* $: $2R<?> $* $: < ? $&{client_addr} > $1R<?> $* $@ <OKR> ...local unqualed okR<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required for sender address " $&f ...remote is not# check resultsR<?> $* $: @ $1 mark address: nothing known about itR<$={ResOk}> $* $@ <OKR> domain ok: stopR<TEMP> $* $#error $@ 4.1.8 $: "451 Domain of sender address " $&f " does not resolve"R<PERM> $* $#error $@ 5.1.8 $: "553 Domain of sender address " $&f " does not exist"R<$={Accept}> $* $# $1 accept from access mapR<DISCARD> $* $#discard $: discardR<REJECT> $* $#error $@ 5.7.1 $: "550 Access denied"R<ERROR:$-.$-.$-:$+> $* $#error $@ $1.$2.$3 $: $4R<ERROR:$+> $* $#error $: $1R<<TMPF>> $* $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."R<$+> $* $#error $: $1 error from access db######################################################################### check_rcpt -- check SMTP `RCPT TO:' command argument######################################################################SLocal_check_rcptScheck_rcptR$* $: $1 $| $>"Local_check_rcpt" $1R$* $| $#$* $#$2R$* $| $* $@ $>"Basic_check_rcpt" $1SBasic_check_rcpt# empty address?R<> $#error $@ nouser $: "553 User address required"R$@ $#error $@ nouser $: "553 User address required"# check for deferred delivery modeR$* $: < $&{deliveryMode} > $1R< d > $* $@ deferredR< $* > $* $: $2######################################################################R$* $: $1 $| @ $>"Rcpt_ok" $1R$* $| @ $#TEMP $+ $: $1 $| T $2R$* $| @ $#$* $#$2R$* $| @ RELAY $@ RELAYR$* $| @ $* $: O $| $>"Relay_ok" $1R$* $| T $+ $: T $2 $| $>"Relay_ok" $1R$* $| $#TEMP $+ $#error $2R$* $| $#$* $#$2R$* $| RELAY $@ RELAYR T $+ $| $* $#error $1# anything else is bogusR$* $#error $@ 5.7.1 $: "550 Relaying denied"######################################################################### Rcpt_ok: is the recipient ok?######################################################################SRcpt_okR$* $: $>ParseRecipient $1 strip relayable hosts# blacklist local users or any host from receiving mailR$* $: <?> $1R<?> $+ < @ $=w > $: <> <$1 < @ $2 >> $| <F:$1@$2> <U:$1@> <D:$2>R<?> $+ < @ $* > $: <> <$1 < @ $2 >> $| <F:$1@$2> <D:$2>R<?> $+ $: <> <$1> $| <U:$1@>R<> <$*> $| <$+> $: <@> <$1> $| $>SearchList <+ To> $| <$2> <>R<@> <$*> $| <$*> $: <$2> <$1> reverse resultR<?> <$*> $: @ $1 mark address as no matchR<$={Accept}> <$*> $: @ $2 mark address as no matchR<REJECT> $* $#error $@ 5.2.1 $: "550 Mailbox disabled for this recipient"R<DISCARD> $* $#discard $: discardR<ERROR:$-.$-.$-:$+> $* $#error $@ $1.$2.$3 $: $4R<ERROR:$+> $* $#error $: $1R<<TMPF>> $* $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."R<$+> $* $#error $: $1 error from access dbR@ $* $1 remove mark# authenticated via TLS?R$* $: $1 $| $>RelayTLS client authenticated?R$* $| $# $+ $# $2 error/ok?R$* $| $* $: $1 noR$* $: $1 $| $>"Local_Relay_Auth" $&{auth_type}R$* $| $# $* $# $2R$* $| NO $: $1R$* $| $* $: $1 $| $&{auth_type}R$* $| $: $1R$* $| $={TrustAuthMech} $# RELAYR$* $| $* $: $1# anything terminating locally is okR$+ < @ $=w > $@ RELAYR$+ < @ $* $=R > $@ RELAYR$+ < @ $+ > $: $>D <$2> <?> <+ To> <$1 < @ $2 >>R<RELAY> $* $@ RELAYR<$* <TMPF>> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."R<$*> <$*> $: $2# check for local user (i.e. unqualified address)R$* $: <?> $1R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 ># local user is okR<?> $+ $@ RELAYR<$+> $* $: $2######################################################################### Relay_ok: is the relay/sender ok?######################################################################SRelay_ok# anything originating locally is ok# check IP addressR$* $: $&{client_addr}R$@ $@ RELAY originated locallyR0 $@ RELAY originated locallyR127.0.0.1 $@ RELAY originated locallyRIPv6:::1 $@ RELAY originated locallyR$=R $* $@ RELAY relayable IP addressR$* $: $>A <$1> <?> <+ Connect> <$1>R<RELAY> $* $@ RELAY relayable IP addressR<<TMPF>> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."R<$*> <$*> $: $2R$* $: [ $1 ] put brackets around it...R$=w $@ RELAY ... and see if it is local# check client name: first: did it resolve?R$* $: < $&{client_resolve} >R<TEMP> $#TEMP $@ 4.7.1 $: "450 Relaying temporarily denied. Cannot resolve PTR record for " $&{client_addr}R<FORGED> $#error $@ 5.7.1 $: "550 Relaying denied. IP name possibly forged " $&{client_name}R<FAIL> $#error $@ 5.7.1 $: "550 Relaying denied. IP name lookup failed " $&{client_name}R$* $: <@> $&{client_name}# pass to name server to make hostname canonicalR<@> $* $=P $:<?> $1 $2R<@> $+ $:<?> $[ $1 $]R$* . $1 strip trailing dotsR<?> $=w $@ RELAYR<?> $* $=R $@ RELAYR<?> $* $: $>D <$1> <?> <+ Connect> <$1>R<RELAY> $* $@ RELAYR<$* <TMPF>> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."R<$*> <$*> $: $2######################################################################### F: LookUpFull -- search for an entry in access database###### lookup of full key (which should be an address) and### variations if +detail exists: +* and without +detail###### Parameters:### <$1> -- key### <$2> -- default (what to return if not found in db)### <$3> -- mark (must be <(!|+) single-token>)### ! does lookup only with tag### + does lookup with and without tag### <$4> -- passthru (additional data passed unchanged through)######################################################################SFR<$+> <$*> <$- $-> <$*> $: <$(access $4:$1 $: ? $)> <$1> <$2> <$3 $4> <$5>R<?> <$+> <$*> <+ $-> <$*> $: <$(access $1 $: ? $)> <$1> <$2> <+ $3> <$4>R<?> <$+ + $* @ $+> <$*> <$- $-> <$*> $: <$(access $6:$1+*@$3 $: ? $)> <$1+$2@$3> <$4> <$5 $6> <$7>R<?> <$+ + $* @ $+> <$*> <+ $-> <$*> $: <$(access $1+*@$3 $: ? $)> <$1+$2@$3> <$4> <+ $5> <$6>R<?> <$+ + $* @ $+> <$*> <$- $-> <$*> $: <$(access $6:$1@$3 $: ? $)> <$1+$2@$3> <$4> <$5 $6> <$7>R<?> <$+ + $* @ $+> <$*> <+ $-> <$*> $: <$(access $1@$3 $: ? $)> <$1+$2@$3> <$4> <+ $5> <$6>R<?> <$+> <$*> <$- $-> <$*> $@ <$2> <$5>R<$+ <TMPF>> <$*> <$- $-> <$*> $@ <<TMPF>> <$5>R<$+> <$*> <$- $-> <$*> $@ <$1> <$5>######################################################################### E: LookUpExact -- search for an entry in access database###### Parameters:### <$1> -- key### <$2> -- default (what to return if not found in db)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -