proto.m4 revision 112810
138032Speterdivert(-1) 238032Speter# 394334Sgshapiro# Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers. 464562Sgshapiro# All rights reserved. 538032Speter# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved. 638032Speter# Copyright (c) 1988, 1993 738032Speter# The Regents of the University of California. All rights reserved. 838032Speter# 938032Speter# By using this file, you agree to the terms and conditions set 1038032Speter# forth in the LICENSE file which can be found at the top level of 1138032Speter# the sendmail distribution. 1238032Speter# 1338032Speter# 1438032Speterdivert(0) 1538032Speter 16112810SgshapiroVERSIONID(`$Id: proto.m4,v 8.649.2.17 2003/03/28 17:20:53 ca Exp $') 1738032Speter 1864562Sgshapiro# level CF_LEVEL config file format 1964562SgshapiroV`'CF_LEVEL/ifdef(`VENDOR_NAME', `VENDOR_NAME', `Berkeley') 2038032Speterdivert(-1) 2138032Speter 2290792Sgshapirodnl if MAILER(`local') not defined: do it ourself; be nice 2390792Sgshapirodnl maybe we should issue a warning? 2490792Sgshapiroifdef(`_MAILER_local_',`', `MAILER(local)') 2590792Sgshapiro 2638032Speter# do some sanity checking 2738032Speterifdef(`__OSTYPE__',, 2864562Sgshapiro `errprint(`*** ERROR: No system type defined (use OSTYPE macro) 2964562Sgshapiro')') 3038032Speter 3138032Speter# pick our default mailers 3238032Speterifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `esmtp')') 3338032Speterifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')') 3438032Speterifdef(`confRELAY_MAILER',, 3538032Speter `define(`confRELAY_MAILER', 3638032Speter `ifdef(`_MAILER_smtp_', `relay', 3738032Speter `ifdef(`_MAILER_uucp', `uucp-new', `unknown')')')') 3838032Speterifdef(`confUUCP_MAILER',, `define(`confUUCP_MAILER', `uucp-old')') 3938032Speterdefine(`_SMTP_', `confSMTP_MAILER')dnl for readability only 4038032Speterdefine(`_LOCAL_', `confLOCAL_MAILER')dnl for readability only 4138032Speterdefine(`_RELAY_', `confRELAY_MAILER')dnl for readability only 4238032Speterdefine(`_UUCP_', `confUUCP_MAILER')dnl for readability only 4338032Speter 4438032Speter# back compatibility with old config files 4538032Speterifdef(`confDEF_GROUP_ID', 4664562Sgshapiro`errprint(`*** confDEF_GROUP_ID is obsolete. 4764562Sgshapiro Use confDEF_USER_ID with a colon in the value instead. 4864562Sgshapiro')') 4938032Speterifdef(`confREAD_TIMEOUT', 5064562Sgshapiro`errprint(`*** confREAD_TIMEOUT is obsolete. 5164562Sgshapiro Use individual confTO_<timeout> parameters instead. 5264562Sgshapiro')') 5338032Speterifdef(`confMESSAGE_TIMEOUT', 5438032Speter `define(`_ARG_', index(confMESSAGE_TIMEOUT, /)) 5538032Speter ifelse(_ARG_, -1, 5638032Speter `define(`confTO_QUEUERETURN', confMESSAGE_TIMEOUT)', 5738032Speter `define(`confTO_QUEUERETURN', 5838032Speter substr(confMESSAGE_TIMEOUT, 0, _ARG_)) 5938032Speter define(`confTO_QUEUEWARN', 6038032Speter substr(confMESSAGE_TIMEOUT, eval(_ARG_+1)))')') 6138032Speterifdef(`confMIN_FREE_BLOCKS', `ifelse(index(confMIN_FREE_BLOCKS, /), -1,, 6264562Sgshapiro`errprint(`*** compound confMIN_FREE_BLOCKS is obsolete. 6364562Sgshapiro Use confMAX_MESSAGE_SIZE for the second part of the value. 6464562Sgshapiro')')') 6538032Speter 6664562Sgshapiro 6764562Sgshapiro# Sanity check on ldap_routing feature 6864562Sgshapiro# If the user doesn't specify a new map, they better have given as a 6964562Sgshapiro# default LDAP specification which has the LDAP base (and most likely the host) 7064562Sgshapiroifdef(`confLDAP_DEFAULT_SPEC',, `ifdef(`_LDAP_ROUTING_WARN_', `errprint(` 7164562SgshapiroWARNING: Using default FEATURE(ldap_routing) map definition(s) 7264562Sgshapirowithout setting confLDAP_DEFAULT_SPEC option. 7364562Sgshapiro')')')dnl 7464562Sgshapiro 7538032Speter# clean option definitions below.... 7664562Sgshapirodefine(`_OPTION', `ifdef(`$2', `O $1`'ifelse(defn(`$2'), `',, `=$2')', `#O $1`'ifelse(`$3', `',,`=$3')')')dnl 7738032Speter 7864562Sgshapirodnl required to "rename" the check_* rulesets... 7964562Sgshapirodefine(`_U_',ifdef(`_DELAY_CHECKS_',`',`_')) 8064562Sgshapirodnl default relaying denied message 8190792Sgshapiroifdef(`confRELAY_MSG', `', `define(`confRELAY_MSG', 8290792Sgshapiroifdef(`_USE_AUTH_', `"550 Relaying denied. Proper authentication required."', `"550 Relaying denied"'))') 8390792Sgshapiroifdef(`confRCPTREJ_MSG', `', `define(`confRCPTREJ_MSG', `"550 Mailbox disabled for this recipient"')') 8490792Sgshapirodefine(`_CODE553', `553') 8538032Speterdivert(0)dnl 8638032Speter 8764562Sgshapiro# override file safeties - setting this option compromises system security, 8864562Sgshapiro# addressing the actual file configuration problem is preferred 8964562Sgshapiro# need to set this before any file actions are encountered in the cf file 9064562Sgshapiro_OPTION(DontBlameSendmail, `confDONT_BLAME_SENDMAIL', `safe') 9138032Speter 9264562Sgshapiro# default LDAP map specification 9364562Sgshapiro# need to set this now before any LDAP maps are defined 9464562Sgshapiro_OPTION(LDAPDefaultSpec, `confLDAP_DEFAULT_SPEC', `-h localhost') 9564562Sgshapiro 9638032Speter################## 9738032Speter# local info # 9838032Speter################## 9938032Speter 10090792Sgshapiro# my LDAP cluster 10190792Sgshapiro# need to set this before any LDAP lookups are done (including classes) 10290792Sgshapiroifdef(`confLDAP_CLUSTER', `D{sendmailMTACluster}`'confLDAP_CLUSTER', `#D{sendmailMTACluster}$m') 10390792Sgshapiro 10438032SpeterCwlocalhost 10538032Speterifdef(`USE_CW_FILE', 10638032Speter`# file containing names of hosts for which we receive email 10738032SpeterFw`'confCW_FILE', 10838032Speter `dnl') 10938032Speter 11038032Speter# my official domain name 11138032Speter# ... `define' this only if sendmail cannot automatically determine your domain 11238032Speterifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM') 11338032Speter 11438032SpeterCP. 11538032Speter 11638032Speterifdef(`UUCP_RELAY', 11738032Speter`# UUCP relay host 11838032SpeterDY`'UUCP_RELAY 11938032SpeterCPUUCP 12038032Speter 12138032Speter')dnl 12238032Speterifdef(`BITNET_RELAY', 12338032Speter`# BITNET relay host 12438032SpeterDB`'BITNET_RELAY 12538032SpeterCPBITNET 12638032Speter 12738032Speter')dnl 12838032Speterifdef(`DECNET_RELAY', 12938032Speter`define(`_USE_DECNET_SYNTAX_', 1)dnl 13038032Speter# DECnet relay host 13138032SpeterDC`'DECNET_RELAY 13238032SpeterCPDECNET 13338032Speter 13438032Speter')dnl 13538032Speterifdef(`FAX_RELAY', 13638032Speter`# FAX relay host 13738032SpeterDF`'FAX_RELAY 13838032SpeterCPFAX 13938032Speter 14038032Speter')dnl 14138032Speter# "Smart" relay host (may be null) 14290792SgshapiroDS`'ifdef(`SMART_HOST', `SMART_HOST') 14338032Speter 14438032Speterifdef(`LUSER_RELAY', `dnl 14538032Speter# place to which unknown users should be forwarded 14638032SpeterKuser user -m -a<> 14738032SpeterDL`'LUSER_RELAY', 14838032Speter`dnl') 14938032Speter 15038032Speter# operators that cannot be in local usernames (i.e., network indicators) 15138032SpeterCO @ % ifdef(`_NO_UUCP_', `', `!') 15238032Speter 15338032Speter# a class with just dot (for identifying canonical names) 15438032SpeterC.. 15538032Speter 15638032Speter# a class with just a left bracket (for identifying domain literals) 15738032SpeterC[[ 15838032Speter 15964562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 16064562Sgshapiro# access_db acceptance class 16164562SgshapiroC{Accept}OK RELAY 16290792Sgshapiroifdef(`_DELAY_COMPAT_8_10_',`dnl 16364562Sgshapiroifdef(`_BLACKLIST_RCPT_',`dnl 16464562Sgshapiro# possible access_db RHS for spam friends/haters 16564562SgshapiroC{SpamTag}SPAMFRIEND SPAMHATER')')', 16638032Speter`dnl') 16738032Speter 16890792Sgshapirodnl mark for "domain is ok" (resolved or accepted anyway) 16990792Sgshapirodefine(`_RES_OK_', `OKR')dnl 17038032Speterifdef(`_ACCEPT_UNRESOLVABLE_DOMAINS_',`dnl',`dnl 17138032Speter# Resolve map (to check if a host exists in check_mail) 17290792SgshapiroKresolve host -a<_RES_OK_> -T<TEMP>') 17390792SgshapiroC{ResOk}_RES_OK_ 17438032Speter 17580785Sgshapiroifdef(`_NEED_MACRO_MAP_', `dnl 17680785Sgshapiroifdef(`_MACRO_MAP_', `', `# macro storage map 17780785Sgshapirodefine(`_MACRO_MAP_', `1')dnl 17880785SgshapiroKmacro macro')', `dnl') 17966494Sgshapiro 18038032Speterifdef(`confCR_FILE', `dnl 18166494Sgshapiro# Hosts for which relaying is permitted ($=R) 18238032SpeterFR`'confCR_FILE', 18338032Speter`dnl') 18438032Speter 18590792Sgshapirodefine(`TLS_SRV_TAG', `"TLS_Srv"')dnl 18690792Sgshapirodefine(`TLS_CLT_TAG', `"TLS_Clt"')dnl 18790792Sgshapirodefine(`TLS_RCPT_TAG', `"TLS_Rcpt"')dnl 18890792Sgshapirodefine(`TLS_TRY_TAG', `"Try_TLS"')dnl 18990792Sgshapirodefine(`SRV_FEAT_TAG', `"Srv_Features"')dnl 19064562Sgshapirodnl this may be useful in other contexts too 19164562Sgshapiroifdef(`_ARITH_MAP_', `', `# arithmetic map 19264562Sgshapirodefine(`_ARITH_MAP_', `1')dnl 19364562SgshapiroKarith arith') 19464562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 19590792Sgshapiroifdef(`_MACRO_MAP_', `', `# macro storage map 19690792Sgshapirodefine(`_MACRO_MAP_', `1')dnl 19790792SgshapiroKmacro macro') 19890792Sgshapiro# possible values for TLS_connection in access map 19964562SgshapiroC{tls}VERIFY ENCR', `dnl') 20064562Sgshapiroifdef(`_CERT_REGEX_ISSUER_', `dnl 20164562Sgshapiro# extract relevant part from cert issuer 20264562SgshapiroKCERTIssuer regex _CERT_REGEX_ISSUER_', `dnl') 20364562Sgshapiroifdef(`_CERT_REGEX_SUBJECT_', `dnl 20464562Sgshapiro# extract relevant part from cert subject 20564562SgshapiroKCERTSubject regex _CERT_REGEX_SUBJECT_', `dnl') 20664562Sgshapiro 20790792Sgshapiroifdef(`LOCAL_RELAY', `dnl 208110647Sgshapiro# who I send unqualified names to if `FEATURE(stickyhost)' is used 209110560Sgshapiro# (null means deliver locally) 21090792SgshapiroDR`'LOCAL_RELAY') 21138032Speter 21290792Sgshapiroifdef(`MAIL_HUB', `dnl 213110560Sgshapiro# who gets all local email traffic 214110647Sgshapiro# ($R has precedence for unqualified names if `FEATURE(stickyhost)' is used) 21590792SgshapiroDH`'MAIL_HUB') 21638032Speter 21738032Speter# dequoting map 21890792SgshapiroKdequote dequote`'ifdef(`confDEQUOTE_OPTS', ` confDEQUOTE_OPTS', `') 21938032Speter 22038032Speterdivert(0)dnl # end of nullclient diversion 22138032Speter# class E: names that should be exposed as from this host, even if we masquerade 22264562Sgshapiro# class L: names that should be delivered locally, even if we have a relay 22338032Speter# class M: domains that should be converted to $M 22464562Sgshapiro# class N: domains that should not be converted to $M 22538032Speter#CL root 22638032Speterundivert(5)dnl 22764562Sgshapiroifdef(`_VIRTHOSTS_', `CR$={VirtHost}', `dnl') 22838032Speter 22990792Sgshapiroifdef(`MASQUERADE_NAME', `dnl 23038032Speter# who I masquerade as (null for no masquerading) (see also $=M) 23190792SgshapiroDM`'MASQUERADE_NAME') 23238032Speter 23338032Speter# my name for error messages 23438032Speterifdef(`confMAILER_NAME', `Dn`'confMAILER_NAME', `#DnMAILER-DAEMON') 23538032Speter 23664562Sgshapiroundivert(6)dnl LOCAL_CONFIG 23738032Speterinclude(_CF_DIR_`m4/version.m4') 23838032Speter 23938032Speter############### 24038032Speter# Options # 24138032Speter############### 24290792Sgshapiroifdef(`confAUTO_REBUILD', 24390792Sgshapiro`errprint(WARNING: `confAUTO_REBUILD' is no longer valid. 24490792Sgshapiro There was a potential for a denial of service attack if this is set. 24590792Sgshapiro)')dnl 24638032Speter 24738032Speter# strip message body to 7 bits on input? 24864562Sgshapiro_OPTION(SevenBitInput, `confSEVEN_BIT_INPUT', `False') 24938032Speter 25038032Speter# 8-bit data handling 25177349Sgshapiro_OPTION(EightBitMode, `confEIGHT_BIT_HANDLING', `pass8') 25238032Speter 25338032Speter# wait for alias file rebuild (default units: minutes) 25464562Sgshapiro_OPTION(AliasWait, `confALIAS_WAIT', `5m') 25538032Speter 25638032Speter# location of alias file 25764562Sgshapiro_OPTION(AliasFile, `ALIAS_FILE', `MAIL_SETTINGS_DIR`'aliases') 25864562Sgshapiro 25938032Speter# minimum number of free blocks on filesystem 26064562Sgshapiro_OPTION(MinFreeBlocks, `confMIN_FREE_BLOCKS', `100') 26138032Speter 26238032Speter# maximum message size 26364562Sgshapiro_OPTION(MaxMessageSize, `confMAX_MESSAGE_SIZE', `1000000') 26438032Speter 26538032Speter# substitution for space (blank) characters 26664562Sgshapiro_OPTION(BlankSub, `confBLANK_SUB', `_') 26738032Speter 26838032Speter# avoid connecting to "expensive" mailers on initial submission? 26964562Sgshapiro_OPTION(HoldExpensive, `confCON_EXPENSIVE', `False') 27038032Speter 27138032Speter# checkpoint queue runs after every N successful deliveries 27264562Sgshapiro_OPTION(CheckpointInterval, `confCHECKPOINT_INTERVAL', `10') 27338032Speter 27438032Speter# default delivery mode 27564562Sgshapiro_OPTION(DeliveryMode, `confDELIVERY_MODE', `background') 27638032Speter 27738032Speter# error message header/file 27864562Sgshapiro_OPTION(ErrorHeader, `confERROR_MESSAGE', `MAIL_SETTINGS_DIR`'error-header') 27938032Speter 28038032Speter# error mode 28164562Sgshapiro_OPTION(ErrorMode, `confERROR_MODE', `print') 28238032Speter 28338032Speter# save Unix-style "From_" lines at top of header? 28464562Sgshapiro_OPTION(SaveFromLine, `confSAVE_FROM_LINES', `False') 28538032Speter 28690792Sgshapiro# queue file mode (qf files) 28790792Sgshapiro_OPTION(QueueFileMode, `confQUEUE_FILE_MODE', `0600') 28890792Sgshapiro 28938032Speter# temporary file mode 29064562Sgshapiro_OPTION(TempFileMode, `confTEMP_FILE_MODE', `0600') 29138032Speter 29238032Speter# match recipients against GECOS field? 29364562Sgshapiro_OPTION(MatchGECOS, `confMATCH_GECOS', `False') 29438032Speter 29538032Speter# maximum hop count 29690792Sgshapiro_OPTION(MaxHopCount, `confMAX_HOP', `25') 29738032Speter 29838032Speter# location of help file 29964562SgshapiroO HelpFile=ifdef(`HELP_FILE', HELP_FILE, `MAIL_SETTINGS_DIR`'helpfile') 30038032Speter 30138032Speter# ignore dots as terminators in incoming messages? 30264562Sgshapiro_OPTION(IgnoreDots, `confIGNORE_DOTS', `False') 30338032Speter 30438032Speter# name resolver options 30564562Sgshapiro_OPTION(ResolverOptions, `confBIND_OPTS', `+AAONLY') 30638032Speter 30738032Speter# deliver MIME-encapsulated error messages? 30864562Sgshapiro_OPTION(SendMimeErrors, `confMIME_FORMAT_ERRORS', `True') 30938032Speter 31038032Speter# Forward file search path 31164562Sgshapiro_OPTION(ForwardPath, `confFORWARD_PATH', `/var/forward/$u:$z/.forward.$w:$z/.forward') 31238032Speter 31338032Speter# open connection cache size 31464562Sgshapiro_OPTION(ConnectionCacheSize, `confMCI_CACHE_SIZE', `2') 31538032Speter 31638032Speter# open connection cache timeout 31764562Sgshapiro_OPTION(ConnectionCacheTimeout, `confMCI_CACHE_TIMEOUT', `5m') 31838032Speter 31938032Speter# persistent host status directory 32064562Sgshapiro_OPTION(HostStatusDirectory, `confHOST_STATUS_DIRECTORY', `.hoststat') 32138032Speter 32238032Speter# single thread deliveries (requires HostStatusDirectory)? 32364562Sgshapiro_OPTION(SingleThreadDelivery, `confSINGLE_THREAD_DELIVERY', `False') 32438032Speter 32538032Speter# use Errors-To: header? 32664562Sgshapiro_OPTION(UseErrorsTo, `confUSE_ERRORS_TO', `False') 32738032Speter 32838032Speter# log level 32964562Sgshapiro_OPTION(LogLevel, `confLOG_LEVEL', `10') 33038032Speter 33138032Speter# send to me too, even in an alias expansion? 33264562Sgshapiro_OPTION(MeToo, `confME_TOO', `True') 33338032Speter 33438032Speter# verify RHS in newaliases? 33564562Sgshapiro_OPTION(CheckAliases, `confCHECK_ALIASES', `False') 33638032Speter 33738032Speter# default messages to old style headers if no special punctuation? 33864562Sgshapiro_OPTION(OldStyleHeaders, `confOLD_STYLE_HEADERS', `False') 33938032Speter 34038032Speter# SMTP daemon options 34164562Sgshapiroifelse(defn(`confDAEMON_OPTIONS'), `', `dnl', 34294334Sgshapiro`errprint(WARNING: `confDAEMON_OPTIONS' is no longer valid. 34394334Sgshapiro Use `DAEMON_OPTIONS()'; see cf/README. 34464562Sgshapiro)'dnl 34564562Sgshapiro`DAEMON_OPTIONS(`confDAEMON_OPTIONS')') 34666494Sgshapiroifelse(defn(`_DPO_'), `', 34790792Sgshapiro`ifdef(`_NETINET6_', `O DaemonPortOptions=Name=MTA-v4, Family=inet 34890792SgshapiroO DaemonPortOptions=Name=MTA-v6, Family=inet6',`O DaemonPortOptions=Name=MTA')', `_DPO_') 34964562Sgshapiroifdef(`_NO_MSA_', `dnl', `O DaemonPortOptions=Port=587, Name=MSA, M=E') 35038032Speter 35164562Sgshapiro# SMTP client options 35290792Sgshapiroifelse(defn(`confCLIENT_OPTIONS'), `', `dnl', 35390792Sgshapiro`errprint(WARNING: `confCLIENT_OPTIONS' is no longer valid. See cf/README for more information. 35490792Sgshapiro)'dnl 35590792Sgshapiro`CLIENT_OPTIONS(`confCLIENT_OPTIONS')') 35690792Sgshapiroifelse(defn(`_CPO_'), `', 35790792Sgshapiro`#O ClientPortOptions=Family=inet, Address=0.0.0.0', `_CPO_') 35864562Sgshapiro 35990792Sgshapiro# Modifiers to `define' {daemon_flags} for direct submissions 36090792Sgshapiro_OPTION(DirectSubmissionModifiers, `confDIRECT_SUBMISSION_MODIFIERS', `') 36190792Sgshapiro 36290792Sgshapiro# Use as mail submission program? See sendmail/SECURITY 36390792Sgshapiro_OPTION(UseMSP, `confUSE_MSP', `') 36490792Sgshapiro 36538032Speter# privacy flags 36664562Sgshapiro_OPTION(PrivacyOptions, `confPRIVACY_FLAGS', `authwarnings') 36738032Speter 36838032Speter# who (if anyone) should get extra copies of error messages 36964562Sgshapiro_OPTION(PostmasterCopy, `confCOPY_ERRORS_TO', `Postmaster') 37038032Speter 37138032Speter# slope of queue-only function 37264562Sgshapiro_OPTION(QueueFactor, `confQUEUE_FACTOR', `600000') 37338032Speter 37490792Sgshapiro# limit on number of concurrent queue runners 37590792Sgshapiro_OPTION(MaxQueueChildren, `confMAX_QUEUE_CHILDREN', `') 37690792Sgshapiro 37790792Sgshapiro# maximum number of queue-runners per queue-grouping with multiple queues 37890792Sgshapiro_OPTION(MaxRunnersPerQueue, `confMAX_RUNNERS_PER_QUEUE', `1') 37990792Sgshapiro 38090792Sgshapiro# priority of queue runners (nice(3)) 38190792Sgshapiro_OPTION(NiceQueueRun, `confNICE_QUEUE_RUN', `') 38290792Sgshapiro 38390792Sgshapiro# shall we sort the queue by hostname first? 38490792Sgshapiro_OPTION(QueueSortOrder, `confQUEUE_SORT_ORDER', `priority') 38590792Sgshapiro 38690792Sgshapiro# minimum time in queue before retry 38790792Sgshapiro_OPTION(MinQueueAge, `confMIN_QUEUE_AGE', `30m') 38890792Sgshapiro 38990792Sgshapiro# how many jobs can you process in the queue? 39090792Sgshapiro_OPTION(MaxQueueRunSize, `confMAX_QUEUE_RUN_SIZE', `10000') 39190792Sgshapiro 39290792Sgshapiro# perform initial split of envelope without checking MX records 39390792Sgshapiro_OPTION(FastSplit, `confFAST_SPLIT', `1') 39490792Sgshapiro 39538032Speter# queue directory 39664562SgshapiroO QueueDirectory=ifdef(`QUEUE_DIR', QUEUE_DIR, `/var/spool/mqueue') 39738032Speter 39890792Sgshapiro# key for shared memory; 0 to turn off 39990792Sgshapiro_OPTION(SharedMemoryKey, `confSHARED_MEMORY_KEY', `0') 40090792Sgshapiro 40194334Sgshapiroifdef(`confSHARED_MEMORY_KEY_FILE', `dnl 40294334Sgshapiro# file to store key for shared memory (if SharedMemoryKey = -1) 40394334SgshapiroO SharedMemoryKeyFile=confSHARED_MEMORY_KEY_FILE') 40494334Sgshapiro 40538032Speter# timeouts (many of these) 40664562Sgshapiro_OPTION(Timeout.initial, `confTO_INITIAL', `5m') 40764562Sgshapiro_OPTION(Timeout.connect, `confTO_CONNECT', `5m') 40890792Sgshapiro_OPTION(Timeout.aconnect, `confTO_ACONNECT', `0s') 40964562Sgshapiro_OPTION(Timeout.iconnect, `confTO_ICONNECT', `5m') 41064562Sgshapiro_OPTION(Timeout.helo, `confTO_HELO', `5m') 41164562Sgshapiro_OPTION(Timeout.mail, `confTO_MAIL', `10m') 41264562Sgshapiro_OPTION(Timeout.rcpt, `confTO_RCPT', `1h') 41364562Sgshapiro_OPTION(Timeout.datainit, `confTO_DATAINIT', `5m') 41464562Sgshapiro_OPTION(Timeout.datablock, `confTO_DATABLOCK', `1h') 41564562Sgshapiro_OPTION(Timeout.datafinal, `confTO_DATAFINAL', `1h') 41664562Sgshapiro_OPTION(Timeout.rset, `confTO_RSET', `5m') 41764562Sgshapiro_OPTION(Timeout.quit, `confTO_QUIT', `2m') 41864562Sgshapiro_OPTION(Timeout.misc, `confTO_MISC', `2m') 41964562Sgshapiro_OPTION(Timeout.command, `confTO_COMMAND', `1h') 42064562Sgshapiro_OPTION(Timeout.ident, `confTO_IDENT', `5s') 42164562Sgshapiro_OPTION(Timeout.fileopen, `confTO_FILEOPEN', `60s') 42264562Sgshapiro_OPTION(Timeout.control, `confTO_CONTROL', `2m') 42364562Sgshapiro_OPTION(Timeout.queuereturn, `confTO_QUEUERETURN', `5d') 42464562Sgshapiro_OPTION(Timeout.queuereturn.normal, `confTO_QUEUERETURN_NORMAL', `5d') 42564562Sgshapiro_OPTION(Timeout.queuereturn.urgent, `confTO_QUEUERETURN_URGENT', `2d') 42664562Sgshapiro_OPTION(Timeout.queuereturn.non-urgent, `confTO_QUEUERETURN_NONURGENT', `7d') 427112810Sgshapiroifdef(`confTO_QUEUERETURN_DSN', `dnl 428112810SgshapiroO Timeout.queuereturn.dsn=confTO_QUEUERETURN_DSN') 42964562Sgshapiro_OPTION(Timeout.queuewarn, `confTO_QUEUEWARN', `4h') 43064562Sgshapiro_OPTION(Timeout.queuewarn.normal, `confTO_QUEUEWARN_NORMAL', `4h') 43164562Sgshapiro_OPTION(Timeout.queuewarn.urgent, `confTO_QUEUEWARN_URGENT', `1h') 43264562Sgshapiro_OPTION(Timeout.queuewarn.non-urgent, `confTO_QUEUEWARN_NONURGENT', `12h') 433112810Sgshapiroifdef(`confTO_QUEUEWARN_DSN', `dnl 434112810SgshapiroO Timeout.queuewarn.dsn=confTO_QUEUEWARN_DSN') 43564562Sgshapiro_OPTION(Timeout.hoststatus, `confTO_HOSTSTATUS', `30m') 43664562Sgshapiro_OPTION(Timeout.resolver.retrans, `confTO_RESOLVER_RETRANS', `5s') 43764562Sgshapiro_OPTION(Timeout.resolver.retrans.first, `confTO_RESOLVER_RETRANS_FIRST', `5s') 43864562Sgshapiro_OPTION(Timeout.resolver.retrans.normal, `confTO_RESOLVER_RETRANS_NORMAL', `5s') 43964562Sgshapiro_OPTION(Timeout.resolver.retry, `confTO_RESOLVER_RETRY', `4') 44064562Sgshapiro_OPTION(Timeout.resolver.retry.first, `confTO_RESOLVER_RETRY_FIRST', `4') 44164562Sgshapiro_OPTION(Timeout.resolver.retry.normal, `confTO_RESOLVER_RETRY_NORMAL', `4') 44290792Sgshapiro_OPTION(Timeout.lhlo, `confTO_LHLO', `2m') 44390792Sgshapiro_OPTION(Timeout.auth, `confTO_AUTH', `10m') 44490792Sgshapiro_OPTION(Timeout.starttls, `confTO_STARTTLS', `1h') 44538032Speter 44690792Sgshapiro# time for DeliverBy; extension disabled if less than 0 44790792Sgshapiro_OPTION(DeliverByMin, `confDELIVER_BY_MIN', `0') 44890792Sgshapiro 44938032Speter# should we not prune routes in route-addr syntax addresses? 45064562Sgshapiro_OPTION(DontPruneRoutes, `confDONT_PRUNE_ROUTES', `False') 45138032Speter 45238032Speter# queue up everything before forking? 45364562Sgshapiro_OPTION(SuperSafe, `confSAFE_QUEUE', `True') 45438032Speter 45538032Speter# status file 45664562SgshapiroO StatusFile=ifdef(`STATUS_FILE', `STATUS_FILE', `MAIL_SETTINGS_DIR`'statistics') 45738032Speter 45838032Speter# time zone handling: 45938032Speter# if undefined, use system default 46038032Speter# if defined but null, use TZ envariable passed in 46138032Speter# if defined and non-null, use that info 46238032Speterifelse(confTIME_ZONE, `USE_SYSTEM', `#O TimeZoneSpec=', 46338032Speter confTIME_ZONE, `USE_TZ', `O TimeZoneSpec=', 46438032Speter `O TimeZoneSpec=confTIME_ZONE') 46538032Speter 46638032Speter# default UID (can be username or userid:groupid) 46764562Sgshapiro_OPTION(DefaultUser, `confDEF_USER_ID', `mailnull') 46838032Speter 46938032Speter# list of locations of user database file (null means no lookup) 47064562Sgshapiro_OPTION(UserDatabaseSpec, `confUSERDB_SPEC', `MAIL_SETTINGS_DIR`'userdb') 47138032Speter 47238032Speter# fallback MX host 47364562Sgshapiro_OPTION(FallbackMXhost, `confFALLBACK_MX', `fall.back.host.net') 47438032Speter 47538032Speter# if we are the best MX host for a site, try it directly instead of config err 47664562Sgshapiro_OPTION(TryNullMXList, `confTRY_NULL_MX_LIST', `False') 47738032Speter 47838032Speter# load average at which we just queue messages 47964562Sgshapiro_OPTION(QueueLA, `confQUEUE_LA', `8') 48038032Speter 48138032Speter# load average at which we refuse connections 48264562Sgshapiro_OPTION(RefuseLA, `confREFUSE_LA', `12') 48338032Speter 48490792Sgshapiro# load average at which we delay connections; 0 means no limit 48590792Sgshapiro_OPTION(DelayLA, `confDELAY_LA', `0') 48690792Sgshapiro 48738032Speter# maximum number of children we allow at one time 48898841Sgshapiro_OPTION(MaxDaemonChildren, `confMAX_DAEMON_CHILDREN', `0') 48938032Speter 49038032Speter# maximum number of new connections per second 49171345Sgshapiro_OPTION(ConnectionRateThrottle, `confCONNECTION_RATE_THROTTLE', `0') 49238032Speter 49338032Speter# work recipient factor 49464562Sgshapiro_OPTION(RecipientFactor, `confWORK_RECIPIENT_FACTOR', `30000') 49538032Speter 49638032Speter# deliver each queued job in a separate process? 49764562Sgshapiro_OPTION(ForkEachJob, `confSEPARATE_PROC', `False') 49838032Speter 49938032Speter# work class factor 50064562Sgshapiro_OPTION(ClassFactor, `confWORK_CLASS_FACTOR', `1800') 50138032Speter 50238032Speter# work time factor 50364562Sgshapiro_OPTION(RetryFactor, `confWORK_TIME_FACTOR', `90000') 50438032Speter 50538032Speter# default character set 50664562Sgshapiro_OPTION(DefaultCharSet, `confDEF_CHAR_SET', `iso-8859-1') 50738032Speter 50890792Sgshapiro# service switch file (name hardwired on Solaris, Ultrix, OSF/1, others) 50964562Sgshapiro_OPTION(ServiceSwitchFile, `confSERVICE_SWITCH_FILE', `MAIL_SETTINGS_DIR`'service.switch') 51038032Speter 51138032Speter# hosts file (normally /etc/hosts) 51264562Sgshapiro_OPTION(HostsFile, `confHOSTS_FILE', `/etc/hosts') 51338032Speter 51438032Speter# dialup line delay on connection failure 51564562Sgshapiro_OPTION(DialDelay, `confDIAL_DELAY', `10s') 51638032Speter 51738032Speter# action to take if there are no recipients in the message 51864562Sgshapiro_OPTION(NoRecipientAction, `confNO_RCPT_ACTION', `add-to-undisclosed') 51938032Speter 52038032Speter# chrooted environment for writing to files 52164562Sgshapiro_OPTION(SafeFileEnvironment, `confSAFE_FILE_ENV', `/arch') 52238032Speter 52338032Speter# are colons OK in addresses? 52464562Sgshapiro_OPTION(ColonOkInAddr, `confCOLON_OK_IN_ADDR', `True') 52538032Speter 52638032Speter# shall I avoid expanding CNAMEs (violates protocols)? 52764562Sgshapiro_OPTION(DontExpandCnames, `confDONT_EXPAND_CNAMES', `False') 52838032Speter 52938032Speter# SMTP initial login message (old $e macro) 53064562Sgshapiro_OPTION(SmtpGreetingMessage, `confSMTP_LOGIN_MSG', `$j Sendmail $v ready at $b') 53138032Speter 53238032Speter# UNIX initial From header format (old $l macro) 53364562Sgshapiro_OPTION(UnixFromLine, `confFROM_LINE', `From $g $d') 53438032Speter 53538032Speter# From: lines that have embedded newlines are unwrapped onto one line 53664562Sgshapiro_OPTION(SingleLineFromHeader, `confSINGLE_LINE_FROM_HEADER', `False') 53738032Speter 53838032Speter# Allow HELO SMTP command that does not `include' a host name 53964562Sgshapiro_OPTION(AllowBogusHELO, `confALLOW_BOGUS_HELO', `False') 54038032Speter 54138032Speter# Characters to be quoted in a full name phrase (@,;:\()[] are automatic) 54264562Sgshapiro_OPTION(MustQuoteChars, `confMUST_QUOTE_CHARS', `.') 54338032Speter 54438032Speter# delimiter (operator) characters (old $o macro) 54564562Sgshapiro_OPTION(OperatorChars, `confOPERATORS', `.:@[]') 54638032Speter 54738032Speter# shall I avoid calling initgroups(3) because of high NIS costs? 54864562Sgshapiro_OPTION(DontInitGroups, `confDONT_INIT_GROUPS', `False') 54938032Speter 55038032Speter# are group-writable `:include:' and .forward files (un)trustworthy? 55190792Sgshapiro# True (the default) means they are not trustworthy. 55264562Sgshapiro_OPTION(UnsafeGroupWrites, `confUNSAFE_GROUP_WRITES', `True') 55390792Sgshapiroifdef(`confUNSAFE_GROUP_WRITES', 55490792Sgshapiro`errprint(`WARNING: confUNSAFE_GROUP_WRITES is deprecated; use confDONT_BLAME_SENDMAIL. 55590792Sgshapiro')') 55638032Speter 55738032Speter# where do errors that occur when sending errors get sent? 55864562Sgshapiro_OPTION(DoubleBounceAddress, `confDOUBLE_BOUNCE_ADDRESS', `postmaster') 55938032Speter 56064562Sgshapiro# where to save bounces if all else fails 56164562Sgshapiro_OPTION(DeadLetterDrop, `confDEAD_LETTER_DROP', `/var/tmp/dead.letter') 56264562Sgshapiro 56338032Speter# what user id do we assume for the majority of the processing? 56464562Sgshapiro_OPTION(RunAsUser, `confRUN_AS_USER', `sendmail') 56538032Speter 56638032Speter# maximum number of recipients per SMTP envelope 56764562Sgshapiro_OPTION(MaxRecipientsPerMessage, `confMAX_RCPTS_PER_MESSAGE', `100') 56838032Speter 56990792Sgshapiro# limit the rate recipients per SMTP envelope are accepted 57090792Sgshapiro# once the threshold number of recipients have been rejected 57190792Sgshapiro_OPTION(BadRcptThrottle, `confBAD_RCPT_THROTTLE', `20') 57290792Sgshapiro 57338032Speter# shall we get local names from our installed interfaces? 57464562Sgshapiro_OPTION(DontProbeInterfaces, `confDONT_PROBE_INTERFACES', `False') 57538032Speter 57664562Sgshapiro# Return-Receipt-To: header implies DSN request 57764562Sgshapiro_OPTION(RrtImpliesDsn, `confRRT_IMPLIES_DSN', `False') 57864562Sgshapiro 57964562Sgshapiro# override connection address (for testing) 58064562Sgshapiro_OPTION(ConnectOnlyTo, `confCONNECT_ONLY_TO', `0.0.0.0') 58164562Sgshapiro 58264562Sgshapiro# Trusted user for file ownership and starting the daemon 58364562Sgshapiro_OPTION(TrustedUser, `confTRUSTED_USER', `root') 58464562Sgshapiro 58564562Sgshapiro# Control socket for daemon management 58664562Sgshapiro_OPTION(ControlSocketName, `confCONTROL_SOCKET_NAME', `/var/spool/mqueue/.control') 58764562Sgshapiro 58864562Sgshapiro# Maximum MIME header length to protect MUAs 589112810Sgshapiro_OPTION(MaxMimeHeaderLength, `confMAX_MIME_HEADER_LENGTH', `2048/1024') 59064562Sgshapiro 59164562Sgshapiro# Maximum length of the sum of all headers 59264562Sgshapiro_OPTION(MaxHeadersLength, `confMAX_HEADERS_LENGTH', `32768') 59364562Sgshapiro 59464562Sgshapiro# Maximum depth of alias recursion 59564562Sgshapiro_OPTION(MaxAliasRecursion, `confMAX_ALIAS_RECURSION', `10') 59664562Sgshapiro 59764562Sgshapiro# location of pid file 59864562Sgshapiro_OPTION(PidFile, `confPID_FILE', `/var/run/sendmail.pid') 59964562Sgshapiro 60064562Sgshapiro# Prefix string for the process title shown on 'ps' listings 60164562Sgshapiro_OPTION(ProcessTitlePrefix, `confPROCESS_TITLE_PREFIX', `prefix') 60264562Sgshapiro 60364562Sgshapiro# Data file (df) memory-buffer file maximum size 60464562Sgshapiro_OPTION(DataFileBufferSize, `confDF_BUFFER_SIZE', `4096') 60564562Sgshapiro 60664562Sgshapiro# Transcript file (xf) memory-buffer file maximum size 60764562Sgshapiro_OPTION(XscriptFileBufferSize, `confXF_BUFFER_SIZE', `4096') 60864562Sgshapiro 60990792Sgshapiro# lookup type to find information about local mailboxes 61090792Sgshapiro_OPTION(MailboxDatabase, `confMAILBOX_DATABASE', `pw') 61190792Sgshapiro 61264562Sgshapiro# list of authentication mechanisms 61390792Sgshapiro_OPTION(AuthMechanisms, `confAUTH_MECHANISMS', `EXTERNAL GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5') 61464562Sgshapiro 61564562Sgshapiro# default authentication information for outgoing connections 61664562Sgshapiro_OPTION(DefaultAuthInfo, `confDEF_AUTH_INFO', `MAIL_SETTINGS_DIR`'default-auth-info') 61764562Sgshapiro 61864562Sgshapiro# SMTP AUTH flags 61964562Sgshapiro_OPTION(AuthOptions, `confAUTH_OPTIONS', `') 62064562Sgshapiro 62190792Sgshapiro# SMTP AUTH maximum encryption strength 62290792Sgshapiro_OPTION(AuthMaxBits, `confAUTH_MAX_BITS', `') 62390792Sgshapiro 62490792Sgshapiro# SMTP STARTTLS server options 62590792Sgshapiro_OPTION(TLSSrvOptions, `confTLS_SRV_OPTIONS', `') 62690792Sgshapiro 62764562Sgshapiro# Input mail filters 62864562Sgshapiro_OPTION(InputMailFilters, `confINPUT_MAIL_FILTERS', `') 62964562Sgshapiro 63098841Sgshapiroifelse(len(X`'_MAIL_FILTERS_DEF), `1', `dnl', `dnl 63164562Sgshapiro# Milter options 63290792Sgshapiro_OPTION(Milter.LogLevel, `confMILTER_LOG_LEVEL', `') 63364562Sgshapiro_OPTION(Milter.macros.connect, `confMILTER_MACROS_CONNECT', `') 63464562Sgshapiro_OPTION(Milter.macros.helo, `confMILTER_MACROS_HELO', `') 63564562Sgshapiro_OPTION(Milter.macros.envfrom, `confMILTER_MACROS_ENVFROM', `') 63664562Sgshapiro_OPTION(Milter.macros.envrcpt, `confMILTER_MACROS_ENVRCPT', `')') 63764562Sgshapiro 63864562Sgshapiro# CA directory 639110560Sgshapiro_OPTION(CACertPath, `confCACERT_PATH', `') 64064562Sgshapiro# CA file 641110560Sgshapiro_OPTION(CACertFile, `confCACERT', `') 64264562Sgshapiro# Server Cert 64364562Sgshapiro_OPTION(ServerCertFile, `confSERVER_CERT', `') 64464562Sgshapiro# Server private key 64564562Sgshapiro_OPTION(ServerKeyFile, `confSERVER_KEY', `') 64664562Sgshapiro# Client Cert 64764562Sgshapiro_OPTION(ClientCertFile, `confCLIENT_CERT', `') 64864562Sgshapiro# Client private key 64964562Sgshapiro_OPTION(ClientKeyFile, `confCLIENT_KEY', `') 65064562Sgshapiro# DHParameters (only required if DSA/DH is used) 65164562Sgshapiro_OPTION(DHParameters, `confDH_PARAMETERS', `') 65264562Sgshapiro# Random data source (required for systems without /dev/urandom under OpenSSL) 65364562Sgshapiro_OPTION(RandFile, `confRAND_FILE', `') 65464562Sgshapiro 65590792Sgshapiro############################ 65690792Sgshapiro`# QUEUE GROUP DEFINITIONS #' 65790792Sgshapiro############################ 65890792Sgshapiro_QUEUE_GROUP_ 65942575Speter 66038032Speter########################### 66138032Speter# Message precedences # 66238032Speter########################### 66338032Speter 66438032SpeterPfirst-class=0 66538032SpeterPspecial-delivery=100 66638032SpeterPlist=-30 66738032SpeterPbulk=-60 66838032SpeterPjunk=-100 66938032Speter 67038032Speter##################### 67138032Speter# Trusted users # 67238032Speter##################### 67338032Speter 67438032Speter# this is equivalent to setting class "t" 67564562Sgshapiroifdef(`_USE_CT_FILE_', `', `#')Ft`'ifdef(`confCT_FILE', confCT_FILE, `MAIL_SETTINGS_DIR`'trusted-users') 67638032SpeterTroot 67738032SpeterTdaemon 67838032Speterifdef(`_NO_UUCP_', `dnl', `Tuucp') 67938032Speterifdef(`confTRUSTED_USERS', `T`'confTRUSTED_USERS', `dnl') 68038032Speter 68138032Speter######################### 68238032Speter# Format of headers # 68338032Speter######################### 68438032Speter 68538032Speterifdef(`confFROM_HEADER',, `define(`confFROM_HEADER', `$?x$x <$g>$|$g$.')')dnl 68638032SpeterH?P?Return-Path: <$g> 68738032SpeterHReceived: confRECEIVED_HEADER 68838032SpeterH?D?Resent-Date: $a 68938032SpeterH?D?Date: $a 69038032SpeterH?F?Resent-From: confFROM_HEADER 69138032SpeterH?F?From: confFROM_HEADER 69238032SpeterH?x?Full-Name: $x 69338032Speter# HPosted-Date: $a 69438032Speter# H?l?Received-Date: $b 69538032SpeterH?M?Resent-Message-Id: <$t.$i@$j> 69638032SpeterH?M?Message-Id: <$t.$i@$j> 69764562Sgshapiro 69838032Speter# 69938032Speter###################################################################### 70038032Speter###################################################################### 70138032Speter##### 70238032Speter##### REWRITING RULES 70338032Speter##### 70438032Speter###################################################################### 70538032Speter###################################################################### 70638032Speter 70738032Speter############################################ 70838032Speter### Ruleset 3 -- Name Canonicalization ### 70938032Speter############################################ 71064562SgshapiroScanonify=3 71138032Speter 71238032Speter# handle null input (translate to <@> special case) 71338032SpeterR$@ $@ <@> 71438032Speter 71538032Speter# strip group: syntax (not inside angle brackets!) and trailing semicolon 71638032SpeterR$* $: $1 <@> mark addresses 71738032SpeterR$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr> 71838032SpeterR@ $* <@> $: @ $1 unmark @host:... 71990792SgshapiroR$* [ IPv6 : $+ ] <@> $: $1 [ IPv6 : $2 ] unmark IPv6 addr 72038032SpeterR$* :: $* <@> $: $1 :: $2 unmark node::addr 72138032SpeterR:`include': $* <@> $: :`include': $1 unmark :`include':... 72238032SpeterR$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon 72338032SpeterR$* : $* <@> $: $2 strip colon if marked 72438032SpeterR$* <@> $: $1 unmark 72538032SpeterR$* ; $1 strip trailing semi 72671345SgshapiroR$* < $+ :; > $* $@ $2 :; <@> catch <list:;> 72738032SpeterR$* < $* ; > $1 < $2 > bogus bracketed semi 72838032Speter 72938032Speter# null input now results from list:; syntax 73038032SpeterR$@ $@ :; <@> 73138032Speter 73238032Speter# strip angle brackets -- note RFC733 heuristic to get innermost item 73338032SpeterR$* $: < $1 > housekeeping <> 73438032SpeterR$+ < $* > < $2 > strip excess on left 73538032SpeterR< $* > $+ < $1 > strip excess on right 73638032SpeterR<> $@ < @ > MAIL FROM:<> case 73738032SpeterR< $+ > $: $1 remove housekeeping <> 73838032Speter 73964562Sgshapiroifdef(`_USE_DEPRECATED_ROUTE_ADDR_',`dnl 74038032Speter# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 74138032SpeterR@ $+ , $+ @ $1 : $2 change all "," to ":" 74238032Speter 74338032Speter# localize and dispose of route-based addresses 74490792Sgshapirodnl XXX: IPv6 colon conflict 74590792Sgshapiroifdef(`NO_NETINET6', `dnl', 74690792Sgshapiro`R@ [$+] : $+ $@ $>Canonify2 < @ [$1] > : $2 handle <route-addr>') 74764562SgshapiroR@ $+ : $+ $@ $>Canonify2 < @$1 > : $2 handle <route-addr> 74864562Sgshapirodnl',`dnl 74964562Sgshapiro# strip route address <@a,@b,@c:user@d> -> <user@d> 75064562SgshapiroR@ $+ , $+ $2 75190792Sgshapiroifdef(`NO_NETINET6', `dnl', 75290792Sgshapiro`R@ [ $* ] : $+ $2') 75364562SgshapiroR@ $+ : $+ $2 75464562Sgshapirodnl') 75538032Speter 75638032Speter# find focus for list syntax 75764562SgshapiroR $+ : $* ; @ $+ $@ $>Canonify2 $1 : $2 ; < @ $3 > list syntax 75838032SpeterR $+ : $* ; $@ $1 : $2; list syntax 75938032Speter 76038032Speter# find focus for @ syntax addresses 76138032SpeterR$+ @ $+ $: $1 < @ $2 > focus on domain 76238032SpeterR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 76364562SgshapiroR$+ < @ $+ > $@ $>Canonify2 $1 < @ $2 > already canonical 76438032Speter 76590792Sgshapirodnl This is flagged as an error in S0; no need to silently fix it here. 76690792Sgshapirodnl # do some sanity checking 76790792Sgshapirodnl R$* < @ $~[ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs 76838032Speter 76938032Speterifdef(`_NO_UUCP_', `dnl', 77038032Speter`# convert old-style addresses to a domain-based address 77164562SgshapiroR$- ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > resolve uucp names 77264562SgshapiroR$+ . $- ! $+ $@ $>Canonify2 $3 < @ $1 . $2 > domain uucps 77364562SgshapiroR$+ ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > uucp subdomains 77438032Speter') 77538032Speterifdef(`_USE_DECNET_SYNTAX_', 77638032Speter`# convert node::user addresses into a domain-based address 77764562SgshapiroR$- :: $+ $@ $>Canonify2 $2 < @ $1 .DECNET > resolve DECnet names 77864562SgshapiroR$- . $- :: $+ $@ $>Canonify2 $3 < @ $1.$2 .DECNET > numeric DECnet addr 77938032Speter', 78038032Speter `dnl') 78138032Speter# if we have % signs, take the rightmost one 78238032SpeterR$* % $* $1 @ $2 First make them all @s. 78338032SpeterR$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 78464562SgshapiroR$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish 78538032Speter 78638032Speter# else we must be a local name 78764562SgshapiroR$* $@ $>Canonify2 $1 78838032Speter 78938032Speter 79038032Speter################################################ 79138032Speter### Ruleset 96 -- bottom half of ruleset 3 ### 79238032Speter################################################ 79338032Speter 79464562SgshapiroSCanonify2=96 79538032Speter 79638032Speter# handle special cases for local names 79738032SpeterR$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 79838032SpeterR$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 79938032Speterifdef(`_NO_UUCP_', `dnl', 80038032Speter`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 80164562Sgshapiro 80290792Sgshapiro# check for IPv4/IPv6 domain literal 80390792SgshapiroR$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [addr] 80438032SpeterR$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal 80538032SpeterR$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr 80638032Speter 80764562Sgshapiroifdef(`_DOMAIN_TABLE_', `dnl 80838032Speter# look up domains in the domain table 80938032SpeterR$* < @ $+ > $* $: $1 < @ $(domaintable $2 $) > $3', `dnl') 81038032Speter 81164562Sgshapiroundivert(2)dnl LOCAL_RULE_3 81238032Speter 81364562Sgshapiroifdef(`_BITDOMAIN_TABLE_', `dnl 81438032Speter# handle BITNET mapping 81538032SpeterR$* < @ $+ .BITNET > $* $: $1 < @ $(bitdomain $2 $: $2.BITNET $) > $3', `dnl') 81638032Speter 81764562Sgshapiroifdef(`_UUDOMAIN_TABLE_', `dnl 81838032Speter# handle UUCP mapping 81938032SpeterR$* < @ $+ .UUCP > $* $: $1 < @ $(uudomain $2 $: $2.UUCP $) > $3', `dnl') 82038032Speter 82138032Speterifdef(`_NO_UUCP_', `dnl', 82238032Speter`ifdef(`UUCP_RELAY', 82338032Speter`# pass UUCP addresses straight through 82438032SpeterR$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', 82538032Speter`# if really UUCP, handle it immediately 82638032Speterifdef(`_CLASS_U_', 82738032Speter`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 82838032Speterifdef(`_CLASS_V_', 82938032Speter`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 83038032Speterifdef(`_CLASS_W_', 83138032Speter`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 83238032Speterifdef(`_CLASS_X_', 83338032Speter`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 83438032Speterifdef(`_CLASS_Y_', 83538032Speter`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 83638032Speter 83738032Speterifdef(`_NO_CANONIFY_', `dnl', `dnl 83838032Speter# try UUCP traffic as a local address 83938032SpeterR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3 84038032SpeterR$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3') 84138032Speter')') 84264562Sgshapiro# hostnames ending in class P are always canonical 84364562SgshapiroR$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 84464562Sgshapirodnl apply the next rule only for hostnames not in class P 84564562Sgshapirodnl this even works for phrases in class P since . is in class P 84664562Sgshapirodnl which daemon flags are set? 84764562SgshapiroR$* < @ $* $~P > $* $: $&{daemon_flags} $| $1 < @ $2 $3 > $4 84864562Sgshapirodnl the other rules in this section only apply if the hostname 84964562Sgshapirodnl does not end in class P hence no further checks are done here 85064562Sgshapirodnl if this ever changes make sure the lookups are "protected" again! 85164562Sgshapiroifdef(`_NO_CANONIFY_', `dnl 85264562Sgshapirodnl do not canonify unless: 85364562Sgshapirodnl domain ends in class {Canonify} (this does not work if the intersection 85464562Sgshapirodnl with class P is non-empty) 85564562Sgshapirodnl or {daemon_flags} has c set 85664562Sgshapiro# pass to name server to make hostname canonical if in class {Canonify} 85764562SgshapiroR$* $| $* < @ $* $={Canonify} > $* $: $2 < @ $[ $3 $4 $] > $5 85864562Sgshapiro# pass to name server to make hostname canonical if requested 85964562SgshapiroR$* c $* $| $* < @ $* > $* $: $3 < @ $[ $4 $] > $5 86064562Sgshapirodnl trailing dot? -> do not apply _CANONIFY_HOSTS_ 86164562SgshapiroR$* $| $* < @ $+ . > $* $: $2 < @ $3 . > $4 86264562Sgshapiro# add a trailing dot to qualified hostnames so other rules will work 86364562SgshapiroR$* $| $* < @ $+.$+ > $* $: $2 < @ $3.$4 . > $5 86464562Sgshapiroifdef(`_CANONIFY_HOSTS_', `dnl 86564562Sgshapirodnl this should only apply to unqualified hostnames 86664562Sgshapirodnl but if a valid character inside an unqualified hostname is an OperatorChar 86764562Sgshapirodnl then $- does not work. 86864562Sgshapiro# lookup unqualified hostnames 86990792SgshapiroR$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4', `dnl')', `dnl 87064562Sgshapirodnl _NO_CANONIFY_ is not set: canonify unless: 87164562Sgshapirodnl {daemon_flags} contains CC (do not canonify) 87271345Sgshapirodnl but add a trailing dot to qualified hostnames so other rules will work 87371345Sgshapirodnl should we do this for every hostname: even unqualified? 87471345SgshapiroR$* CC $* $| $* < @ $+.$+ > $* $: $3 < @ $4.$5 . > $6 87564562SgshapiroR$* CC $* $| $* $: $3 87690792Sgshapiroifdef(`_FFR_NOCANONIFY_HEADERS', `dnl 87790792Sgshapiro# do not canonify header addresses 87890792SgshapiroR$* $| $* < @ $* $~P > $* $: $&{addr_type} $| $2 < @ $3 $4 > $5 87990792SgshapiroR$* h $* $| $* < @ $+.$+ > $* $: $3 < @ $4.$5 . > $6 88090792SgshapiroR$* h $* $| $* $: $3', `dnl') 88138032Speter# pass to name server to make hostname canonical 88264562SgshapiroR$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4') 88364562Sgshapirodnl remove {daemon_flags} for other cases 88464562SgshapiroR$* $| $* $: $2 88538032Speter 88638032Speter# local host aliases and pseudo-domains are always canonical 88738032SpeterR$* < @ $=w > $* $: $1 < @ $2 . > $3 88838032Speterifdef(`_MASQUERADE_ENTIRE_DOMAIN_', 88938032Speter`R$* < @ $* $=M > $* $: $1 < @ $2 $3 . > $4', 89038032Speter`R$* < @ $=M > $* $: $1 < @ $2 . > $3') 89164562Sgshapiroifdef(`_VIRTUSER_TABLE_', `dnl 89264562Sgshapirodnl virtual hosts are also canonical 89364562Sgshapiroifdef(`_VIRTUSER_ENTIRE_DOMAIN_', 89464562Sgshapiro`R$* < @ $* $={VirtHost} > $* $: $1 < @ $2 $3 . > $4', 89564562Sgshapiro`R$* < @ $={VirtHost} > $* $: $1 < @ $2 . > $3')', 89664562Sgshapiro`dnl') 89790792Sgshapiroifdef(`_GENERICS_TABLE_', `dnl 89890792Sgshapirodnl hosts for genericstable are also canonical 89990792Sgshapiroifdef(`_GENERICS_ENTIRE_DOMAIN_', 90090792Sgshapiro`R$* < @ $* $=G > $* $: $1 < @ $2 $3 . > $4', 90190792Sgshapiro`R$* < @ $=G > $* $: $1 < @ $2 . > $3')', 90290792Sgshapiro`dnl') 90364562Sgshapirodnl remove superfluous dots (maybe repeatedly) which may have been added 90464562Sgshapirodnl by one of the rules before 90538032SpeterR$* < @ $* . . > $* $1 < @ $2 . > $3 90638032Speter 90738032Speter 90838032Speter################################################## 90938032Speter### Ruleset 4 -- Final Output Post-rewriting ### 91038032Speter################################################## 91164562SgshapiroSfinal=4 91238032Speter 91371345SgshapiroR$+ :; <@> $@ $1 : handle <list:;> 91438032SpeterR$* <@> $@ handle <> and list:; 91538032Speter 91638032Speter# strip trailing dot off possibly canonical name 91738032SpeterR$* < @ $+ . > $* $1 < @ $2 > $3 91838032Speter 91964562Sgshapiro# eliminate internal code 92038032SpeterR$* < @ *LOCAL* > $* $1 < @ $j > $2 92138032Speter 92238032Speter# externalize local domain info 92338032SpeterR$* < $+ > $* $1 $2 $3 defocus 92438032SpeterR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 92538032SpeterR@ $* $@ @ $1 ... and exit 92638032Speter 92738032Speterifdef(`_NO_UUCP_', `dnl', 92838032Speter`# UUCP must always be presented in old form 92938032SpeterR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 93038032Speter 93138032Speterifdef(`_USE_DECNET_SYNTAX_', 93238032Speter`# put DECnet back in :: form 93338032SpeterR$+ @ $+ . DECNET $2 :: $1 u@h.DECNET => h::u', 93438032Speter `dnl') 93538032Speter# delete duplicate local names 93638032SpeterR$+ % $=w @ $=w $1 @ $2 u%host@host => u@host 93738032Speter 93838032Speter 93938032Speter 94038032Speter############################################################## 94138032Speter### Ruleset 97 -- recanonicalize and call ruleset zero ### 94238032Speter### (used for recursive calls) ### 94338032Speter############################################################## 94438032Speter 94564562SgshapiroSRecurse=97 94664562SgshapiroR$* $: $>canonify $1 94764562SgshapiroR$* $@ $>parse $1 94838032Speter 94938032Speter 95038032Speter###################################### 95138032Speter### Ruleset 0 -- Parse Address ### 95238032Speter###################################### 95338032Speter 95464562SgshapiroSparse=0 95538032Speter 95638032SpeterR$* $: $>Parse0 $1 initial parsing 95738032SpeterR<@> $#_LOCAL_ $: <@> special case error msgs 95864562SgshapiroR$* $: $>ParseLocal $1 handle local hacks 95938032SpeterR$* $: $>Parse1 $1 final parsing 96038032Speter 96138032Speter# 96238032Speter# Parse0 -- do initial syntax checking and eliminate local addresses. 96338032Speter# This should either return with the (possibly modified) input 96438032Speter# or return with a #error mailer. It should not return with a 96538032Speter# #mailer other than the #error mailer. 96638032Speter# 96738032Speter 96838032SpeterSParse0 96938032SpeterR<@> $@ <@> special case error msgs 97090792SgshapiroR$* : $* ; <@> $#error $@ 5.1.3 $: "_CODE553 List:; syntax illegal for recipient addresses" 97164562SgshapiroR@ <@ $* > < @ $1 > catch "@@host" bogosity 97290792SgshapiroR<@ $+> $#error $@ 5.1.3 $: "_CODE553 User address required" 97390792SgshapiroR$+ <@> $#error $@ 5.1.3 $: "_CODE553 Hostname required" 97438032SpeterR$* $: <> $1 97590792Sgshapirodnl allow tricks like [host1]:[host2] 97690792SgshapiroR<> $* < @ [ $* ] : $+ > $* $1 < @ [ $2 ] : $3 > $4 97790792SgshapiroR<> $* < @ [ $* ] , $+ > $* $1 < @ [ $2 ] , $3 > $4 97890792Sgshapirodnl but no a@[b]c 97990792SgshapiroR<> $* < @ [ $* ] $+ > $* $#error $@ 5.1.2 $: "_CODE553 Invalid address" 98090792SgshapiroR<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3 98190792SgshapiroR<> $* <$* : $* > $* $#error $@ 5.1.3 $: "_CODE553 Colon illegal in host name part" 98238032SpeterR<> $* $1 98390792SgshapiroR$* < @ . $* > $* $#error $@ 5.1.2 $: "_CODE553 Invalid host name" 98490792SgshapiroR$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "_CODE553 Invalid host name" 98590792Sgshapirodnl no a@b@ 98690792SgshapiroR$* < @ $* @ > $* $#error $@ 5.1.2 $: "_CODE553 Invalid route address" 98790792Sgshapirodnl no a@b@c 98890792SgshapiroR$* @ $* < @ $* > $* $#error $@ 5.1.3 $: "_CODE553 Invalid route address" 98964562Sgshapirodnl comma only allowed before @; this check is not complete 99090792SgshapiroR$* , $~O $* $#error $@ 5.1.3 $: "_CODE553 Invalid route address" 99138032Speter 99290792Sgshapiroifdef(`_STRICT_RFC821_', `# more RFC 821 checks 99390792SgshapiroR$* . < @ $* > $* $#error $@ 5.1.2 $: "_CODE553 Local part must not end with a dot" 99490792SgshapiroR. $* < @ $* > $* $#error $@ 5.1.2 $: "_CODE553 Local part must not begin with a dot" 99590792Sgshapirodnl', `dnl') 99690792Sgshapiro 99738032Speter# now delete the local info -- note $=O to find characters that cause forwarding 99864562SgshapiroR$* < @ > $* $@ $>Parse0 $>canonify $1 user@ => user 99964562SgshapiroR< @ $=w . > : $* $@ $>Parse0 $>canonify $2 @here:... -> ... 100038032SpeterR$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here 100190792SgshapiroR< @ $+ > $#error $@ 5.1.3 $: "_CODE553 User address required" 100264562SgshapiroR$* $=O $* < @ $=w . > $@ $>Parse0 $>canonify $1 $2 $3 ...@here -> ... 100338032SpeterR$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo" 100490792SgshapiroR< @ *LOCAL* > $#error $@ 5.1.3 $: "_CODE553 User address required" 100538032SpeterR$* $=O $* < @ *LOCAL* > 100664562Sgshapiro $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ... 100738032SpeterR$* < @ *LOCAL* > $: $1 100838032Speter 100938032Speter# 101038032Speter# Parse1 -- the bottom half of ruleset 0. 101138032Speter# 101238032Speter 101338032SpeterSParse1 101464562Sgshapiroifdef(`_LDAP_ROUTING_', `dnl 101564562Sgshapiro# handle LDAP routing for hosts in $={LDAPRoute} 101690792SgshapiroR$+ < @ $={LDAPRoute} . > $: $>LDAPExpand <$1 < @ $2 . >> <$1 @ $2> <> 101790792SgshapiroR$+ < @ $={LDAPRouteEquiv} . > $: $>LDAPExpand <$1 < @ $2 . >> <$1 @ $M> <>', 101864562Sgshapiro`dnl') 101964562Sgshapiro 102038032Speterifdef(`_MAILER_smtp_', 102138032Speter`# handle numeric address spec 102264562Sgshapirodnl there is no check whether this is really an IP number 102364562SgshapiroR$* < @ [ $+ ] > $* $: $>ParseLocal $1 < @ [ $2 ] > $3 numeric internet spec 1024112810SgshapiroR$* < @ [ $+ ] > $* $: $1 < @ [ $2 ] : $S > $3 Add smart host to path 102590792SgshapiroR$* < @ [ $+ ] : > $* $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3 no smarthost: send 102664562SgshapiroR$* < @ [ $+ ] : $- : $*> $* $#$3 $@ $4 $: $1 < @ [$2] > $5 smarthost with mailer 102764562SgshapiroR$* < @ [ $+ ] : $+ > $* $#_SMTP_ $@ $3 $: $1 < @ [$2] > $4 smarthost without mailer', 102838032Speter `dnl') 102938032Speter 103064562Sgshapiroifdef(`_VIRTUSER_TABLE_', `dnl 103138032Speter# handle virtual users 103290792Sgshapiroifdef(`_VIRTUSER_STOP_ONE_LEVEL_RECURSION_',`dnl 103390792Sgshapirodnl this is not a documented option 103490792Sgshapirodnl it stops looping in virtusertable mapping if input and output 103590792Sgshapirodnl are identical, i.e., if address A is mapped to A. 103690792Sgshapirodnl it does not deal with multi-level recursion 103790792Sgshapiro# handle full domains in RHS of virtusertable 103890792SgshapiroR$+ < @ $+ > $: $(macro {RecipientAddress} $) $1 < @ $2 > 103990792SgshapiroR$+ < @ $+ > $: <?> $1 < @ $2 > $| $>final $1 < @ $2 > 104090792SgshapiroR<?> $+ $| $+ $: $1 $(macro {RecipientAddress} $@ $2 $) 104190792SgshapiroR<?> $+ $| $* $: $1', 104290792Sgshapiro`dnl') 104364562SgshapiroR$+ $: <!> $1 Mark for lookup 104490792Sgshapirodnl input: <!> local<@domain> 104564562Sgshapiroifdef(`_VIRTUSER_ENTIRE_DOMAIN_', 104664562Sgshapiro`R<!> $+ < @ $* $={VirtHost} . > $: < $(virtuser $1 @ $2 $3 $@ $1 $: @ $) > $1 < @ $2 $3 . >', 104764562Sgshapiro`R<!> $+ < @ $={VirtHost} . > $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >') 104890792Sgshapirodnl input: <result-of-lookup | @> local<@domain> | <!> local<@domain> 104964562SgshapiroR<!> $+ < @ $=w . > $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . > 105090792Sgshapirodnl if <@> local<@domain>: no match but try lookup 105190792Sgshapirodnl user+detail: try user++@domain if detail not empty 105290792SgshapiroR<@> $+ + $+ < @ $* . > 105390792Sgshapiro $: < $(virtuser $1 + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . > 105490792Sgshapirodnl user+detail: try user+*@domain 105538032SpeterR<@> $+ + $* < @ $* . > 105690792Sgshapiro $: < $(virtuser $1 + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . > 105790792Sgshapirodnl user+detail: try user@domain 105838032SpeterR<@> $+ + $* < @ $* . > 105990792Sgshapiro $: < $(virtuser $1 @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . > 106064562Sgshapirodnl try default entry: @domain 106190792Sgshapirodnl ++@domain 106290792SgshapiroR<@> $+ + $+ < @ $+ . > $: < $(virtuser + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . > 106364562Sgshapirodnl +*@domain 106490792SgshapiroR<@> $+ + $* < @ $+ . > $: < $(virtuser + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . > 106564562Sgshapirodnl @domain if +detail exists 106698121Sgshapirodnl if no match, change marker to prevent a second @domain lookup 106798121SgshapiroR<@> $+ + $* < @ $+ . > $: < $(virtuser @ $3 $@ $1 $@ $2 $@ +$2 $: ! $) > $1 + $2 < @ $3 . > 106898121Sgshapirodnl without +detail 106938032SpeterR<@> $+ < @ $+ . > $: < $(virtuser @ $2 $@ $1 $: @ $) > $1 < @ $2 . > 107090792Sgshapirodnl no match 107138032SpeterR<@> $+ $: $1 107290792Sgshapirodnl remove mark 107364562SgshapiroR<!> $+ $: $1 107464562SgshapiroR< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4 107538032SpeterR< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2 107690792Sgshapiroifdef(`_VIRTUSER_STOP_ONE_LEVEL_RECURSION_',`dnl 107790792Sgshapiro# check virtuser input address against output address, if same, skip recursion 107890792SgshapiroR< $+ > $+ < @ $+ > $: < $1 > $2 < @ $3 > $| $1 107990792Sgshapiro# it is the same: stop now 108090792SgshapiroR< $+ > $+ < @ $+ > $| $&{RecipientAddress} $: $>ParseLocal $>Parse0 $>canonify $1 108190792SgshapiroR< $+ > $+ < @ $+ > $| $* $: < $1 > $2 < @ $3 > 108290792Sgshapirodnl', `dnl') 108380785Sgshapirodnl this is not a documented option 108480785Sgshapirodnl it performs no looping at all for virtusertable 108577349Sgshapiroifdef(`_NO_VIRTUSER_RECURSION_', 108677349Sgshapiro`R< $+ > $+ < @ $+ > $: $>ParseLocal $>Parse0 $>canonify $1', 108777349Sgshapiro`R< $+ > $+ < @ $+ > $: $>Recurse $1') 108877349Sgshapirodnl', `dnl') 108938032Speter 109038032Speter# short circuit local delivery so forwarded email works 109138032Speterifdef(`_MAILER_usenet_', `dnl 109264562SgshapiroR$+ . USENET < @ $=w . > $#usenet $@ usenet $: $1 handle usenet specially', `dnl') 109366494Sgshapiro 109466494Sgshapiro 109538032Speterifdef(`_STICKY_LOCAL_DOMAIN_', 109638032Speter`R$+ < @ $=w . > $: < $H > $1 < @ $2 . > first try hub 109764562SgshapiroR< $+ > $+ < $+ > $>MailerToTriple < $1 > $2 < $3 > yep .... 109864562Sgshapirodnl $H empty (but @$=w.) 109938032SpeterR< > $+ + $* < $+ > $#_LOCAL_ $: $1 + $2 plussed name? 110038032SpeterR< > $+ < $+ > $#_LOCAL_ $: @ $1 nope, local address', 110164562Sgshapiro`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names 110238032SpeterR$+ < @ $=w . > $#_LOCAL_ $: $1 regular local name') 110338032Speter 110464562Sgshapiroifdef(`_MAILER_TABLE_', `dnl 110538032Speter# not local -- try mailer table lookup 110638032SpeterR$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 110738032SpeterR< $+ . > $* $: < $1 > $2 strip trailing dot 110838032SpeterR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 110964562Sgshapirodnl it is $~[ instead of $- to avoid matches on IPv6 addresses 111064562SgshapiroR< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3 check -- resolved? 111164562SgshapiroR< $+ > $* $: $>Mailertable <$1> $2 try domain', 111238032Speter`dnl') 111364562Sgshapiroundivert(4)dnl UUCP rules from `MAILER(uucp)' 111438032Speter 111538032Speterifdef(`_NO_UUCP_', `dnl', 111638032Speter`# resolve remotely connected UUCP links (if any) 111738032Speterifdef(`_CLASS_V_', 111864562Sgshapiro`R$* < @ $=V . UUCP . > $* $: $>MailerToTriple < $V > $1 <@$2.UUCP.> $3', 111938032Speter `dnl') 112038032Speterifdef(`_CLASS_W_', 112164562Sgshapiro`R$* < @ $=W . UUCP . > $* $: $>MailerToTriple < $W > $1 <@$2.UUCP.> $3', 112238032Speter `dnl') 112338032Speterifdef(`_CLASS_X_', 112464562Sgshapiro`R$* < @ $=X . UUCP . > $* $: $>MailerToTriple < $X > $1 <@$2.UUCP.> $3', 112538032Speter `dnl')') 112638032Speter 112738032Speter# resolve fake top level domains by forwarding to other hosts 112838032Speterifdef(`BITNET_RELAY', 112964562Sgshapiro`R$*<@$+.BITNET.>$* $: $>MailerToTriple < $B > $1 <@$2.BITNET.> $3 user@host.BITNET', 113038032Speter `dnl') 113138032Speterifdef(`DECNET_RELAY', 113264562Sgshapiro`R$*<@$+.DECNET.>$* $: $>MailerToTriple < $C > $1 <@$2.DECNET.> $3 user@host.DECNET', 113338032Speter `dnl') 113438032Speterifdef(`_MAILER_pop_', 113538032Speter`R$+ < @ POP. > $#pop $: $1 user@POP', 113638032Speter `dnl') 113738032Speterifdef(`_MAILER_fax_', 113838032Speter`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX', 113938032Speter`ifdef(`FAX_RELAY', 114064562Sgshapiro`R$*<@$+.FAX.>$* $: $>MailerToTriple < $F > $1 <@$2.FAX.> $3 user@host.FAX', 114138032Speter `dnl')') 114238032Speter 114338032Speterifdef(`UUCP_RELAY', 114438032Speter`# forward non-local UUCP traffic to our UUCP relay 114564562SgshapiroR$*<@$*.UUCP.>$* $: $>MailerToTriple < $Y > $1 <@$2.UUCP.> $3 uucp mail', 114638032Speter`ifdef(`_MAILER_uucp_', 114738032Speter`# forward other UUCP traffic straight to UUCP 114838032SpeterR$* < @ $+ .UUCP. > $* $#_UUCP_ $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP', 114938032Speter `dnl')') 115038032Speterifdef(`_MAILER_usenet_', ` 115138032Speter# addresses sent to net.group.USENET will get forwarded to a newsgroup 115264562SgshapiroR$+ . USENET $#usenet $@ usenet $: $1', 115338032Speter `dnl') 115438032Speter 115538032Speterifdef(`_LOCAL_RULES_', 115638032Speter`# figure out what should stay in our local mail system 115738032Speterundivert(1)', `dnl') 115838032Speter 115938032Speter# pass names that still have a host to a smarthost (if defined) 116064562SgshapiroR$* < @ $* > $* $: $>MailerToTriple < $S > $1 < @ $2 > $3 glue on smarthost name 116138032Speter 116238032Speter# deal with other remote names 116338032Speterifdef(`_MAILER_smtp_', 116464562Sgshapiro`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain', 116590792Sgshapiro`R$* < @$* > $* $#error $@ 5.1.2 $: "_CODE553 Unrecognized host name " $2') 116638032Speter 116738032Speter# handle locally delivered names 116864562SgshapiroR$=L $#_LOCAL_ $: @ $1 special local names 116938032SpeterR$+ $#_LOCAL_ $: $1 regular local names 117038032Speter 117138032Speter########################################################################### 117238032Speter### Ruleset 5 -- special rewriting after aliases have been expanded ### 117338032Speter########################################################################### 117438032Speter 117564562SgshapiroSLocal_localaddr 117664562SgshapiroSlocaladdr=5 117764562SgshapiroR$+ $: $1 $| $>"Local_localaddr" $1 117890792SgshapiroR$+ $| $#ok $@ $1 no change 117964562SgshapiroR$+ $| $#$* $#$2 118064562SgshapiroR$+ $| $* $: $1 118138032Speter 118290792Sgshapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 118390792Sgshapiro# Preserve rcpt_host in {Host} 118490792SgshapiroR$+ $: $1 $| $&h $| $&{Host} check h and {Host} 118590792SgshapiroR$+ $| $| $: $(macro {Host} $@ $) $1 no h or {Host} 118690792SgshapiroR$+ $| $| $+ $: $1 h not set, {Host} set 118790792SgshapiroR$+ $| +$* $| $* $: $1 h is +detail, {Host} set 118895154SgshapiroR$+ $| $* @ $+ $| $* $: $(macro {Host} $@ @$3 $) $1 set {Host} to host in h 118990792SgshapiroR$+ $| $+ $| $* $: $(macro {Host} $@ @$2 $) $1 set {Host} to h 119090792Sgshapiro')dnl 119190792Sgshapiro 119290792Sgshapiroifdef(`_FFR_5_', `dnl 119366494Sgshapiro# Preserve host in a macro 119466494SgshapiroR$+ $: $(macro {LocalAddrHost} $) $1 119566494SgshapiroR$+ @ $+ $: $(macro {LocalAddrHost} $@ @ $2 $) $1') 119666494Sgshapiro 119790792Sgshapiroifdef(`_PRESERVE_LOCAL_PLUS_DETAIL_', `', `dnl 119838032Speter# deal with plussed users so aliases work nicely 119966494SgshapiroR$+ + * $#_LOCAL_ $@ $&h $: $1`'ifdef(`_FFR_5_', ` $&{LocalAddrHost}') 120066494SgshapiroR$+ + $* $#_LOCAL_ $@ + $2 $: $1 + *`'ifdef(`_FFR_5_', ` $&{LocalAddrHost}') 120166494Sgshapiro') 120238032Speter# prepend an empty "forward host" on the front 120338032SpeterR$+ $: <> $1 120438032Speter 120538032Speterifdef(`LUSER_RELAY', `dnl 120638032Speter# send unrecognized local users to a relay host 120790792Sgshapiroifdef(`_PRESERVE_LOCAL_PLUS_DETAIL_', `dnl 120866494SgshapiroR< > $+ + $* $: < ? $L > <+ $2> $(user $1 $) look up user+ 120966494SgshapiroR< > $+ $: < ? $L > < > $(user $1 $) look up user 121066494SgshapiroR< ? $* > < $* > $+ <> $: < > $3 $2 found; strip $L 121166494SgshapiroR< ? $* > < $* > $+ $: < $1 > $3 $2 not found', ` 121264562SgshapiroR< > $+ $: < $L > $(user $1 $) look up user 121390792SgshapiroR< $* > $+ <> $: < > $2 found; strip $L') 121490792Sgshapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 121590792SgshapiroR< $+ > $+ $: < $1 > $2 $&{Host}') 121690792Sgshapirodnl') 121738032Speter 121890792Sgshapiroifdef(`MAIL_HUB', `dnl 121990792SgshapiroR< > $+ $: < $H > $1 try hub', `dnl') 122090792Sgshapiroifdef(`LOCAL_RELAY', `dnl 122190792SgshapiroR< > $+ $: < $R > $1 try relay', `dnl') 122290792Sgshapiroifdef(`_PRESERVE_LOCAL_PLUS_DETAIL_', `dnl 122390792SgshapiroR< > $+ $@ $1', `dnl 122464562SgshapiroR< > $+ $: < > < $1 <> $&h > nope, restore +detail 122590792Sgshapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 122690792SgshapiroR< > < $+ @ $+ <> + $* > $: < > < $1 + $3 @ $2 > check whether +detail') 122764562SgshapiroR< > < $+ <> + $* > $: < > < $1 + $2 > check whether +detail 122864562SgshapiroR< > < $+ <> $* > $: < > < $1 > else discard 122938032SpeterR< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part 123066494SgshapiroR< > < $+ > + $* $#_LOCAL_ $@ $2 $: @ $1`'ifdef(`_FFR_5_', ` $&{LocalAddrHost}') strip the extra + 123138032SpeterR< > < $+ > $@ $1 no +detail 123243730SpeterR$+ $: $1 <> $&h add +detail back in 123390792Sgshapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 123490792SgshapiroR$+ @ $+ <> + $* $: $1 + $3 @ $2 check whether +detail') 123543730SpeterR$+ <> + $* $: $1 + $2 check whether +detail 123666494SgshapiroR$+ <> $* $: $1 else discard') 123764562SgshapiroR< local : $* > $* $: $>MailerToTriple < local : $1 > $2 no host extension 123864562SgshapiroR< error : $* > $* $: $>MailerToTriple < error : $1 > $2 no host extension 123990792Sgshapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 124090792Sgshapirodnl it is $~[ instead of $- to avoid matches on IPv6 addresses 124190792SgshapiroR< $~[ : $+ > $+ @ $+ $: $>MailerToTriple < $1 : $2 > $3 < @ $4 >') 124290792SgshapiroR< $~[ : $+ > $+ $: $>MailerToTriple < $1 : $2 > $3 < @ $2 > 124390792Sgshapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 124490792SgshapiroR< $+ > $+ @ $+ $@ $>MailerToTriple < $1 > $2 < @ $3 >') 124564562SgshapiroR< $+ > $+ $@ $>MailerToTriple < $1 > $2 < @ $1 > 124638032Speter 124764562Sgshapiroifdef(`_MAILER_TABLE_', `dnl 124890792Sgshapiroifdef(`_LDAP_ROUTING_', `dnl 124938032Speter################################################################### 125090792Sgshapiro### Ruleset LDAPMailertable -- mailertable lookup for LDAP ### 125190792Sgshapirodnl input: <Domain> FullAddress 125290792Sgshapiro################################################################### 125390792Sgshapiro 125490792SgshapiroSLDAPMailertable 125590792SgshapiroR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 125690792SgshapiroR< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3 check resolved? 125790792SgshapiroR< $+ > $* $: < $1 > $>Mailertable <$1> $2 try domain 125890792SgshapiroR< $+ > $#$* $#$2 found 125990792SgshapiroR< $+ > $* $#_RELAY_ $@ $1 $: $2 not found, direct relay', 126090792Sgshapiro`dnl') 126190792Sgshapiro 126290792Sgshapiro################################################################### 126338032Speter### Ruleset 90 -- try domain part of mailertable entry ### 126464562Sgshapirodnl input: LeftPartOfDomain <RightPartOfDomain> FullAddress 126538032Speter################################################################### 126638032Speter 126764562SgshapiroSMailertable=90 126864562Sgshapirodnl shift and check 126964562Sgshapirodnl %2 is not documented in cf/README 127038032SpeterR$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4 127164562Sgshapirodnl it is $~[ instead of $- to avoid matches on IPv6 addresses 127264562SgshapiroR$* <$~[ : $* > $* $>MailerToTriple < $2 : $3 > $4 check -- resolved? 127364562SgshapiroR$* < . $+ > $* $@ $>Mailertable $1 . <$2> $3 no -- strip & try again 127464562Sgshapirodnl is $2 always empty? 127538032SpeterR$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "." 127664562SgshapiroR< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3 "." found? 127764562Sgshapirodnl return full address 127838032SpeterR< $* > $* $@ $2 no mailertable match', 127938032Speter`dnl') 128038032Speter 128138032Speter################################################################### 128238032Speter### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ### 128364562Sgshapirodnl input: in general: <[mailer:]host> lp<@domain>rest 128464562Sgshapirodnl <> address -> address 128564562Sgshapirodnl <error:d.s.n:text> -> error 128664562Sgshapirodnl <error:text> -> error 128764562Sgshapirodnl <mailer:user@host> lp<@domain>rest -> mailer host user 128864562Sgshapirodnl <mailer:host> address -> mailer host address 128964562Sgshapirodnl <localdomain> address -> address 129064562Sgshapirodnl <host> address -> relay host address 129138032Speter################################################################### 129238032Speter 129364562SgshapiroSMailerToTriple=95 129438032SpeterR< > $* $@ $1 strip off null relay 129564562SgshapiroR< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4 129638032SpeterR< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2 129738032SpeterR< local : $* > $* $>CanonLocal < $1 > $2 129890792Sgshapirodnl it is $~[ instead of $- to avoid matches on IPv6 addresses 129990792SgshapiroR< $~[ : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user 130090792SgshapiroR< $~[ : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 130138032SpeterR< $=w > $* $@ $2 delete local host 130238032SpeterR< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer 130338032Speter 130438032Speter################################################################### 130538032Speter### Ruleset CanonLocal -- canonify local: syntax ### 130664562Sgshapirodnl input: <user> address 130764562Sgshapirodnl <x> <@host> : rest -> Recurse rest 130864562Sgshapirodnl <x> p1 $=O p2 <@host> -> Recurse p1 $=O p2 130964562Sgshapirodnl <> user <@host> rest -> local user@host user 131064562Sgshapirodnl <> user -> local user user 131164562Sgshapirodnl <user@host> lp <@domain> rest -> <user> lp <@host> [cont] 131264562Sgshapirodnl <user> lp <@host> rest -> local lp@host user 131364562Sgshapirodnl <user> lp -> local lp user 131438032Speter################################################################### 131538032Speter 131638032SpeterSCanonLocal 131743730Speter# strip local host from routed addresses 131864562SgshapiroR< $* > < @ $+ > : $+ $@ $>Recurse $3 131964562SgshapiroR< $* > $+ $=O $+ < @ $+ > $@ $>Recurse $2 $3 $4 132043730Speter 132138032Speter# strip trailing dot from any host name that may appear 132238032SpeterR< $* > $* < @ $* . > $: < $1 > $2 < @ $3 > 132338032Speter 132438032Speter# handle local: syntax -- use old user, either with or without host 132538032SpeterR< > $* < @ $* > $* $#_LOCAL_ $@ $1@$2 $: $1 132638032SpeterR< > $+ $#_LOCAL_ $@ $1 $: $1 132738032Speter 132838032Speter# handle local:user@host syntax -- ignore host part 132938032SpeterR< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 > 133038032Speter 133138032Speter# handle local:user syntax 133238032SpeterR< $+ > $* <@ $* > $* $#_LOCAL_ $@ $2@$3 $: $1 133338032SpeterR< $+ > $* $#_LOCAL_ $@ $2 $: $1 133438032Speter 133538032Speter################################################################### 133638032Speter### Ruleset 93 -- convert header names to masqueraded form ### 133738032Speter################################################################### 133838032Speter 133964562SgshapiroSMasqHdr=93 134038032Speter 134164562Sgshapiroifdef(`_GENERICS_TABLE_', `dnl 134238032Speter# handle generics database 134338032Speterifdef(`_GENERICS_ENTIRE_DOMAIN_', 134464562Sgshapirodnl if generics should be applied add a @ as mark 134538032Speter`R$+ < @ $* $=G . > $: < $1@$2$3 > $1 < @ $2$3 . > @ mark', 134638032Speter`R$+ < @ $=G . > $: < $1@$2 > $1 < @ $2 . > @ mark') 134738032SpeterR$+ < @ *LOCAL* > $: < $1@$j > $1 < @ *LOCAL* > @ mark 134864562Sgshapirodnl workspace: either user<@domain> or <user@domain> user <@domain> @ 134964562Sgshapirodnl ignore the first case for now 135064562Sgshapirodnl if it has the mark lookup full address 135190792Sgshapirodnl broken: %1 is full address not just detail 135264562SgshapiroR< $+ > $+ < $* > @ $: < $(generics $1 $: @ $1 $) > $2 < $3 > 135364562Sgshapirodnl workspace: ... or <match|@user@domain> user <@domain> 135464562Sgshapirodnl no match, try user+detail@domain 135564562SgshapiroR<@$+ + $* @ $+> $+ < @ $+ > 135664562Sgshapiro $: < $(generics $1+*@$3 $@ $2 $:@$1 + $2@$3 $) > $4 < @ $5 > 135764562SgshapiroR<@$+ + $* @ $+> $+ < @ $+ > 135864562Sgshapiro $: < $(generics $1@$3 $: $) > $4 < @ $5 > 135964562Sgshapirodnl no match, remove mark 136064562SgshapiroR<@$+ > $+ < @ $+ > $: < > $2 < @ $3 > 136164562Sgshapirodnl no match, try @domain for exceptions 136264562SgshapiroR< > $+ < @ $+ . > $: < $(generics @$2 $@ $1 $: $) > $1 < @ $2 . > 136364562Sgshapirodnl workspace: ... or <match> user <@domain> 136464562Sgshapirodnl no match, try local part 136538032SpeterR< > $+ < @ $+ > $: < $(generics $1 $: $) > $1 < @ $2 > 136664562SgshapiroR< > $+ + $* < @ $+ > $: < $(generics $1+* $@ $2 $: $) > $1 + $2 < @ $3 > 136764562SgshapiroR< > $+ + $* < @ $+ > $: < $(generics $1 $: $) > $1 + $2 < @ $3 > 136864562SgshapiroR< $* @ $* > $* < $* > $@ $>canonify $1 @ $2 found qualified 136964562SgshapiroR< $+ > $* < $* > $: $>canonify $1 @ *LOCAL* found unqualified 137038032SpeterR< > $* $: $1 not found', 137138032Speter`dnl') 137238032Speter 137364562Sgshapiro# do not masquerade anything in class N 137464562SgshapiroR$* < @ $* $=N . > $@ $1 < @ $2 $3 . > 137564562Sgshapiro 137690792Sgshapiroifdef(`MASQUERADE_NAME', `dnl 137738032Speter# special case the users that should be exposed 137838032SpeterR$=E < @ *LOCAL* > $@ $1 < @ $j . > leave exposed 137938032Speterifdef(`_MASQUERADE_ENTIRE_DOMAIN_', 138038032Speter`R$=E < @ $* $=M . > $@ $1 < @ $2 $3 . >', 138138032Speter`R$=E < @ $=M . > $@ $1 < @ $2 . >') 138238032Speterifdef(`_LIMITED_MASQUERADE_', `dnl', 138338032Speter`R$=E < @ $=w . > $@ $1 < @ $2 . >') 138438032Speter 138538032Speter# handle domain-specific masquerading 138638032Speterifdef(`_MASQUERADE_ENTIRE_DOMAIN_', 138738032Speter`R$* < @ $* $=M . > $* $: $1 < @ $2 $3 . @ $M > $4 convert masqueraded doms', 138838032Speter`R$* < @ $=M . > $* $: $1 < @ $2 . @ $M > $3 convert masqueraded doms') 138938032Speterifdef(`_LIMITED_MASQUERADE_', `dnl', 139038032Speter`R$* < @ $=w . > $* $: $1 < @ $2 . @ $M > $3') 139138032SpeterR$* < @ *LOCAL* > $* $: $1 < @ $j . @ $M > $2 139238032SpeterR$* < @ $+ @ > $* $: $1 < @ $2 > $3 $M is null 139338032SpeterR$* < @ $+ @ $+ > $* $: $1 < @ $3 . > $4 $M is not null 139490792Sgshapirodnl', `dnl no masquerading 139590792Sgshapirodnl just fix *LOCAL* leftovers 139690792SgshapiroR$* < @ *LOCAL* > $@ $1 < @ $j . >') 139738032Speter 139838032Speter################################################################### 139938032Speter### Ruleset 94 -- convert envelope names to masqueraded form ### 140038032Speter################################################################### 140138032Speter 140264562SgshapiroSMasqEnv=94 140338032Speterifdef(`_MASQUERADE_ENVELOPE_', 140464562Sgshapiro`R$+ $@ $>MasqHdr $1', 140538032Speter`R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2') 140638032Speter 140738032Speter################################################################### 140838032Speter### Ruleset 98 -- local part of ruleset zero (can be null) ### 140938032Speter################################################################### 141038032Speter 141164562SgshapiroSParseLocal=98 141264562Sgshapiroundivert(3)dnl LOCAL_RULE_0 141338032Speter 141464562Sgshapiroifdef(`_LDAP_ROUTING_', `dnl 141590792Sgshapiro###################################################################### 141690792Sgshapiro### LDAPExpand: Expand address using LDAP routing 141790792Sgshapiro### 141890792Sgshapiro### Parameters: 141990792Sgshapiro### <$1> -- parsed address (user < @ domain . >) (pass through) 142090792Sgshapiro### <$2> -- RFC822 address (user @ domain) (used for lookup) 142190792Sgshapiro### <$3> -- +detail information 142290792Sgshapiro### 142390792Sgshapiro### Returns: 142490792Sgshapiro### Mailer triplet ($#mailer $@ host $: address) 142590792Sgshapiro### Parsed address (user < @ domain . >) 142690792Sgshapiro###################################################################### 142790792Sgshapiro 142864562SgshapiroSLDAPExpand 142964562Sgshapiro# do the LDAP lookups 143090792SgshapiroR<$+><$+><$*> $: <$(ldapmra $2 $: $)> <$(ldapmh $2 $: $)> <$1> <$2> <$3> 143164562Sgshapiro 143294334Sgshapiro# look for temporary failures (return original address, MTA will queue up) 1433102528SgshapiroR<$* <TMPF>> <$*> <$+> <$+> <$*> $@ $3 1434102528SgshapiroR<$*> <$* <TMPF>> <$+> <$+> <$*> $@ $3 143594334Sgshapiro 143664562Sgshapiro# if mailRoutingAddress and local or non-existant mailHost, 143764562Sgshapiro# return the new mailRoutingAddress 143890792Sgshapiroifelse(_LDAP_ROUTE_DETAIL_, `_PRESERVE_', `dnl 143990792SgshapiroR<$+@$+> <$=w> <$+> <$+> <$*> $@ $>Parse0 $>canonify $1 $6 @ $2 144090792SgshapiroR<$+@$+> <> <$+> <$+> <$*> $@ $>Parse0 $>canonify $1 $5 @ $2') 144190792SgshapiroR<$+> <$=w> <$+> <$+> <$*> $@ $>Parse0 $>canonify $1 144290792SgshapiroR<$+> <> <$+> <$+> <$*> $@ $>Parse0 $>canonify $1 144364562Sgshapiro 144498121Sgshapiro 144564562Sgshapiro# if mailRoutingAddress and non-local mailHost, 144664562Sgshapiro# relay to mailHost with new mailRoutingAddress 144790792Sgshapiroifelse(_LDAP_ROUTE_DETAIL_, `_PRESERVE_', `dnl 144890792Sgshapiroifdef(`_MAILER_TABLE_', `dnl 144990792Sgshapiro# check mailertable for host, relay from there 145090792SgshapiroR<$+@$+> <$+> <$+> <$+> <$*> $>LDAPMailertable <$3> $>canonify $1 $6 @ $2', 145190792Sgshapiro`R<$+@$+> <$+> <$+> <$+> <$*> $#_RELAY_ $@ $3 $: $>canonify $1 $6 @ $2')') 145290792Sgshapiroifdef(`_MAILER_TABLE_', `dnl 145390792Sgshapiro# check mailertable for host, relay from there 145490792SgshapiroR<$+> <$+> <$+> <$+> <$*> $>LDAPMailertable <$2> $>canonify $1', 145590792Sgshapiro`R<$+> <$+> <$+> <$+> <$*> $#_RELAY_ $@ $2 $: $>canonify $1') 145664562Sgshapiro 145764562Sgshapiro# if no mailRoutingAddress and local mailHost, 145864562Sgshapiro# return original address 145990792SgshapiroR<> <$=w> <$+> <$+> <$*> $@ $2 146064562Sgshapiro 146198121Sgshapiro 146264562Sgshapiro# if no mailRoutingAddress and non-local mailHost, 146364562Sgshapiro# relay to mailHost with original address 146490792Sgshapiroifdef(`_MAILER_TABLE_', `dnl 146590792Sgshapiro# check mailertable for host, relay from there 146690792SgshapiroR<> <$+> <$+> <$+> <$*> $>LDAPMailertable <$1> $2', 146790792Sgshapiro`R<> <$+> <$+> <$+> <$*> $#_RELAY_ $@ $1 $: $2') 146864562Sgshapiro 146990792Sgshapiroifdef(`_LDAP_ROUTE_DETAIL_', 147090792Sgshapiro`# if no mailRoutingAddress and no mailHost, 147190792Sgshapiro# try without +detail 147290792SgshapiroR<> <> <$+> <$+ + $* @ $+> <> $@ $>LDAPExpand <$1> <$2 @ $4> <+$3>')dnl 147390792Sgshapiro 147490792Sgshapiro# if still no mailRoutingAddress and no mailHost, 147564562Sgshapiro# try @domain 147690792Sgshapiroifelse(_LDAP_ROUTE_DETAIL_, `_PRESERVE_', `dnl 147790792SgshapiroR<> <> <$+> <$+ + $* @ $+> <> $@ $>LDAPExpand <$1> <@ $4> <+$3>') 147890792SgshapiroR<> <> <$+> <$+ @ $+> <$*> $@ $>LDAPExpand <$1> <@ $3> <$4> 147964562Sgshapiro 148064562Sgshapiro# if no mailRoutingAddress and no mailHost and this was a domain attempt, 148164562Sgshapiroifelse(_LDAP_ROUTING_, `_MUST_EXIST_', `dnl 148264562Sgshapiro# user does not exist 148390792SgshapiroR<> <> <$+> <@ $+> <$*> $: <?> < $&{addr_type} > < $1 > 148490792Sgshapiro# only give error for envelope recipient 148590792SgshapiroR<?> <e r> <$+> $#error $@ nouser $: "550 User unknown" 148690792SgshapiroR<?> <$*> <$+> $@ $2', 148764562Sgshapiro`dnl 148864562Sgshapiro# return the original address 148990792SgshapiroR<> <> <$+> <@ $+> <$*> $@ $1')', 149064562Sgshapiro`dnl') 149164562Sgshapiro 149264562Sgshapiroifelse(substr(confDELIVERY_MODE,0,1), `d', `errprint(`WARNING: Antispam rules not available in deferred delivery mode. 149364562Sgshapiro')') 149490792Sgshapiroifdef(`_ACCESS_TABLE_', `dnl', `divert(-1)') 149538032Speter###################################################################### 149690792Sgshapiro### D: LookUpDomain -- search for domain in access database 149738032Speter### 149838032Speter### Parameters: 149938032Speter### <$1> -- key (domain name) 150038032Speter### <$2> -- default (what to return if not found in db) 150164562Sgshapirodnl must not be empty 150290792Sgshapiro### <$3> -- mark (must be <(!|+) single-token>) 150364562Sgshapiro### ! does lookup only with tag 150464562Sgshapiro### + does lookup with and without tag 150590792Sgshapiro### <$4> -- passthru (additional data passed unchanged through) 150664562Sgshapirodnl returns: <default> <passthru> 150764562Sgshapirodnl <result> <passthru> 150838032Speter###################################################################### 150938032Speter 151090792SgshapiroSD 151164562Sgshapirodnl workspace <key> <default> <passthru> <mark> 151264562Sgshapirodnl lookup with tag (in front, no delimiter here) 151390792Sgshapirodnl 2 3 4 5 151490792SgshapiroR<$*> <$+> <$- $-> <$*> $: < $(access $4`'_TAG_DELIM_`'$1 $: ? $) > <$1> <$2> <$3 $4> <$5> 151564562Sgshapirodnl workspace <result-of-lookup|?> <key> <default> <passthru> <mark> 151664562Sgshapirodnl lookup without tag? 151790792Sgshapirodnl 1 2 3 4 151890792SgshapiroR<?> <$+> <$+> <+ $-> <$*> $: < $(access $1 $: ? $) > <$1> <$2> <+ $3> <$4> 151990792Sgshapiroifdef(`_LOOKUPDOTDOMAIN_', `dnl omit first component: lookup .rest 152090792Sgshapirodnl XXX apply this also to IP addresses? 152190792Sgshapirodnl currently it works the wrong way round for [1.2.3.4] 152290792Sgshapirodnl 1 2 3 4 5 6 152390792SgshapiroR<?> <$+.$+> <$+> <$- $-> <$*> $: < $(access $5`'_TAG_DELIM_`'.$2 $: ? $) > <$1.$2> <$3> <$4 $5> <$6> 152490792Sgshapirodnl 1 2 3 4 5 152590792SgshapiroR<?> <$+.$+> <$+> <+ $-> <$*> $: < $(access .$2 $: ? $) > <$1.$2> <$3> <+ $4> <$5>', `dnl') 152690792Sgshapiroifdef(`_ACCESS_SKIP_', `dnl 152790792Sgshapirodnl found SKIP: return <default> and <passthru> 152890792Sgshapirodnl 1 2 3 4 5 152990792SgshapiroR<SKIP> <$+> <$+> <$- $-> <$*> $@ <$2> <$5>', `dnl') 153090792Sgshapirodnl not found: IPv4 net (no check is done whether it is an IP number!) 153190792Sgshapirodnl 1 2 3 4 5 6 153290792SgshapiroR<?> <[$+.$-]> <$+> <$- $-> <$*> $@ $>D <[$1]> <$3> <$4 $5> <$6> 153390792Sgshapiroifdef(`NO_NETINET6', `dnl', 153490792Sgshapiro`dnl not found: IPv6 net 153590792Sgshapirodnl (could be merged with previous rule if we have a class containing .:) 153690792Sgshapirodnl 1 2 3 4 5 6 153790792SgshapiroR<?> <[$+::$-]> <$+> <$- $-> <$*> $: $>D <[$1]> <$3> <$4 $5> <$6> 153890792SgshapiroR<?> <[$+:$-]> <$+> <$- $-> <$*> $: $>D <[$1]> <$3> <$4 $5> <$6>') 153964562Sgshapirodnl not found, but subdomain: try again 154090792Sgshapirodnl 1 2 3 4 5 6 154190792SgshapiroR<?> <$+.$+> <$+> <$- $-> <$*> $@ $>D <$2> <$3> <$4 $5> <$6> 154290792Sgshapiroifdef(`_FFR_LOOKUPTAG_', `dnl lookup Tag: 154390792Sgshapirodnl 1 2 3 4 154490792SgshapiroR<?> <$+> <$+> <! $-> <$*> $: < $(access $3`'_TAG_DELIM_ $: ? $) > <$1> <$2> <! $3> <$4>', `dnl') 154590792Sgshapirodnl not found, no subdomain: return <default> and <passthru> 154690792Sgshapirodnl 1 2 3 4 5 154790792SgshapiroR<?> <$+> <$+> <$- $-> <$*> $@ <$2> <$5> 154890792Sgshapiroifdef(`_ATMPF_', `dnl tempfail? 154990792Sgshapirodnl 2 3 4 5 6 155090792SgshapiroR<$* _ATMPF_> <$+> <$+> <$- $-> <$*> $@ <_ATMPF_> <$6>', `dnl') 155190792Sgshapirodnl return <result of lookup> and <passthru> 155290792Sgshapirodnl 2 3 4 5 6 155390792SgshapiroR<$*> <$+> <$+> <$- $-> <$*> $@ <$1> <$6> 155438032Speter 155538032Speter###################################################################### 155690792Sgshapiro### A: LookUpAddress -- search for host address in access database 155738032Speter### 155838032Speter### Parameters: 155938032Speter### <$1> -- key (dot quadded host address) 156038032Speter### <$2> -- default (what to return if not found in db) 156164562Sgshapirodnl must not be empty 156290792Sgshapiro### <$3> -- mark (must be <(!|+) single-token>) 156364562Sgshapiro### ! does lookup only with tag 156464562Sgshapiro### + does lookup with and without tag 156590792Sgshapiro### <$4> -- passthru (additional data passed through) 156664562Sgshapirodnl returns: <default> <passthru> 156764562Sgshapirodnl <result> <passthru> 156838032Speter###################################################################### 156938032Speter 157090792SgshapiroSA 157164562Sgshapirodnl lookup with tag 157290792Sgshapirodnl 2 3 4 5 157390792SgshapiroR<$+> <$+> <$- $-> <$*> $: < $(access $4`'_TAG_DELIM_`'$1 $: ? $) > <$1> <$2> <$3 $4> <$5> 157464562Sgshapirodnl lookup without tag 157590792Sgshapirodnl 1 2 3 4 157690792SgshapiroR<?> <$+> <$+> <+ $-> <$*> $: < $(access $1 $: ? $) > <$1> <$2> <+ $3> <$4> 157790792Sgshapirodnl workspace <result-of-lookup|?> <key> <default> <mark> <passthru> 157890792Sgshapiroifdef(`_ACCESS_SKIP_', `dnl 157990792Sgshapirodnl found SKIP: return <default> and <passthru> 158090792Sgshapirodnl 1 2 3 4 5 158190792SgshapiroR<SKIP> <$+> <$+> <$- $-> <$*> $@ <$2> <$5>', `dnl') 158290792Sgshapiroifdef(`NO_NETINET6', `dnl', 158390792Sgshapiro`dnl no match; IPv6: remove last part 158490792Sgshapirodnl 1 2 3 4 5 6 158590792SgshapiroR<?> <$+::$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6> 158690792SgshapiroR<?> <$+:$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6>') 158764562Sgshapirodnl no match; IPv4: remove last part 158890792Sgshapirodnl 1 2 3 4 5 6 158990792SgshapiroR<?> <$+.$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6> 159064562Sgshapirodnl no match: return default 159190792Sgshapirodnl 1 2 3 4 5 159290792SgshapiroR<?> <$+> <$+> <$- $-> <$*> $@ <$2> <$5> 159390792Sgshapiroifdef(`_ATMPF_', `dnl tempfail? 159490792Sgshapirodnl 2 3 4 5 6 159590792SgshapiroR<$* _ATMPF_> <$+> <$+> <$- $-> <$*> $@ <_ATMPF_> <$6>', `dnl') 159664562Sgshapirodnl match: return result 159790792Sgshapirodnl 2 3 4 5 6 159890792SgshapiroR<$*> <$+> <$+> <$- $-> <$*> $@ <$1> <$6> 159990792Sgshapirodnl endif _ACCESS_TABLE_ 160090792Sgshapirodivert(0) 160138032Speter###################################################################### 160242575Speter### CanonAddr -- Convert an address into a standard form for 160342575Speter### relay checking. Route address syntax is 160442575Speter### crudely converted into a %-hack address. 160542575Speter### 160642575Speter### Parameters: 160742575Speter### $1 -- full recipient address 160842575Speter### 160942575Speter### Returns: 161042575Speter### parsed address, not in source route form 161164562Sgshapirodnl user%host%host<@domain> 161264562Sgshapirodnl host!user<@domain> 161342575Speter###################################################################### 161442575Speter 161542575SpeterSCanonAddr 161664562SgshapiroR$* $: $>Parse0 $>canonify $1 make domain canonical 161764562Sgshapiroifdef(`_USE_DEPRECATED_ROUTE_ADDR_',`dnl 161842575SpeterR< @ $+ > : $* @ $* < @ $1 > : $2 % $3 change @ to % in src route 161942575SpeterR$* < @ $+ > : $* : $* $3 $1 < @ $2 > : $4 change to % hack. 162042575SpeterR$* < @ $+ > : $* $3 $1 < @ $2 > 162164562Sgshapirodnl') 162242575Speter 162342575Speter###################################################################### 162438032Speter### ParseRecipient -- Strip off hosts in $=R as well as possibly 162538032Speter### $* $=m or the access database. 162638032Speter### Check user portion for host separators. 162738032Speter### 162838032Speter### Parameters: 162938032Speter### $1 -- full recipient address 163038032Speter### 163138032Speter### Returns: 163238032Speter### parsed, non-local-relaying address 163338032Speter###################################################################### 163438032Speter 163538032SpeterSParseRecipient 163664562Sgshapirodnl mark and canonify address 163742575SpeterR$* $: <?> $>CanonAddr $1 163864562Sgshapirodnl workspace: <?> localpart<@domain[.]> 163942575SpeterR<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots 164064562Sgshapirodnl workspace: <?> localpart<@domain> 164142575SpeterR<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part 164238032Speter 164338032Speter# if no $=O character, no host in the user portion, we are done 164442575SpeterR<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4> 164564562Sgshapirodnl no $=O in localpart: return 164642575SpeterR<?> $* $@ $1 164738032Speter 164890792Sgshapirodnl workspace: <NO> localpart<@domain>, where localpart contains $=O 164964562Sgshapirodnl mark everything which has an "authorized" domain with <RELAY> 165038032Speterifdef(`_RELAY_ENTIRE_DOMAIN_', `dnl 165138032Speter# if we relay, check username portion for user%host so host can be checked also 165242575SpeterR<NO> $* < @ $* $=m > $: <RELAY> $1 < @ $2 $3 >', `dnl') 165364562Sgshapirodnl workspace: <(NO|RELAY)> localpart<@domain>, where localpart contains $=O 165464562Sgshapirodnl if mark is <NO> then change it to <RELAY> if domain is "authorized" 165590792Sgshapiro 165690792Sgshapirodnl what if access map returns something else than RELAY? 165790792Sgshapirodnl we are only interested in RELAY entries... 165890792Sgshapirodnl other To: entries: blacklist recipient; generic entries? 165990792Sgshapirodnl if it is an error we probably do not want to relay anyway 166038032Speterifdef(`_RELAY_HOSTS_ONLY_', 166142575Speter`R<NO> $* < @ $=R > $: <RELAY> $1 < @ $2 > 166264562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 166364562SgshapiroR<NO> $* < @ $+ > $: <$(access To:$2 $: NO $)> $1 < @ $2 > 166442575SpeterR<NO> $* < @ $+ > $: <$(access $2 $: NO $)> $1 < @ $2 >',`dnl')', 166542575Speter`R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 > 166664562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 166790792SgshapiroR<NO> $* < @ $+ > $: $>D <$2> <NO> <+ To> <$1 < @ $2 >> 166842575SpeterR<$+> <$+> $: <$1> $2',`dnl')') 166938032Speter 167064562Sgshapiro 167190792Sgshapiroifdef(`_RELAY_MX_SERVED_', `dnl 167290792Sgshapirodnl do "we" ($=w) act as backup MX server for the destination domain? 167390792SgshapiroR<NO> $* < @ $+ > $: <MX> < : $(mxserved $2 $) : > < $1 < @$2 > > 167490792SgshapiroR<MX> < : $* <TEMP> : > $* $#TEMP $@ 4.7.1 $: "450 Can not check MX records for recipient host " $1 167590792Sgshapirodnl yes: mark it as <RELAY> 167690792SgshapiroR<MX> < $* : $=w. : $* > < $+ > $: <RELAY> $4 167790792Sgshapirodnl no: put old <NO> mark back 167890792SgshapiroR<MX> < : $* : > < $+ > $: <NO> $2', `dnl') 167990792Sgshapiro 168090792Sgshapirodnl do we relay to this recipient domain? 168142575SpeterR<RELAY> $* < @ $* > $@ $>ParseRecipient $1 168290792Sgshapirodnl something else 168390792SgshapiroR<$+> $* $@ $2 168442575Speter 168564562Sgshapiro 168638032Speter###################################################################### 168738032Speter### check_relay -- check hostname/address on SMTP startup 168838032Speter###################################################################### 168938032Speter 169038032SpeterSLocal_check_relay 169164562SgshapiroScheck`'_U_`'relay 169238032SpeterR$* $: $1 $| $>"Local_check_relay" $1 169338032SpeterR$* $| $* $| $#$* $#$3 169438032SpeterR$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2 169538032Speter 169638032SpeterSBasic_check_relay 169738032Speter# check for deferred delivery mode 169898121SgshapiroR$* $: < $&{deliveryMode} > $1 169938032SpeterR< d > $* $@ deferred 170038032SpeterR< $* > $* $: $2 170138032Speter 170264562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 170366494Sgshapirodnl workspace: {client_name} $| {client_addr} 170490792SgshapiroR$+ $| $+ $: $>D < $1 > <?> <+ Connect> < $2 > 170566494Sgshapirodnl workspace: <result-of-lookup> <{client_addr}> 1706110560Sgshapirodnl OR $| $+ if client_name is empty 1707110560SgshapiroR $| $+ $: $>A < $1 > <?> <+ Connect> <> empty client_name 1708110560Sgshapirodnl workspace: <result-of-lookup> <{client_addr}> 170990792SgshapiroR<?> <$+> $: $>A < $1 > <?> <+ Connect> <> no: another lookup 171090792Sgshapirodnl workspace: <result-of-lookup> (<>|<{client_addr}>) 171190792SgshapiroR<?> <$*> $: OK found nothing 171290792Sgshapirodnl workspace: <result-of-lookup> (<>|<{client_addr}>) | OK 171390792SgshapiroR<$={Accept}> <$*> $@ $1 return value of lookup 171490792SgshapiroR<REJECT> <$*> $#error ifdef(`confREJECT_MSG', `$: "confREJECT_MSG"', `$@ 5.7.1 $: "550 Access denied"') 171590792SgshapiroR<DISCARD> <$*> $#discard $: discard 171690792Sgshapiroifdef(`_FFR_QUARANTINE', 171790792Sgshapiro`R<QUARANTINE:$+> <$*> $#error $@ quarantine $: $1', `dnl') 171864562Sgshapirodnl error tag 171966494SgshapiroR<ERROR:$-.$-.$-:$+> <$*> $#error $@ $1.$2.$3 $: $4 172066494SgshapiroR<ERROR:$+> <$*> $#error $: $1 172190792Sgshapiroifdef(`_ATMPF_', `R<$* _ATMPF_> <$*> $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 172264562Sgshapirodnl generic error from access map 172366494SgshapiroR<$+> <$*> $#error $: $1', `dnl') 172438032Speter 172564562Sgshapiroifdef(`_RBL_',`dnl 172664562Sgshapiro# DNS based IP address spam list 172790792Sgshapirodnl workspace: ignored... 172838032SpeterR$* $: $&{client_addr} 172964562SgshapiroR$-.$-.$-.$- $: <?> $(host $4.$3.$2.$1._RBL_. $: OK $) 173064562SgshapiroR<?>OK $: OKSOFAR 173198121SgshapiroR<?>$+ $#error $@ 5.7.1 $: "550 Rejected: " $&{client_addr} " listed at _RBL_"', 173238032Speter`dnl') 173364562Sgshapiroundivert(8) 173438032Speter 173538032Speter###################################################################### 173638032Speter### check_mail -- check SMTP ``MAIL FROM:'' command argument 173738032Speter###################################################################### 173838032Speter 173938032SpeterSLocal_check_mail 174064562SgshapiroScheck`'_U_`'mail 174138032SpeterR$* $: $1 $| $>"Local_check_mail" $1 174238032SpeterR$* $| $#$* $#$2 174338032SpeterR$* $| $* $@ $>"Basic_check_mail" $1 174438032Speter 174538032SpeterSBasic_check_mail 174638032Speter# check for deferred delivery mode 174798121SgshapiroR$* $: < $&{deliveryMode} > $1 174838032SpeterR< d > $* $@ deferred 174938032SpeterR< $* > $* $: $2 175038032Speter 175164562Sgshapiro# authenticated? 175264562Sgshapirodnl done first: we can require authentication for every mail transaction 175364562Sgshapirodnl workspace: address as given by MAIL FROM: (sender) 175464562SgshapiroR$* $: $1 $| $>"tls_client" $&{verify} $| MAIL 175564562SgshapiroR$* $| $#$+ $#$2 175664562Sgshapirodnl undo damage: remove result of tls_client call 175764562SgshapiroR$* $| $* $: $1 175838032Speter 175964562Sgshapirodnl workspace: address as given by MAIL FROM: 176064562SgshapiroR<> $@ <OK> we MUST accept <> (RFC 1123) 176138032Speterifdef(`_ACCEPT_UNQUALIFIED_SENDERS_',`dnl',`dnl 176264562Sgshapirodnl do some additional checks 176364562Sgshapirodnl no user@host 176464562Sgshapirodnl no user@localhost (if nonlocal sender) 176564562Sgshapirodnl this is a pretty simple canonification, it will not catch every case 176664562Sgshapirodnl just make sure the address has <> around it (which is required by 176764562Sgshapirodnl the RFC anyway, maybe we should complain if they are missing...) 176864562Sgshapirodnl dirty trick: if it is user@host, just add a dot: user@host. this will 176964562Sgshapirodnl not be modified by host lookups. 177064562SgshapiroR$+ $: <?> $1 177164562SgshapiroR<?><$+> $: <@> <$1> 177264562SgshapiroR<?>$+ $: <@> <$1> 177364562Sgshapirodnl workspace: <@> <address> 177464562Sgshapirodnl prepend daemon_flags 177564562SgshapiroR$* $: $&{daemon_flags} $| $1 177664562Sgshapirodnl workspace: ${daemon_flags} $| <@> <address> 177764562Sgshapirodnl do not allow these at all or only from local systems? 177864562SgshapiroR$* f $* $| <@> < $* @ $- > $: < ? $&{client_name} > < $3 @ $4 > 177964562Sgshapirodnl accept unqualified sender: change mark to avoid test 178064562SgshapiroR$* u $* $| <@> < $* > $: <?> < $3 > 178164562Sgshapirodnl workspace: ${daemon_flags} $| <@> <address> 178264562Sgshapirodnl or: <? ${client_name} > <address> 178364562Sgshapirodnl or: <?> <address> 178464562Sgshapirodnl remove daemon_flags 178564562SgshapiroR$* $| $* $: $2 178638032Speter# handle case of @localhost on address 178764562SgshapiroR<@> < $* @ localhost > $: < ? $&{client_name} > < $1 @ localhost > 178864562SgshapiroR<@> < $* @ [127.0.0.1] > 178964562Sgshapiro $: < ? $&{client_name} > < $1 @ [127.0.0.1] > 179064562SgshapiroR<@> < $* @ localhost.$m > 179164562Sgshapiro $: < ? $&{client_name} > < $1 @ localhost.$m > 179238032Speterifdef(`_NO_UUCP_', `dnl', 179364562Sgshapiro`R<@> < $* @ localhost.UUCP > 179464562Sgshapiro $: < ? $&{client_name} > < $1 @ localhost.UUCP >') 179564562Sgshapirodnl workspace: < ? $&{client_name} > <user@localhost|host> 179664562Sgshapirodnl or: <@> <address> 179764562Sgshapirodnl or: <?> <address> (thanks to u in ${daemon_flags}) 179864562SgshapiroR<@> $* $: $1 no localhost as domain 179964562Sgshapirodnl workspace: < ? $&{client_name} > <user@localhost|host> 180064562Sgshapirodnl or: <address> 180164562Sgshapirodnl or: <?> <address> (thanks to u in ${daemon_flags}) 180264562SgshapiroR<? $=w> $* $: $2 local client: ok 180390792SgshapiroR<? $+> <$+> $#error $@ 5.5.4 $: "_CODE553 Real domain name required for sender address" 180464562Sgshapirodnl remove <?> (happens only if ${client_name} == "" or u in ${daemon_flags}) 180564562SgshapiroR<?> $* $: $1') 180664562Sgshapirodnl workspace: address (or <address>) 180764562SgshapiroR$* $: <?> $>CanonAddr $1 canonify sender address and mark it 180864562Sgshapirodnl workspace: <?> CanonicalAddress (i.e. address in canonical form localpart<@host>) 180964562Sgshapirodnl there is nothing behind the <@host> so no trailing $* needed 181064562SgshapiroR<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots 181164562Sgshapiro# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc) 1812102528SgshapiroR<?> $* < @ $* $=P > $: <_RES_OK_> $1 < @ $2 $3 > 181364562Sgshapirodnl workspace <mark> CanonicalAddress where mark is ? or OK 181498121Sgshapirodnl A sender address with my local host name ($j) is safe 1815102528SgshapiroR<?> $* < @ $j > $: <_RES_OK_> $1 < @ $j > 181664562Sgshapiroifdef(`_ACCEPT_UNRESOLVABLE_DOMAINS_', 181790792Sgshapiro`R<?> $* < @ $+ > $: <_RES_OK_> $1 < @ $2 > ... unresolvable OK', 181864562Sgshapiro`R<?> $* < @ $+ > $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > 181964562SgshapiroR<? $* <$->> $* < @ $+ > 182064562Sgshapiro $: <$2> $3 < @ $4 >') 182190792Sgshapirodnl workspace <mark> CanonicalAddress where mark is ?, _RES_OK_, PERM, TEMP 182264562Sgshapirodnl mark is ? iff the address is user (wo @domain) 182338032Speter 182464562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 182564562Sgshapiro# check sender address: user@address, user@, address 182664562Sgshapirodnl should we remove +ext from user? 182790792Sgshapirodnl workspace: <mark> CanonicalAddress where mark is: ?, _RES_OK_, PERM, TEMP 182890792SgshapiroR<$+> $+ < @ $* > $: @<$1> <$2 < @ $3 >> $| <F:$2@$3> <U:$2@> <D:$3> 182964562SgshapiroR<$+> $+ $: @<$1> <$2> $| <U:$2@> 183064562Sgshapirodnl workspace: @<mark> <CanonicalAddress> $| <@type:address> .... 183164562Sgshapirodnl $| is used as delimiter, otherwise false matches may occur: <user<@domain>> 183264562Sgshapirodnl will only return user<@domain when "reversing" the args 183390792SgshapiroR@ <$+> <$*> $| <$+> $: <@> <$1> <$2> $| $>SearchList <+ From> $| <$3> <> 183464562Sgshapirodnl workspace: <@><mark> <CanonicalAddress> $| <result> 183564562SgshapiroR<@> <$+> <$*> $| <$*> $: <$3> <$1> <$2> reverse result 183664562Sgshapirodnl workspace: <result> <mark> <CanonicalAddress> 183738032Speter# retransform for further use 183864562Sgshapirodnl required form: 183964562Sgshapirodnl <ResultOfLookup|mark> CanonicalAddress 184064562SgshapiroR<?> <$+> <$*> $: <$1> $2 no match 184164562SgshapiroR<$+> <$+> <$*> $: <$1> $3 relevant result, keep it', `dnl') 184264562Sgshapirodnl workspace <ResultOfLookup|mark> CanonicalAddress 184364562Sgshapirodnl mark is ? iff the address is user (wo @domain) 184438032Speter 184538032Speterifdef(`_ACCEPT_UNQUALIFIED_SENDERS_',`dnl',`dnl 184638032Speter# handle case of no @domain on address 184764562Sgshapirodnl prepend daemon_flags 184864562SgshapiroR<?> $* $: $&{daemon_flags} $| <?> $1 184964562Sgshapirodnl accept unqualified sender: change mark to avoid test 185090792SgshapiroR$* u $* $| <?> $* $: <_RES_OK_> $3 185164562Sgshapirodnl remove daemon_flags 185264562SgshapiroR$* $| $* $: $2 1853110560SgshapiroR<?> $* $: < ? $&{client_addr} > $1 1854102528SgshapiroR<?> $* $@ <_RES_OK_> ...local unqualed ok 185590792SgshapiroR<? $+> $* $#error $@ 5.5.4 $: "_CODE553 Domain name required for sender address " $&f 185638032Speter ...remote is not') 185738032Speter# check results 185864562SgshapiroR<?> $* $: @ $1 mark address: nothing known about it 185990792SgshapiroR<$={ResOk}> $* $@ <_RES_OK_> domain ok: stop 186064562SgshapiroR<TEMP> $* $#error $@ 4.1.8 $: "451 Domain of sender address " $&f " does not resolve" 186190792SgshapiroR<PERM> $* $#error $@ 5.1.8 $: "_CODE553 Domain of sender address " $&f " does not exist" 186264562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 186390792SgshapiroR<$={Accept}> $* $# $1 accept from access map 186438032SpeterR<DISCARD> $* $#discard $: discard 186590792Sgshapiroifdef(`_FFR_QUARANTINE', 186690792Sgshapiro`R<QUARANTINE:$+> $* $#error $@ quarantine $: $1', `dnl') 186764562SgshapiroR<REJECT> $* $#error ifdef(`confREJECT_MSG', `$: "confREJECT_MSG"', `$@ 5.7.1 $: "550 Access denied"') 186864562Sgshapirodnl error tag 186964562SgshapiroR<ERROR:$-.$-.$-:$+> $* $#error $@ $1.$2.$3 $: $4 187064562SgshapiroR<ERROR:$+> $* $#error $: $1 187190792Sgshapiroifdef(`_ATMPF_', `R<_ATMPF_> $* $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 187264562Sgshapirodnl generic error from access map 187364562SgshapiroR<$+> $* $#error $: $1 error from access db', 187438032Speter`dnl') 187538032Speter 187638032Speter###################################################################### 187738032Speter### check_rcpt -- check SMTP ``RCPT TO:'' command argument 187838032Speter###################################################################### 187938032Speter 188038032SpeterSLocal_check_rcpt 188164562SgshapiroScheck`'_U_`'rcpt 188238032SpeterR$* $: $1 $| $>"Local_check_rcpt" $1 188338032SpeterR$* $| $#$* $#$2 188438032SpeterR$* $| $* $@ $>"Basic_check_rcpt" $1 188538032Speter 188638032SpeterSBasic_check_rcpt 188790792Sgshapiro# empty address? 188890792SgshapiroR<> $#error $@ nouser $: "553 User address required" 188990792SgshapiroR$@ $#error $@ nouser $: "553 User address required" 189038032Speter# check for deferred delivery mode 189198121SgshapiroR$* $: < $&{deliveryMode} > $1 189238032SpeterR< d > $* $@ deferred 189338032SpeterR< $* > $* $: $2 189438032Speter 189564562Sgshapiroifdef(`_REQUIRE_QUAL_RCPT_', `dnl 189690792Sgshapirodnl this code checks for user@host where host is not a FQHN. 189790792Sgshapirodnl it is not activated. 189890792Sgshapirodnl notice: code to check for a recipient without a domain name is 189990792Sgshapirodnl available down below; look for the same macro. 190090792Sgshapirodnl this check is done here because the name might be qualified by the 190190792Sgshapirodnl canonicalization. 190290792Sgshapiro# require fully qualified domain part? 190390792Sgshapirodnl very simple canonification: make sure the address is in < > 190464562SgshapiroR$+ $: <?> $1 190590792SgshapiroR<?> <$+> $: <@> <$1> 190690792SgshapiroR<?> $+ $: <@> <$1> 190790792SgshapiroR<@> < postmaster > $: postmaster 1908110560SgshapiroR<@> < $* @ $+ . $+ > $: < $1 @ $2 . $3 > 190964562Sgshapirodnl prepend daemon_flags 191090792SgshapiroR<@> $* $: $&{daemon_flags} $| <@> $1 191164562Sgshapirodnl workspace: ${daemon_flags} $| <@> <address> 191264562Sgshapirodnl do not allow these at all or only from local systems? 191390792SgshapiroR$* r $* $| <@> < $* @ $* > $: < ? $&{client_name} > < $3 @ $4 > 191464562SgshapiroR<?> < $* > $: <$1> 191564562SgshapiroR<? $=w> < $* > $: <$1> 191690792SgshapiroR<? $+> <$+> $#error $@ 5.5.4 $: "553 Fully qualified domain name required" 191764562Sgshapirodnl remove daemon_flags for other cases 191864562SgshapiroR$* $| <@> $* $: $2', `dnl') 191964562Sgshapiro 192090792Sgshapirodnl ################################################################## 192190792Sgshapirodnl call subroutines for recipient and relay 192290792Sgshapirodnl possible returns from subroutines: 192390792Sgshapirodnl $#TEMP temporary failure 192490792Sgshapirodnl $#error permanent failure (or temporary if from access map) 192590792Sgshapirodnl $#other stop processing 192690792Sgshapirodnl RELAY RELAYing allowed 192790792Sgshapirodnl other otherwise 192890792Sgshapiro###################################################################### 192990792SgshapiroR$* $: $1 $| @ $>"Rcpt_ok" $1 193090792Sgshapirodnl temporary failure? remove mark @ and remember 193190792SgshapiroR$* $| @ $#TEMP $+ $: $1 $| T $2 193290792Sgshapirodnl error or ok (stop) 193390792SgshapiroR$* $| @ $#$* $#$2 193490792Sgshapiroifdef(`_PROMISCUOUS_RELAY_', `divert(-1)', `dnl') 193590792SgshapiroR$* $| @ RELAY $@ RELAY 193690792Sgshapirodnl something else: call check sender (relay) 193790792SgshapiroR$* $| @ $* $: O $| $>"Relay_ok" $1 193890792Sgshapirodnl temporary failure: call check sender (relay) 193990792SgshapiroR$* $| T $+ $: T $2 $| $>"Relay_ok" $1 194090792Sgshapirodnl temporary failure? return that 194190792SgshapiroR$* $| $#TEMP $+ $#error $2 194290792Sgshapirodnl error or ok (stop) 194390792SgshapiroR$* $| $#$* $#$2 194490792SgshapiroR$* $| RELAY $@ RELAY 194590792Sgshapirodnl something else: return previous temp failure 194690792SgshapiroR T $+ $| $* $#error $1 194790792Sgshapiro# anything else is bogus 194890792SgshapiroR$* $#error $@ 5.7.1 $: confRELAY_MSG 194990792Sgshapirodivert(0) 195090792Sgshapiro 195190792Sgshapiro###################################################################### 195290792Sgshapiro### Rcpt_ok: is the recipient ok? 195390792Sgshapirodnl input: recipient address (RCPT TO) 195490792Sgshapirodnl output: see explanation at call 195590792Sgshapiro###################################################################### 195690792SgshapiroSRcpt_ok 195738032Speterifdef(`_LOOSE_RELAY_CHECK_',`dnl 195842575SpeterR$* $: $>CanonAddr $1 195938032SpeterR$* < @ $* . > $1 < @ $2 > strip trailing dots', 196038032Speter`R$* $: $>ParseRecipient $1 strip relayable hosts') 196138032Speter 196242575Speterifdef(`_BESTMX_IS_LOCAL_',`dnl 196342575Speterifelse(_BESTMX_IS_LOCAL_, `', `dnl 196442575Speter# unlimited bestmx 196542575SpeterR$* < @ $* > $* $: $1 < @ $2 @@ $(bestmx $2 $) > $3', 196642575Speter`dnl 196742575Speter# limit bestmx to $=B 196843730SpeterR$* < @ $* $=B > $* $: $1 < @ $2 $3 @@ $(bestmx $2 $3 $) > $4') 196990792SgshapiroR$* $=O $* < @ $* @@ $=w . > $* $@ $>"Rcpt_ok" $1 $2 $3 197042575SpeterR$* < @ $* @@ $=w . > $* $: $1 < @ $3 > $4 197142575SpeterR$* < @ $* @@ $* > $* $: $1 < @ $2 > $4') 197242575Speter 197338032Speterifdef(`_BLACKLIST_RCPT_',`dnl 197464562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 197538032Speter# blacklist local users or any host from receiving mail 197638032SpeterR$* $: <?> $1 197764562Sgshapirodnl user is now tagged with @ to be consistent with check_mail 197864562Sgshapirodnl and to distinguish users from hosts (com would be host, com@ would be user) 197990792SgshapiroR<?> $+ < @ $=w > $: <> <$1 < @ $2 >> $| <F:$1@$2> <U:$1@> <D:$2> 198090792SgshapiroR<?> $+ < @ $* > $: <> <$1 < @ $2 >> $| <F:$1@$2> <D:$2> 198164562SgshapiroR<?> $+ $: <> <$1> $| <U:$1@> 198264562Sgshapirodnl $| is used as delimiter, otherwise false matches may occur: <user<@domain>> 198364562Sgshapirodnl will only return user<@domain when "reversing" the args 198490792SgshapiroR<> <$*> $| <$+> $: <@> <$1> $| $>SearchList <+ To> $| <$2> <> 198564562SgshapiroR<@> <$*> $| <$*> $: <$2> <$1> reverse result 198664562SgshapiroR<?> <$*> $: @ $1 mark address as no match 198790792Sgshapirodnl we may have to filter here because otherwise some RHSs 198890792Sgshapirodnl would be interpreted as generic error messages... 198990792Sgshapirodnl error messages should be "tagged" by prefixing them with error: ! 199090792Sgshapirodnl that would make a lot of things easier. 199164562SgshapiroR<$={Accept}> <$*> $: @ $2 mark address as no match 199290792Sgshapiroifdef(`_ACCESS_SKIP_', `dnl 199390792SgshapiroR<SKIP> <$*> $: @ $1 mark address as no match', `dnl') 199490792Sgshapiroifdef(`_DELAY_COMPAT_8_10_',`dnl 199590792Sgshapirodnl compatility with 8.11/8.10: 199664562Sgshapirodnl we have to filter these because otherwise they would be interpreted 199764562Sgshapirodnl as generic error message... 199864562Sgshapirodnl error messages should be "tagged" by prefixing them with error: ! 199964562Sgshapirodnl that would make a lot of things easier. 200064562Sgshapirodnl maybe we should stop checks already here (if SPAM_xyx)? 200164562SgshapiroR<$={SpamTag}> <$*> $: @ $2 mark address as no match') 200290792SgshapiroR<REJECT> $* $#error $@ 5.2.1 $: confRCPTREJ_MSG 200364562SgshapiroR<DISCARD> $* $#discard $: discard 200490792Sgshapiroifdef(`_FFR_QUARANTINE', 200590792Sgshapiro`R<QUARANTINE:$+> $* $#error $@ quarantine $: $1', `dnl') 200664562Sgshapirodnl error tag 200764562SgshapiroR<ERROR:$-.$-.$-:$+> $* $#error $@ $1.$2.$3 $: $4 200864562SgshapiroR<ERROR:$+> $* $#error $: $1 200990792Sgshapiroifdef(`_ATMPF_', `R<_ATMPF_> $* $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 201064562Sgshapirodnl generic error from access map 201164562SgshapiroR<$+> $* $#error $: $1 error from access db 201264562SgshapiroR@ $* $1 remove mark', `dnl')', `dnl') 201338032Speter 201490792Sgshapiroifdef(`_PROMISCUOUS_RELAY_', `divert(-1)', `dnl') 201590792Sgshapiro# authenticated via TLS? 201690792SgshapiroR$* $: $1 $| $>RelayTLS client authenticated? 201790792SgshapiroR$* $| $# $+ $# $2 error/ok? 201890792SgshapiroR$* $| $* $: $1 no 201964562Sgshapiro 202090792SgshapiroR$* $: $1 $| $>"Local_Relay_Auth" $&{auth_type} 202190792Sgshapirodnl workspace: localpart<@domain> $| result of Local_Relay_Auth 202290792SgshapiroR$* $| $# $* $# $2 202390792Sgshapirodnl if Local_Relay_Auth returns NO then do not check $={TrustAuthMech} 202490792SgshapiroR$* $| NO $: $1 202590792SgshapiroR$* $| $* $: $1 $| $&{auth_type} 202690792Sgshapirodnl workspace: localpart<@domain> [ $| ${auth_type} ] 202764562Sgshapirodnl empty ${auth_type}? 202864562SgshapiroR$* $| $: $1 202964562Sgshapirodnl mechanism ${auth_type} accepted? 203064562Sgshapirodnl use $# to override further tests (delay_checks): see check_rcpt below 203190792SgshapiroR$* $| $={TrustAuthMech} $# RELAY 203290792Sgshapirodnl remove ${auth_type} 203364562SgshapiroR$* $| $* $: $1 203471345Sgshapirodnl workspace: localpart<@domain> | localpart 203564562Sgshapiroifelse(defn(`_NO_UUCP_'), `r', 203671345Sgshapiro`R$* ! $* < @ $* > $: <REMOTE> $2 < @ BANG_PATH > 203771345SgshapiroR$* ! $* $: <REMOTE> $2 < @ BANG_PATH >', `dnl') 203838032Speter# anything terminating locally is ok 203938032Speterifdef(`_RELAY_ENTIRE_DOMAIN_', `dnl 204090792SgshapiroR$+ < @ $* $=m > $@ RELAY', `dnl') 204190792SgshapiroR$+ < @ $=w > $@ RELAY 204238032Speterifdef(`_RELAY_HOSTS_ONLY_', 204390792Sgshapiro`R$+ < @ $=R > $@ RELAY 204464562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 204564562SgshapiroR$+ < @ $+ > $: <$(access To:$2 $: ? $)> <$1 < @ $2 >> 204664562Sgshapirodnl workspace: <Result-of-lookup | ?> <localpart<@domain>> 204764562SgshapiroR<?> <$+ < @ $+ >> $: <$(access $2 $: ? $)> <$1 < @ $2 >>',`dnl')', 204890792Sgshapiro`R$+ < @ $* $=R > $@ RELAY 204964562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 205090792SgshapiroR$+ < @ $+ > $: $>D <$2> <?> <+ To> <$1 < @ $2 >>',`dnl')') 205164562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 205264562Sgshapirodnl workspace: <Result-of-lookup | ?> <localpart<@domain>> 205390792SgshapiroR<RELAY> $* $@ RELAY 205490792Sgshapiroifdef(`_ATMPF_', `R<$* _ATMPF_> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 205538032SpeterR<$*> <$*> $: $2',`dnl') 205638032Speter 205764562Sgshapiro 205838032Speterifdef(`_RELAY_MX_SERVED_', `dnl 205938032Speter# allow relaying for hosts which we MX serve 206064562SgshapiroR$+ < @ $+ > $: < : $(mxserved $2 $) : > $1 < @ $2 > 206164562Sgshapirodnl this must not necessarily happen if the client is checked first... 206290792SgshapiroR< : $* <TEMP> : > $* $#TEMP $@ 4.7.1 $: "450 Can not check MX records for recipient host " $1 206390792SgshapiroR<$* : $=w . : $*> $* $@ RELAY 206442575SpeterR< : $* : > $* $: $2', 206538032Speter`dnl') 206638032Speter 206738032Speter# check for local user (i.e. unqualified address) 206838032SpeterR$* $: <?> $1 206942575SpeterR<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 > 207038032Speter# local user is ok 207164562Sgshapirodnl is it really? the standard requires user@domain, not just user 207264562Sgshapirodnl but we should accept it anyway (maybe making it an option: 207364562Sgshapirodnl RequireFQDN ?) 207464562Sgshapirodnl postmaster must be accepted without domain (DRUMS) 207564562Sgshapiroifdef(`_REQUIRE_QUAL_RCPT_', `dnl 207690792SgshapiroR<?> postmaster $@ OK 207764562Sgshapiro# require qualified recipient? 207864562Sgshapirodnl prepend daemon_flags 207964562SgshapiroR<?> $+ $: $&{daemon_flags} $| <?> $1 208064562Sgshapirodnl workspace: ${daemon_flags} $| <?> localpart 208164562Sgshapirodnl do not allow these at all or only from local systems? 208264562Sgshapirodnl r flag? add client_name 208364562SgshapiroR$* r $* $| <?> $+ $: < ? $&{client_name} > <?> $3 208464562Sgshapirodnl no r flag: relay to local user (only local part) 208564562Sgshapiro# no qualified recipient required 208690792SgshapiroR$* $| <?> $+ $@ RELAY 208764562Sgshapirodnl client_name is empty 208890792SgshapiroR<?> <?> $+ $@ RELAY 208964562Sgshapirodnl client_name is local 209090792SgshapiroR<? $=w> <?> $+ $@ RELAY 209164562Sgshapirodnl client_name is not local 209264562SgshapiroR<? $+> $+ $#error $@ 5.5.4 $: "553 Domain name required"', `dnl 209364562Sgshapirodnl no qualified recipient required 209490792SgshapiroR<?> $+ $@ RELAY') 209564562Sgshapirodnl it is a remote user: remove mark and then check client 209638032SpeterR<$+> $* $: $2 209764562Sgshapirodnl currently the recipient address is not used below 209838032Speter 209990792Sgshapiro###################################################################### 210090792Sgshapiro### Relay_ok: is the relay/sender ok? 210190792Sgshapirodnl input: ignored 210290792Sgshapirodnl output: see explanation at call 210390792Sgshapiro###################################################################### 210490792SgshapiroSRelay_ok 210538032Speter# anything originating locally is ok 210664562Sgshapiro# check IP address 210764562SgshapiroR$* $: $&{client_addr} 210890792SgshapiroR$@ $@ RELAY originated locally 210990792SgshapiroR0 $@ RELAY originated locally 2110110560SgshapiroR127.0.0.1 $@ RELAY originated locally 2111110560SgshapiroRIPv6:::1 $@ RELAY originated locally 211290792SgshapiroR$=R $* $@ RELAY relayable IP address 211364562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 211490792SgshapiroR$* $: $>A <$1> <?> <+ Connect> <$1> 211590792SgshapiroR<RELAY> $* $@ RELAY relayable IP address 2116102528Sgshapiroifdef(`_FFR_REJECT_IP_IN_CHECK_RCPT_',`dnl 2117102528Sgshapirodnl this will cause rejections in cases like: 2118102528Sgshapirodnl Connect:My.Host.Domain RELAY 2119102528Sgshapirodnl Connect:My.Net REJECT 2120102528Sgshapirodnl since in check_relay client_name is checked before client_addr 2121102528SgshapiroR<REJECT> $* $@ REJECT rejected IP address') 212290792Sgshapiroifdef(`_ATMPF_', `R<_ATMPF_> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 212364562SgshapiroR<$*> <$*> $: $2', `dnl') 212464562SgshapiroR$* $: [ $1 ] put brackets around it... 212590792SgshapiroR$=w $@ RELAY ... and see if it is local 212664562Sgshapiro 212764562Sgshapiroifdef(`_RELAY_DB_FROM_', `define(`_RELAY_MAIL_FROM_', `1')')dnl 212864562Sgshapiroifdef(`_RELAY_LOCAL_FROM_', `define(`_RELAY_MAIL_FROM_', `1')')dnl 212964562Sgshapiroifdef(`_RELAY_MAIL_FROM_', `dnl 213064562Sgshapirodnl input: {client_addr} or something "broken" 213164562Sgshapirodnl just throw the input away; we do not need it. 213264562Sgshapiro# check whether FROM is allowed to use system as relay 213364562SgshapiroR$* $: <?> $>CanonAddr $&f 213490792SgshapiroR<?> $+ < @ $+ . > <?> $1 < @ $2 > remove trailing dot 213564562Sgshapiroifdef(`_RELAY_LOCAL_FROM_', `dnl 213664562Sgshapiro# check whether local FROM is ok 213790792SgshapiroR<?> $+ < @ $=w > $@ RELAY FROM local', `dnl') 213864562Sgshapiroifdef(`_RELAY_DB_FROM_', `dnl 213994334SgshapiroR<?> $+ < @ $+ > $: <@> $>SearchList <! From> $| <F:$1@$2> ifdef(`_RELAY_DB_FROM_DOMAIN_', ifdef(`_RELAY_HOSTS_ONLY_', `<E:$2>', `<D:$2>')) <> 214090792SgshapiroR<@> <RELAY> $@ RELAY RELAY FROM sender ok 214190792Sgshapiroifdef(`_ATMPF_', `R<@> <_ATMPF_> $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 214290792Sgshapiro', `dnl 214390792Sgshapiroifdef(`_RELAY_DB_FROM_DOMAIN_', 214490792Sgshapiro`errprint(`*** ERROR: _RELAY_DB_FROM_DOMAIN_ requires _RELAY_DB_FROM_ 214564562Sgshapiro')', 214664562Sgshapiro`dnl') 214764562Sgshapirodnl')', `dnl') 214890792Sgshapirodnl notice: the rulesets above do not leave a unique workspace behind. 214990792Sgshapirodnl it does not matter in this case because the following rule ignores 215090792Sgshapirodnl the input. otherwise these rules must "clean up" the workspace. 215164562Sgshapiro 215264562Sgshapiro# check client name: first: did it resolve? 215364562Sgshapirodnl input: ignored 215464562SgshapiroR$* $: < $&{client_resolve} > 215590792SgshapiroR<TEMP> $#TEMP $@ 4.7.1 $: "450 Relaying temporarily denied. Cannot resolve PTR record for " $&{client_addr} 215664562SgshapiroR<FORGED> $#error $@ 5.7.1 $: "550 Relaying denied. IP name possibly forged " $&{client_name} 215764562SgshapiroR<FAIL> $#error $@ 5.7.1 $: "550 Relaying denied. IP name lookup failed " $&{client_name} 215864562Sgshapirodnl ${client_resolve} should be OK, so go ahead 215990792SgshapiroR$* $: <@> $&{client_name} 216090792Sgshapirodnl should not be necessary since it has been done for client_addr already 2161110560Sgshapirodnl this rule actually may cause a problem if {client_name} resolves to "" 2162110560Sgshapirodnl however, this should not happen since the forward lookup should fail 2163110560Sgshapirodnl and {client_resolve} should be TEMP or FAIL. 2164110560Sgshapirodnl nevertheless, removing the rule doesn't hurt. 2165110560Sgshapirodnl R<@> $@ RELAY 216690792Sgshapirodnl workspace: <@> ${client_name} (not empty) 216738032Speter# pass to name server to make hostname canonical 216890792SgshapiroR<@> $* $=P $:<?> $1 $2 216990792SgshapiroR<@> $+ $:<?> $[ $1 $] 217090792Sgshapirodnl workspace: <?> ${client_name} (canonified) 217164562SgshapiroR$* . $1 strip trailing dots 217238032Speterifdef(`_RELAY_ENTIRE_DOMAIN_', `dnl 217390792SgshapiroR<?> $* $=m $@ RELAY', `dnl') 217490792SgshapiroR<?> $=w $@ RELAY 217538032Speterifdef(`_RELAY_HOSTS_ONLY_', 217690792Sgshapiro`R<?> $=R $@ RELAY 217764562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 217864562SgshapiroR<?> $* $: <$(access Connect:$1 $: ? $)> <$1> 217964562SgshapiroR<?> <$*> $: <$(access $1 $: ? $)> <$1>',`dnl')', 218090792Sgshapiro`R<?> $* $=R $@ RELAY 218164562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 218290792SgshapiroR<?> $* $: $>D <$1> <?> <+ Connect> <$1>',`dnl')') 218364562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 218490792SgshapiroR<RELAY> $* $@ RELAY 218590792Sgshapiroifdef(`_ATMPF_', `R<$* _ATMPF_> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 218638032SpeterR<$*> <$*> $: $2',`dnl') 218790792Sgshapirodnl end of _PROMISCUOUS_RELAY_ 218864562Sgshapirodivert(0) 218964562Sgshapiroifdef(`_DELAY_CHECKS_',`dnl 219064562Sgshapiro# turn a canonical address in the form user<@domain> 219164562Sgshapiro# qualify unqual. addresses with $j 219264562Sgshapirodnl it might have been only user (without <@domain>) 219364562SgshapiroSFullAddr 219464562SgshapiroR$* <@ $+ . > $1 <@ $2 > 219564562SgshapiroR$* <@ $* > $@ $1 <@ $2 > 219664562SgshapiroR$+ $@ $1 <@ $j > 219738032Speter 2198110560SgshapiroSDelay_TLS_Client 2199110560Sgshapiro# authenticated? 2200110560Sgshapirodnl code repeated here from Basic_check_mail 2201110560Sgshapirodnl only called from check_rcpt in delay mode if checkrcpt returns $# 2202110560SgshapiroR$* $: $1 $| $>"tls_client" $&{verify} $| MAIL 2203110560SgshapiroR$* $| $#$+ $#$2 2204110560Sgshapirodnl return result from checkrcpt 2205110560SgshapiroR$* $# $1 2206110560Sgshapiro 2207110560SgshapiroSDelay_TLS_Client2 2208110560Sgshapiro# authenticated? 2209110560Sgshapirodnl code repeated here from Basic_check_mail 2210110560Sgshapirodnl only called from check_rcpt in delay mode if stopping due to Friend/Hater 2211110560SgshapiroR$* $: $1 $| $>"tls_client" $&{verify} $| MAIL 2212110560SgshapiroR$* $| $#$+ $#$2 2213110560Sgshapirodnl return result from friend/hater check 2214110560SgshapiroR$* $@ $1 2215110560Sgshapiro 221664562Sgshapiro# call all necessary rulesets 221764562SgshapiroScheck_rcpt 221864562Sgshapirodnl this test should be in the Basic_check_rcpt ruleset 221964562Sgshapirodnl which is the correct DSN code? 222064562Sgshapiro# R$@ $#error $@ 5.1.3 $: "553 Recipient address required" 2221110560Sgshapiro 222264562SgshapiroR$+ $: $1 $| $>checkrcpt $1 222364562Sgshapirodnl now we can simply stop checks by returning "$# xyz" instead of just "ok" 2224110560Sgshapirodnl on error (or discard) stop now 2225110560SgshapiroR$+ $| $#error $* $#error $2 2226110560SgshapiroR$+ $| $#discard $* $#discard $2 2227110560Sgshapirodnl otherwise call tls_client; see above 2228110560SgshapiroR$+ $| $#$* $@ $>"Delay_TLS_Client" $2 222964562SgshapiroR$+ $| $* $: <?> $>FullAddr $>CanonAddr $1 223064562Sgshapiroifdef(`_SPAM_FH_', 223164562Sgshapiro`dnl lookup user@ and user@address 223264562Sgshapiroifdef(`_ACCESS_TABLE_', `', 223364562Sgshapiro`errprint(`*** ERROR: FEATURE(`delay_checks', `argument') requires FEATURE(`access_db') 223464562Sgshapiro')')dnl 223564562Sgshapirodnl one of the next two rules is supposed to match 223664562Sgshapirodnl this code has been copied from BLACKLIST... etc 223764562Sgshapirodnl and simplified by omitting some < >. 223890792SgshapiroR<?> $+ < @ $=w > $: <> $1 < @ $2 > $| <F: $1@$2 > <D: $2 > <U: $1@> 223990792SgshapiroR<?> $+ < @ $* > $: <> $1 < @ $2 > $| <F: $1@$2 > <D: $2 > 224064562Sgshapirodnl R<?> $@ something_is_very_wrong_here 224190792Sgshapiro# lookup the addresses only with Spam tag 224290792SgshapiroR<> $* $| <$+> $: <@> $1 $| $>SearchList <! Spam> $| <$2> <> 224364562SgshapiroR<@> $* $| $* $: $2 $1 reverse result 224464562Sgshapirodnl', `dnl') 224564562Sgshapiroifdef(`_SPAM_FRIEND_', 224664562Sgshapiro`# is the recipient a spam friend? 224764562Sgshapiroifdef(`_SPAM_HATER_', 2248110560Sgshapiro `errprint(`*** ERROR: define either Hater or Friend -- not both. 224964562Sgshapiro')', `dnl') 2250110560SgshapiroR<FRIEND> $+ $@ $>"Delay_TLS_Client2" SPAMFRIEND 225164562SgshapiroR<$*> $+ $: $2', 225264562Sgshapiro`dnl') 225364562Sgshapiroifdef(`_SPAM_HATER_', 225464562Sgshapiro`# is the recipient no spam hater? 225590792SgshapiroR<HATER> $+ $: $1 spam hater: continue checks 2256110560SgshapiroR<$*> $+ $@ $>"Delay_TLS_Client2" NOSPAMHATER everyone else: stop 225764562Sgshapirodnl',`dnl') 225864562Sgshapirodnl run further checks: check_mail 225964562Sgshapirodnl should we "clean up" $&f? 226090792Sgshapiroifdef(`_FFR_MAIL_MACRO', 226190792Sgshapiro`R$* $: $1 $| $>checkmail $&{mail_from}', 226290792Sgshapiro`R$* $: $1 $| $>checkmail <$&f>') 226394334Sgshapirodnl recipient (canonical format) $| result of checkmail 226464562SgshapiroR$* $| $#$* $#$2 226564562Sgshapirodnl run further checks: check_relay 226694334SgshapiroR$* $| $* $: $1 $| $>checkrelay $&{client_name} $| $&{client_addr} 226764562SgshapiroR$* $| $#$* $#$2 226838032SpeterR$* $| $* $: $1 226938032Speter', `dnl') 227090792Sgshapiro 227190792Sgshapiroifdef(`_ACCESS_TABLE_', `dnl', `divert(-1)') 227264562Sgshapiro###################################################################### 227390792Sgshapiro### F: LookUpFull -- search for an entry in access database 227490792Sgshapiro### 227590792Sgshapiro### lookup of full key (which should be an address) and 227690792Sgshapiro### variations if +detail exists: +* and without +detail 227790792Sgshapiro### 227890792Sgshapiro### Parameters: 227990792Sgshapiro### <$1> -- key 228090792Sgshapiro### <$2> -- default (what to return if not found in db) 228190792Sgshapirodnl must not be empty 228290792Sgshapiro### <$3> -- mark (must be <(!|+) single-token>) 228390792Sgshapiro### ! does lookup only with tag 228490792Sgshapiro### + does lookup with and without tag 228590792Sgshapiro### <$4> -- passthru (additional data passed unchanged through) 228690792Sgshapirodnl returns: <default> <passthru> 228790792Sgshapirodnl <result> <passthru> 228890792Sgshapiro###################################################################### 228990792Sgshapiro 229090792SgshapiroSF 229190792Sgshapirodnl workspace: <key> <def> <o tag> <thru> 229290792Sgshapirodnl full lookup 229390792Sgshapirodnl 2 3 4 5 229490792SgshapiroR<$+> <$*> <$- $-> <$*> $: <$(access $4`'_TAG_DELIM_`'$1 $: ? $)> <$1> <$2> <$3 $4> <$5> 229590792Sgshapirodnl no match, try without tag 229690792Sgshapirodnl 1 2 3 4 229790792SgshapiroR<?> <$+> <$*> <+ $-> <$*> $: <$(access $1 $: ? $)> <$1> <$2> <+ $3> <$4> 229890792Sgshapirodnl no match, +detail: try +* 229990792Sgshapirodnl 1 2 3 4 5 6 7 230090792SgshapiroR<?> <$+ + $* @ $+> <$*> <$- $-> <$*> 230190792Sgshapiro $: <$(access $6`'_TAG_DELIM_`'$1+*@$3 $: ? $)> <$1+$2@$3> <$4> <$5 $6> <$7> 230290792Sgshapirodnl no match, +detail: try +* without tag 230390792Sgshapirodnl 1 2 3 4 5 6 230490792SgshapiroR<?> <$+ + $* @ $+> <$*> <+ $-> <$*> 230590792Sgshapiro $: <$(access $1+*@$3 $: ? $)> <$1+$2@$3> <$4> <+ $5> <$6> 230690792Sgshapirodnl no match, +detail: try without +detail 230790792Sgshapirodnl 1 2 3 4 5 6 7 230890792SgshapiroR<?> <$+ + $* @ $+> <$*> <$- $-> <$*> 230990792Sgshapiro $: <$(access $6`'_TAG_DELIM_`'$1@$3 $: ? $)> <$1+$2@$3> <$4> <$5 $6> <$7> 231090792Sgshapirodnl no match, +detail: try without +detail and without tag 231190792Sgshapirodnl 1 2 3 4 5 6 231290792SgshapiroR<?> <$+ + $* @ $+> <$*> <+ $-> <$*> 231390792Sgshapiro $: <$(access $1@$3 $: ? $)> <$1+$2@$3> <$4> <+ $5> <$6> 231490792Sgshapirodnl no match, return <default> <passthru> 231590792Sgshapirodnl 1 2 3 4 5 231690792SgshapiroR<?> <$+> <$*> <$- $-> <$*> $@ <$2> <$5> 231790792Sgshapiroifdef(`_ATMPF_', `dnl tempfail? 231890792Sgshapirodnl 2 3 4 5 231990792SgshapiroR<$+ _ATMPF_> <$*> <$- $-> <$*> $@ <_ATMPF_> <$5>', `dnl') 232090792Sgshapirodnl match, return <match> <passthru> 232190792Sgshapirodnl 2 3 4 5 232290792SgshapiroR<$+> <$*> <$- $-> <$*> $@ <$1> <$5> 232390792Sgshapiro 232490792Sgshapiro###################################################################### 232590792Sgshapiro### E: LookUpExact -- search for an entry in access database 232690792Sgshapiro### 232790792Sgshapiro### Parameters: 232890792Sgshapiro### <$1> -- key 232990792Sgshapiro### <$2> -- default (what to return if not found in db) 233090792Sgshapirodnl must not be empty 233190792Sgshapiro### <$3> -- mark (must be <(!|+) single-token>) 233290792Sgshapiro### ! does lookup only with tag 233390792Sgshapiro### + does lookup with and without tag 233490792Sgshapiro### <$4> -- passthru (additional data passed unchanged through) 233590792Sgshapirodnl returns: <default> <passthru> 233690792Sgshapirodnl <result> <passthru> 233790792Sgshapiro###################################################################### 233890792Sgshapiro 233990792SgshapiroSE 234090792Sgshapirodnl 2 3 4 5 234190792SgshapiroR<$*> <$*> <$- $-> <$*> $: <$(access $4`'_TAG_DELIM_`'$1 $: ? $)> <$1> <$2> <$3 $4> <$5> 234290792Sgshapirodnl no match, try without tag 234390792Sgshapirodnl 1 2 3 4 234490792SgshapiroR<?> <$+> <$*> <+ $-> <$*> $: <$(access $1 $: ? $)> <$1> <$2> <+ $3> <$4> 234590792Sgshapirodnl no match, return default passthru 234690792Sgshapirodnl 1 2 3 4 5 234790792SgshapiroR<?> <$+> <$*> <$- $-> <$*> $@ <$2> <$5> 234890792Sgshapiroifdef(`_ATMPF_', `dnl tempfail? 234990792Sgshapirodnl 2 3 4 5 235090792SgshapiroR<$+ _ATMPF_> <$*> <$- $-> <$*> $@ <_ATMPF_> <$5>', `dnl') 235190792Sgshapirodnl match, return <match> <passthru> 235290792Sgshapirodnl 2 3 4 5 235390792SgshapiroR<$+> <$*> <$- $-> <$*> $@ <$1> <$5> 235490792Sgshapiro 235590792Sgshapiro###################################################################### 235690792Sgshapiro### U: LookUpUser -- search for an entry in access database 235790792Sgshapiro### 235890792Sgshapiro### lookup of key (which should be a local part) and 235990792Sgshapiro### variations if +detail exists: +* and without +detail 236090792Sgshapiro### 236190792Sgshapiro### Parameters: 236290792Sgshapiro### <$1> -- key (user@) 236390792Sgshapiro### <$2> -- default (what to return if not found in db) 236490792Sgshapirodnl must not be empty 236590792Sgshapiro### <$3> -- mark (must be <(!|+) single-token>) 236690792Sgshapiro### ! does lookup only with tag 236790792Sgshapiro### + does lookup with and without tag 236890792Sgshapiro### <$4> -- passthru (additional data passed unchanged through) 236990792Sgshapirodnl returns: <default> <passthru> 237090792Sgshapirodnl <result> <passthru> 237190792Sgshapiro###################################################################### 237290792Sgshapiro 237390792SgshapiroSU 237490792Sgshapirodnl user lookups are always with trailing @ 237590792Sgshapirodnl 2 3 4 5 237690792SgshapiroR<$+> <$*> <$- $-> <$*> $: <$(access $4`'_TAG_DELIM_`'$1 $: ? $)> <$1> <$2> <$3 $4> <$5> 237790792Sgshapirodnl no match, try without tag 237890792Sgshapirodnl 1 2 3 4 237990792SgshapiroR<?> <$+> <$*> <+ $-> <$*> $: <$(access $1 $: ? $)> <$1> <$2> <+ $3> <$4> 238090792Sgshapirodnl do not remove the @ from the lookup: 238190792Sgshapirodnl it is part of the +detail@ which is omitted for the lookup 238290792Sgshapirodnl no match, +detail: try +* 238390792Sgshapirodnl 1 2 3 4 5 6 238490792SgshapiroR<?> <$+ + $* @> <$*> <$- $-> <$*> 238590792Sgshapiro $: <$(access $5`'_TAG_DELIM_`'$1+*@ $: ? $)> <$1+$2@> <$3> <$4 $5> <$6> 238690792Sgshapirodnl no match, +detail: try +* without tag 238790792Sgshapirodnl 1 2 3 4 5 238890792SgshapiroR<?> <$+ + $* @> <$*> <+ $-> <$*> 238990792Sgshapiro $: <$(access $1+*@ $: ? $)> <$1+$2@> <$3> <+ $4> <$5> 239090792Sgshapirodnl no match, +detail: try without +detail 239190792Sgshapirodnl 1 2 3 4 5 6 239290792SgshapiroR<?> <$+ + $* @> <$*> <$- $-> <$*> 239390792Sgshapiro $: <$(access $5`'_TAG_DELIM_`'$1@ $: ? $)> <$1+$2@> <$3> <$4 $5> <$6> 239490792Sgshapirodnl no match, +detail: try without +detail and without tag 239590792Sgshapirodnl 1 2 3 4 5 239690792SgshapiroR<?> <$+ + $* @> <$*> <+ $-> <$*> 239790792Sgshapiro $: <$(access $1@ $: ? $)> <$1+$2@> <$3> <+ $4> <$5> 239890792Sgshapirodnl no match, return <default> <passthru> 239990792Sgshapirodnl 1 2 3 4 5 240090792SgshapiroR<?> <$+> <$*> <$- $-> <$*> $@ <$2> <$5> 240190792Sgshapiroifdef(`_ATMPF_', `dnl tempfail? 240290792Sgshapirodnl 2 3 4 5 240390792SgshapiroR<$+ _ATMPF_> <$*> <$- $-> <$*> $@ <_ATMPF_> <$5>', `dnl') 240490792Sgshapirodnl match, return <match> <passthru> 240590792Sgshapirodnl 2 3 4 5 240690792SgshapiroR<$+> <$*> <$- $-> <$*> $@ <$1> <$5> 240790792Sgshapiro 240890792Sgshapiro###################################################################### 240964562Sgshapiro### SearchList: search a list of items in the access map 241064562Sgshapiro### Parameters: 241164562Sgshapiro### <exact tag> $| <mark:address> <mark:address> ... <> 241264562Sgshapirodnl maybe we should have a @ (again) in front of the mark to 241364562Sgshapirodnl avoid errorneous matches (with error messages?) 241464562Sgshapirodnl if we can make sure that tag is always a single token 241564562Sgshapirodnl then we can omit the delimiter $|, otherwise we need it 241690792Sgshapirodnl to avoid errorneous matchs (first rule: D: if there 241764562Sgshapirodnl is that mark somewhere in the list, it will be taken). 241864562Sgshapirodnl moreover, we can do some tricks to enforce lookup with 241964562Sgshapirodnl the tag only, e.g.: 242064562Sgshapiro### where "exact" is either "+" or "!": 242164562Sgshapiro### <+ TAG> lookup with and w/o tag 242264562Sgshapiro### <! TAG> lookup with tag 242364562Sgshapirodnl Warning: + and ! should be in OperatorChars (otherwise there must be 242464562Sgshapirodnl a blank between them and the tag. 242564562Sgshapiro### possible values for "mark" are: 242690792Sgshapiro### D: recursive host lookup (LookUpDomain) 242764562Sgshapirodnl A: recursive address lookup (LookUpAddress) [not yet required] 242864562Sgshapiro### E: exact lookup, no modifications 242964562Sgshapiro### F: full lookup, try user+ext@domain and user@domain 243064562Sgshapiro### U: user lookup, try user+ext and user (input must have trailing @) 243164562Sgshapiro### return: <RHS of lookup> or <?> (not found) 243264562Sgshapiro###################################################################### 243338032Speter 243464562Sgshapiro# class with valid marks for SearchList 243564562Sgshapirodnl if A is activated: add it 243690792SgshapiroC{src}E F D U ifdef(`_FFR_SRCHLIST_A', `A') 243764562SgshapiroSSearchList 243890792Sgshapiro# just call the ruleset with the name of the tag... nice trick... 243990792Sgshapirodnl 2 3 4 244090792SgshapiroR<$+> $| <$={src}:$*> <$*> $: <$1> $| <$4> $| $>$2 <$3> <?> <$1> <> 244190792Sgshapirodnl workspace: <o tag> $| <rest> $| <result of lookup> <> 244290792Sgshapirodnl no match and nothing left: return 244390792SgshapiroR<$+> $| <> $| <?> <> $@ <?> 244490792Sgshapirodnl no match but something left: continue 244590792SgshapiroR<$+> $| <$+> $| <?> <> $@ $>SearchList <$1> $| <$2> 244690792Sgshapirodnl match: return 244790792SgshapiroR<$+> $| <$*> $| <$+> <> $@ <$3> 244864562Sgshapirodnl return result from recursive invocation 244990792SgshapiroR<$+> $| <$+> $@ <$2> 245090792Sgshapirodnl endif _ACCESS_TABLE_ 245190792Sgshapirodivert(0) 245238032Speter 245390792Sgshapiro###################################################################### 245490792Sgshapiro### trust_auth: is user trusted to authenticate as someone else? 245590792Sgshapiro### 245690792Sgshapiro### Parameters: 245790792Sgshapiro### $1: AUTH= parameter from MAIL command 245890792Sgshapiro###################################################################### 245990792Sgshapiro 246090792Sgshapirodnl empty ruleset definition so it can be called 246190792SgshapiroSLocal_trust_auth 246264562SgshapiroStrust_auth 246364562SgshapiroR$* $: $&{auth_type} $| $1 246464562Sgshapiro# required by RFC 2554 section 4. 246564562SgshapiroR$@ $| $* $#error $@ 5.7.1 $: "550 not authenticated" 246664562Sgshapirodnl seems to be useful... 246764562SgshapiroR$* $| $&{auth_authen} $@ identical 246864562SgshapiroR$* $| <$&{auth_authen}> $@ identical 246964562Sgshapirodnl call user supplied code 247064562SgshapiroR$* $| $* $: $1 $| $>"Local_trust_auth" $1 247164562SgshapiroR$* $| $#$* $#$2 247264562Sgshapirodnl default: error 247364562SgshapiroR$* $#error $@ 5.7.1 $: "550 " $&{auth_authen} " not allowed to act as " $&{auth_author} 247464562Sgshapiro 247590792Sgshapiro###################################################################### 247690792Sgshapiro### Relay_Auth: allow relaying based on authentication? 247790792Sgshapiro### 247890792Sgshapiro### Parameters: 247990792Sgshapiro### $1: ${auth_type} 248090792Sgshapiro###################################################################### 248190792SgshapiroSLocal_Relay_Auth 248264562Sgshapiro 248390792Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 248490792Sgshapiro###################################################################### 248590792Sgshapiro### srv_features: which features to offer to a client? 248690792Sgshapiro### (done in server) 248790792Sgshapiro###################################################################### 248890792SgshapiroSsrv_features 248990792Sgshapiroifdef(`_LOCAL_SRV_FEATURES_', `dnl 249090792SgshapiroR$* $: $1 $| $>"Local_srv_features" $1 249190792SgshapiroR$* $| $#$* $#$2 249290792SgshapiroR$* $| $* $: $1', `dnl') 249390792SgshapiroR$* $: $>D <$&{client_name}> <?> <! SRV_FEAT_TAG> <> 249490792SgshapiroR<?>$* $: $>A <$&{client_addr}> <?> <! SRV_FEAT_TAG> <> 249590792SgshapiroR<?>$* $: <$(access SRV_FEAT_TAG`'_TAG_DELIM_ $: ? $)> 249664562SgshapiroR<?>$* $@ OK 249790792Sgshapiroifdef(`_ATMPF_', `dnl tempfail? 249890792SgshapiroR<$* _ATMPF_>$* $#temp', `dnl') 249990792SgshapiroR<$+>$* $# $1 250064562Sgshapiro 250190792Sgshapiro###################################################################### 250290792Sgshapiro### try_tls: try to use STARTTLS? 250390792Sgshapiro### (done in client) 250490792Sgshapiro###################################################################### 250564562SgshapiroStry_tls 250690792Sgshapiroifdef(`_LOCAL_TRY_TLS_', `dnl 250790792SgshapiroR$* $: $1 $| $>"Local_try_tls" $1 250890792SgshapiroR$* $| $#$* $#$2 250990792SgshapiroR$* $| $* $: $1', `dnl') 251090792SgshapiroR$* $: $>D <$&{server_name}> <?> <! TLS_TRY_TAG> <> 251190792SgshapiroR<?>$* $: $>A <$&{server_addr}> <?> <! TLS_TRY_TAG> <> 251290792SgshapiroR<?>$* $: <$(access TLS_TRY_TAG`'_TAG_DELIM_ $: ? $)> 251364562SgshapiroR<?>$* $@ OK 251490792Sgshapiroifdef(`_ATMPF_', `dnl tempfail? 251590792SgshapiroR<$* _ATMPF_>$* $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 251671345SgshapiroR<NO>$* $#error $@ 5.7.1 $: "550 do not try TLS with " $&{server_name} " ["$&{server_addr}"]" 2517102528Sgshapiro 251890792Sgshapiro###################################################################### 251990792Sgshapiro### tls_rcpt: is connection with server "good" enough? 252090792Sgshapiro### (done in client, per recipient) 252190792Sgshapirodnl called from deliver() before RCPT command 252290792Sgshapiro### 252390792Sgshapiro### Parameters: 252490792Sgshapiro### $1: recipient 252590792Sgshapiro###################################################################### 252690792SgshapiroStls_rcpt 252790792Sgshapiroifdef(`_LOCAL_TLS_RCPT_', `dnl 252890792SgshapiroR$* $: $1 $| $>"Local_tls_rcpt" $1 252990792SgshapiroR$* $| $#$* $#$2 253090792SgshapiroR$* $| $* $: $1', `dnl') 253190792Sgshapirodnl store name of other side 253290792SgshapiroR$* $: $(macro {TLS_Name} $@ $&{server_name} $) $1 253390792Sgshapirodnl canonify recipient address 253490792SgshapiroR$+ $: <?> $>CanonAddr $1 253590792Sgshapirodnl strip trailing dots 253690792SgshapiroR<?> $+ < @ $+ . > <?> $1 <@ $2 > 253790792Sgshapirodnl full address? 253890792SgshapiroR<?> $+ < @ $+ > $: $1 <@ $2 > $| <F:$1@$2> <U:$1@> <D:$2> <E:> 253990792Sgshapirodnl only localpart? 254090792SgshapiroR<?> $+ $: $1 $| <U:$1@> <E:> 254190792Sgshapirodnl look it up 254290792Sgshapirodnl also look up a default value via E: 254390792SgshapiroR$* $| $+ $: $1 $| $>SearchList <! TLS_RCPT_TAG> $| $2 <> 254490792Sgshapirodnl found nothing: stop here 254590792SgshapiroR$* $| <?> $@ OK 254690792Sgshapiroifdef(`_ATMPF_', `dnl tempfail? 254790792SgshapiroR$* $| <$* _ATMPF_> $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 254890792Sgshapirodnl use the generic routine (for now) 254990792SgshapiroR$* $| <$+> $@ $>"TLS_connection" $&{verify} $| <$2>') 255064562Sgshapiro 255190792Sgshapiro###################################################################### 255290792Sgshapiro### tls_client: is connection with client "good" enough? 255390792Sgshapiro### (done in server) 255490792Sgshapiro### 255590792Sgshapiro### Parameters: 255690792Sgshapiro### ${verify} $| (MAIL|STARTTLS) 255790792Sgshapiro###################################################################### 255864562Sgshapirodnl MAIL: called from check_mail 255964562Sgshapirodnl STARTTLS: called from smtp() after STARTTLS has been accepted 256064562SgshapiroStls_client 256190792Sgshapiroifdef(`_LOCAL_TLS_CLIENT_', `dnl 256290792SgshapiroR$* $: $1 $| $>"Local_tls_client" $1 256390792SgshapiroR$* $| $#$* $#$2 256490792SgshapiroR$* $| $* $: $1', `dnl') 256564562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 256690792Sgshapirodnl store name of other side 256790792SgshapiroR$* $: $(macro {TLS_Name} $@ $&{server_name} $) $1 256864562Sgshapirodnl ignore second arg for now 256964562Sgshapirodnl maybe use it to distinguish permanent/temporary error? 257064562Sgshapirodnl if MAIL: permanent (STARTTLS has not been offered) 257164562Sgshapirodnl if STARTTLS: temporary (offered but maybe failed) 257290792SgshapiroR$* $| $* $: $1 $| $>D <$&{client_name}> <?> <! TLS_CLT_TAG> <> 257390792SgshapiroR$* $| <?>$* $: $1 $| $>A <$&{client_addr}> <?> <! TLS_CLT_TAG> <> 257464562Sgshapirodnl do a default lookup: just TLS_CLT_TAG 257564562SgshapiroR$* $| <?>$* $: $1 $| <$(access TLS_CLT_TAG`'_TAG_DELIM_ $: ? $)> 257690792Sgshapiroifdef(`_ATMPF_', `dnl tempfail? 257790792SgshapiroR$* $| <$* _ATMPF_> $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 257890792SgshapiroR$* $@ $>"TLS_connection" $1', `dnl 257990792SgshapiroR$* $| $* $@ $>"TLS_connection" $1') 258064562Sgshapiro 258190792Sgshapiro###################################################################### 258290792Sgshapiro### tls_server: is connection with server "good" enough? 258390792Sgshapiro### (done in client) 258490792Sgshapiro### 258590792Sgshapiro### Parameter: 258690792Sgshapiro### ${verify} 258790792Sgshapiro###################################################################### 258864562Sgshapirodnl i.e. has the server been authenticated and is encryption active? 258964562Sgshapirodnl called from deliver() after STARTTLS command 259064562SgshapiroStls_server 259190792Sgshapiroifdef(`_LOCAL_TLS_SERVER_', `dnl 259290792SgshapiroR$* $: $1 $| $>"Local_tls_server" $1 259390792SgshapiroR$* $| $#$* $#$2 259490792SgshapiroR$* $| $* $: $1', `dnl') 259564562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 259690792Sgshapirodnl store name of other side 259790792SgshapiroR$* $: $(macro {TLS_Name} $@ $&{server_name} $) $1 259890792SgshapiroR$* $: $1 $| $>D <$&{server_name}> <?> <! TLS_SRV_TAG> <> 259990792SgshapiroR$* $| <?>$* $: $1 $| $>A <$&{server_addr}> <?> <! TLS_SRV_TAG> <> 260064562Sgshapirodnl do a default lookup: just TLS_SRV_TAG 260164562SgshapiroR$* $| <?>$* $: $1 $| <$(access TLS_SRV_TAG`'_TAG_DELIM_ $: ? $)> 260290792Sgshapiroifdef(`_ATMPF_', `dnl tempfail? 260390792SgshapiroR$* $| <$* _ATMPF_> $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 260490792SgshapiroR$* $@ $>"TLS_connection" $1', `dnl 260590792SgshapiroR$* $@ $>"TLS_connection" $1') 260664562Sgshapiro 260790792Sgshapiro###################################################################### 260890792Sgshapiro### TLS_connection: is TLS connection "good" enough? 260990792Sgshapiro### 261090792Sgshapiro### Parameters: 261164562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 261290792Sgshapiro### ${verify} $| <Requirement> [<>]', `dnl 261390792Sgshapiro### ${verify}') 261490792Sgshapiro### Requirement: RHS from access map, may be ? for none. 261590792Sgshapirodnl syntax for Requirement: 261690792Sgshapirodnl [(PERM|TEMP)+] (VERIFY[:bits]|ENCR:bits) [+extensions] 261790792Sgshapirodnl extensions: could be a list of further requirements 261890792Sgshapirodnl for now: CN:string {cn_subject} == string 261990792Sgshapiro###################################################################### 262090792SgshapiroSTLS_connection 262190792Sgshapiroifdef(`_ACCESS_TABLE_', `dnl', `dnl use default error 262290792Sgshapirodnl deal with TLS handshake failures: abort 262390792SgshapiroRSOFTWARE $#error $@ ifdef(`TLS_PERM_ERR', `5.7.0', `4.7.0') $: "ifdef(`TLS_PERM_ERR', `503', `403') TLS handshake." 262490792Sgshapirodivert(-1)') 262564562Sgshapirodnl common ruleset for tls_{client|server} 262690792Sgshapirodnl input: ${verify} $| <ResultOfLookup> [<>] 262764562Sgshapirodnl remove optional <> 262864562SgshapiroR$* $| <$*>$* $: $1 $| <$2> 262990792Sgshapirodnl workspace: ${verify} $| <ResultOfLookup> 263090792Sgshapiro# create the appropriate error codes 263164562Sgshapirodnl permanent or temporary error? 263264562SgshapiroR$* $| <PERM + $={tls} $*> $: $1 $| <503:5.7.0> <$2 $3> 263364562SgshapiroR$* $| <TEMP + $={tls} $*> $: $1 $| <403:4.7.0> <$2 $3> 263464562Sgshapirodnl default case depends on TLS_PERM_ERR 263564562SgshapiroR$* $| <$={tls} $*> $: $1 $| <ifdef(`TLS_PERM_ERR', `503:5.7.0', `403:4.7.0')> <$2 $3> 263690792Sgshapirodnl workspace: ${verify} $| [<SMTP:ESC>] <ResultOfLookup> 263790792Sgshapiro# deal with TLS handshake failures: abort 263864562SgshapiroRSOFTWARE $| <$-:$+> $* $#error $@ $2 $: $1 " TLS handshake failed." 263964562Sgshapirodnl no <reply:dns> i.e. not requirements in the access map 264064562Sgshapirodnl use default error 264164562SgshapiroRSOFTWARE $| $* $#error $@ ifdef(`TLS_PERM_ERR', `5.7.0', `4.7.0') $: "ifdef(`TLS_PERM_ERR', `503', `403') TLS handshake failed." 264290792SgshapiroR$* $| <$*> <VERIFY> $: <$2> <VERIFY> <> $1 264390792Sgshapirodnl separate optional requirements 264490792SgshapiroR$* $| <$*> <VERIFY + $+> $: <$2> <VERIFY> <$3> $1 264590792SgshapiroR$* $| <$*> <$={tls}:$->$* $: <$2> <$3:$4> <> $1 264690792Sgshapirodnl separate optional requirements 264790792SgshapiroR$* $| <$*> <$={tls}:$- + $+>$* $: <$2> <$3:$4> <$5> $1 264864562Sgshapirodnl some other value in access map: accept 264964562Sgshapirodnl this also allows to override the default case (if used) 265064562SgshapiroR$* $| $* $@ OK 265164562Sgshapiro# authentication required: give appropriate error 265264562Sgshapiro# other side did authenticate (via STARTTLS) 265390792Sgshapirodnl workspace: <SMTP:ESC> <{VERIFY,ENCR}[:BITS]> <[extensions]> ${verify} 265464562Sgshapirodnl only verification required and it succeeded 265590792SgshapiroR<$*><VERIFY> <> OK $@ OK 265690792Sgshapirodnl verification required and it succeeded but extensions are given 265790792Sgshapirodnl change it to <SMTP:ESC> <REQ:0> <extensions> 265890792SgshapiroR<$*><VERIFY> <$+> OK $: <$1> <REQ:0> <$2> 265964562Sgshapirodnl verification required + some level of encryption 266090792SgshapiroR<$*><VERIFY:$-> <$*> OK $: <$1> <REQ:$2> <$3> 266164562Sgshapirodnl just some level of encryption required 266290792SgshapiroR<$*><ENCR:$-> <$*> $* $: <$1> <REQ:$2> <$3> 266390792Sgshapirodnl workspace: 266490792Sgshapirodnl 1. <SMTP:ESC> <VERIFY [:bits]> <[extensions]> {verify} (!= OK) 266590792Sgshapirodnl 2. <SMTP:ESC> <REQ:bits> <[extensions]> 266690792Sgshapirodnl verification required but ${verify} is not set (case 1.) 266790792SgshapiroR<$-:$+><VERIFY $*> <$*> $#error $@ $2 $: $1 " authentication required" 266890792SgshapiroR<$-:$+><VERIFY $*> <$*> FAIL $#error $@ $2 $: $1 " authentication failed" 266990792SgshapiroR<$-:$+><VERIFY $*> <$*> NO $#error $@ $2 $: $1 " not authenticated" 267090792SgshapiroR<$-:$+><VERIFY $*> <$*> NOT $#error $@ $2 $: $1 " no authentication requested" 267190792SgshapiroR<$-:$+><VERIFY $*> <$*> NONE $#error $@ $2 $: $1 " other side does not support STARTTLS" 267264562Sgshapirodnl some other value for ${verify} 267390792SgshapiroR<$-:$+><VERIFY $*> <$*> $+ $#error $@ $2 $: $1 " authentication failure " $4 267490792Sgshapirodnl some level of encryption required: get the maximum level (case 2.) 267590792SgshapiroR<$*><REQ:$-> <$*> $: <$1> <REQ:$2> <$3> $>max $&{cipher_bits} : $&{auth_ssf} 267664562Sgshapirodnl compare required bits with actual bits 267790792SgshapiroR<$*><REQ:$-> <$*> $- $: <$1> <$2:$4> <$3> $(arith l $@ $4 $@ $2 $) 267890792SgshapiroR<$-:$+><$-:$-> <$*> TRUE $#error $@ $2 $: $1 " encryption too weak " $4 " less than " $3 267990792Sgshapirodnl strength requirements fulfilled 268090792Sgshapirodnl TLS Additional Requirements Separator 268190792Sgshapirodnl this should be something which does not appear in the extensions itself 268290792Sgshapirodnl @ could be part of a CN, DN, etc... 268390792Sgshapirodnl use < > ? those are encoded in CN, DN, ... 268490792Sgshapirodefine(`_TLS_ARS_', `++')dnl 268590792Sgshapirodnl workspace: 268690792Sgshapirodnl <SMTP:ESC> <REQ:bits> <extensions> result-of-compare 268790792SgshapiroR<$-:$+><$-:$-> <$*> $* $: <$1:$2 _TLS_ARS_ $5> 268890792Sgshapirodnl workspace: <SMTP:ESC _TLS_ARS_ extensions> 268990792Sgshapirodnl continue: check extensions 269090792SgshapiroR<$-:$+ _TLS_ARS_ > $@ OK 269190792Sgshapirodnl split extensions into own list 269290792SgshapiroR<$-:$+ _TLS_ARS_ $+ > $: <$1:$2> <$3> 269390792SgshapiroR<$-:$+> < $+ _TLS_ARS_ $+ > <$1:$2> <$3> <$4> 269490792SgshapiroR<$-:$+> $+ $@ $>"TLS_req" $3 $| <$1:$2> 269564562Sgshapiro 269690792Sgshapiro###################################################################### 269790792Sgshapiro### TLS_req: check additional TLS requirements 269890792Sgshapiro### 269990792Sgshapiro### Parameters: [<list> <of> <req>] $| <$-:$+> 270090792Sgshapiro### $-: SMTP reply code 270190792Sgshapiro### $+: Enhanced Status Code 270290792Sgshapirodnl further requirements for this ruleset: 270390792Sgshapirodnl name of "other side" is stored is {TLS_name} (client/server_name) 270490792Sgshapirodnl 270590792Sgshapirodnl currently only CN[:common_name] is implemented 270690792Sgshapirodnl right now this is only a logical AND 270790792Sgshapirodnl i.e. all requirements must be true 270890792Sgshapirodnl how about an OR? CN must be X or CN must be Y or .. 270990792Sgshapirodnl use a macro to compute this as a trivial sequential 271090792Sgshapirodnl operations (no precedences etc)? 271190792Sgshapiro###################################################################### 271290792SgshapiroSTLS_req 271390792Sgshapirodnl no additional requirements: ok 271490792SgshapiroR $| $+ $@ OK 271590792Sgshapirodnl require CN: but no CN specified: use name of other side 271690792SgshapiroR<CN> $* $| <$+> $: <CN:$&{TLS_Name}> $1 $| <$2> 271790792Sgshapirodnl match, check rest 271890792SgshapiroR<CN:$&{cn_subject}> $* $| <$+> $@ $>"TLS_req" $1 $| <$2> 271990792Sgshapirodnl CN does not match 272090792Sgshapirodnl 1 2 3 4 272190792SgshapiroR<CN:$+> $* $| <$-:$+> $#error $@ $4 $: $3 " CN " $&{cn_subject} " does not match " $1 272290792Sgshapirodnl cert subject 272390792SgshapiroR<CS:$&{cert_subject}> $* $| <$+> $@ $>"TLS_req" $1 $| <$2> 272490792Sgshapirodnl CS does not match 272590792Sgshapirodnl 1 2 3 4 2726110560SgshapiroR<CS:$+> $* $| <$-:$+> $#error $@ $4 $: $3 " Cert Subject " $&{cert_subject} " does not match " $1 272790792Sgshapirodnl match, check rest 272890792SgshapiroR<CI:$&{cert_issuer}> $* $| <$+> $@ $>"TLS_req" $1 $| <$2> 272990792Sgshapirodnl CI does not match 273090792Sgshapirodnl 1 2 3 4 2731110560SgshapiroR<CI:$+> $* $| <$-:$+> $#error $@ $4 $: $3 " Cert Issuer " $&{cert_issuer} " does not match " $1 273290792Sgshapirodnl return from recursive call 273390792SgshapiroROK $@ OK 273490792Sgshapiro 273590792Sgshapiro###################################################################### 273690792Sgshapiro### max: return the maximum of two values separated by : 273790792Sgshapiro### 273890792Sgshapiro### Parameters: [$-]:[$-] 273990792Sgshapiro###################################################################### 274064562SgshapiroSmax 274164562SgshapiroR: $: 0 274264562SgshapiroR:$- $: $1 274364562SgshapiroR$-: $: $1 274464562SgshapiroR$-:$- $: $(arith l $@ $1 $@ $2 $) : $1 : $2 274564562SgshapiroRTRUE:$-:$- $: $2 274690792SgshapiroR$-:$-:$- $: $2 274790792Sgshapirodnl endif _ACCESS_TABLE_ 274890792Sgshapirodivert(0) 274964562Sgshapiro 275090792Sgshapiro###################################################################### 275190792Sgshapiro### RelayTLS: allow relaying based on TLS authentication 275290792Sgshapiro### 275390792Sgshapiro### Parameters: 275490792Sgshapiro### none 275590792Sgshapiro###################################################################### 275690792SgshapiroSRelayTLS 275764562Sgshapiro# authenticated? 275864562Sgshapirodnl we do not allow relaying for anyone who can present a cert 275964562Sgshapirodnl signed by a "trusted" CA. For example, even if we put verisigns 2760110560Sgshapirodnl CA in CertPath so we can authenticate users, we do not allow 276164562Sgshapirodnl them to abuse our server (they might be easier to get hold of, 276264562Sgshapirodnl but anyway). 276364562Sgshapirodnl so here is the trick: if the verification succeeded 276464562Sgshapirodnl we look up the cert issuer in the access map 276564562Sgshapirodnl (maybe after extracting a part with a regular expression) 276664562Sgshapirodnl if this returns RELAY we relay without further questions 276764562Sgshapirodnl if it returns SUBJECT we perform a similar check on the 276864562Sgshapirodnl cert subject. 276964562Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 277090792SgshapiroR$* $: <?> $&{verify} 277190792SgshapiroR<?> OK $: OK authenticated: continue 277290792SgshapiroR<?> $* $@ NO not authenticated 277364562Sgshapiroifdef(`_CERT_REGEX_ISSUER_', `dnl 277490792SgshapiroR$* $: $(CERTIssuer $&{cert_issuer} $)', 277590792Sgshapiro`R$* $: $&{cert_issuer}') 277690792SgshapiroR$+ $: $(access CERTISSUER`'_TAG_DELIM_`'$1 $) 277764562Sgshapirodnl use $# to stop further checks (delay_check) 277890792SgshapiroRRELAY $# RELAY 277964562Sgshapiroifdef(`_CERT_REGEX_SUBJECT_', `dnl 278090792SgshapiroRSUBJECT $: <@> $(CERTSubject $&{cert_subject} $)', 278190792Sgshapiro`RSUBJECT $: <@> $&{cert_subject}') 278290792SgshapiroR<@> $+ $: <@> $(access CERTSUBJECT`'_TAG_DELIM_`'$1 $) 278390792SgshapiroR<@> RELAY $# RELAY 278490792SgshapiroR$* $: NO', `dnl') 278564562Sgshapiro 278690792Sgshapiro###################################################################### 278790792Sgshapiro### authinfo: lookup authinfo in the access map 278890792Sgshapiro### 278990792Sgshapiro### Parameters: 279090792Sgshapiro### $1: {server_name} 279190792Sgshapiro### $2: {server_addr} 279290792Sgshapirodnl both are currently ignored 279390792Sgshapirodnl if it should be done via another map, we either need to restrict 279490792Sgshapirodnl functionality (it calls D and A) or copy those rulesets (or add another 279590792Sgshapirodnl parameter which I want to avoid, it's quite complex already) 279690792Sgshapiro###################################################################### 279790792Sgshapirodnl omit this ruleset if neither is defined? 279890792Sgshapirodnl it causes DefaultAuthInfo to be ignored 279990792Sgshapirodnl (which may be considered a good thing). 280090792SgshapiroSauthinfo 280190792Sgshapiroifdef(`_AUTHINFO_TABLE_', `dnl 280290792SgshapiroR$* $: <$(authinfo AuthInfo:$&{server_name} $: ? $)> 280390792SgshapiroR<?> $: <$(authinfo AuthInfo:$&{server_addr} $: ? $)> 280490792SgshapiroR<?> $: <$(authinfo AuthInfo: $: ? $)> 280590792SgshapiroR<?> $@ no no authinfo available 280690792SgshapiroR<$*> $# $1 280790792Sgshapirodnl', `dnl 280890792Sgshapiroifdef(`_ACCESS_TABLE_', `dnl 280990792SgshapiroR$* $: $1 $| $>D <$&{server_name}> <?> <! AuthInfo> <> 281090792SgshapiroR$* $| <?>$* $: $1 $| $>A <$&{server_addr}> <?> <! AuthInfo> <> 281190792SgshapiroR$* $| <?>$* $: $1 $| <$(access AuthInfo`'_TAG_DELIM_ $: ? $)> <> 281290792SgshapiroR$* $| <?>$* $@ no no authinfo available 281390792SgshapiroR$* $| <$*> <> $# $2 281490792Sgshapirodnl', `dnl')') 281590792Sgshapiro 281664562Sgshapiroundivert(9)dnl LOCAL_RULESETS 281738032Speter# 281838032Speter###################################################################### 281938032Speter###################################################################### 282038032Speter##### 282164562Sgshapiro`##### MAIL FILTER DEFINITIONS' 282264562Sgshapiro##### 282364562Sgshapiro###################################################################### 282464562Sgshapiro###################################################################### 282590792Sgshapiro_MAIL_FILTERS_ 282664562Sgshapiro# 282764562Sgshapiro###################################################################### 282864562Sgshapiro###################################################################### 282964562Sgshapiro##### 283038032Speter`##### MAILER DEFINITIONS' 283138032Speter##### 283238032Speter###################################################################### 283338032Speter###################################################################### 283464562Sgshapiroundivert(7)dnl MAILER_DEFINITIONS 283566494Sgshapiro 2836