1c2aa98e2SPeter Wemmdivert(-1) 2c2aa98e2SPeter Wemm# 3605302a5SGregory Neil Shapiro# Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers. 406f25ae9SGregory Neil Shapiro# All rights reserved. 5c2aa98e2SPeter Wemm# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved. 6c2aa98e2SPeter Wemm# Copyright (c) 1988, 1993 7c2aa98e2SPeter Wemm# The Regents of the University of California. All rights reserved. 8c2aa98e2SPeter Wemm# 9c2aa98e2SPeter Wemm# By using this file, you agree to the terms and conditions set 10c2aa98e2SPeter Wemm# forth in the LICENSE file which can be found at the top level of 11c2aa98e2SPeter Wemm# the sendmail distribution. 12c2aa98e2SPeter Wemm# 13c2aa98e2SPeter Wemm# 14c2aa98e2SPeter Wemmdivert(0) 15c2aa98e2SPeter Wemm 1694c01205SGregory Neil ShapiroVERSIONID(`$Id: proto.m4,v 8.646 2002/05/19 21:22:40 gshapiro Exp $') 17c2aa98e2SPeter Wemm 1806f25ae9SGregory Neil Shapiro# level CF_LEVEL config file format 1906f25ae9SGregory Neil ShapiroV`'CF_LEVEL/ifdef(`VENDOR_NAME', `VENDOR_NAME', `Berkeley') 20c2aa98e2SPeter Wemmdivert(-1) 21c2aa98e2SPeter Wemm 2240266059SGregory Neil Shapirodnl if MAILER(`local') not defined: do it ourself; be nice 2340266059SGregory Neil Shapirodnl maybe we should issue a warning? 2440266059SGregory Neil Shapiroifdef(`_MAILER_local_',`', `MAILER(local)') 2540266059SGregory Neil Shapiro 26c2aa98e2SPeter Wemm# do some sanity checking 27c2aa98e2SPeter Wemmifdef(`__OSTYPE__',, 2806f25ae9SGregory Neil Shapiro `errprint(`*** ERROR: No system type defined (use OSTYPE macro) 2906f25ae9SGregory Neil Shapiro')') 30c2aa98e2SPeter Wemm 31c2aa98e2SPeter Wemm# pick our default mailers 32c2aa98e2SPeter Wemmifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `esmtp')') 33c2aa98e2SPeter Wemmifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')') 34c2aa98e2SPeter Wemmifdef(`confRELAY_MAILER',, 35c2aa98e2SPeter Wemm `define(`confRELAY_MAILER', 36c2aa98e2SPeter Wemm `ifdef(`_MAILER_smtp_', `relay', 37c2aa98e2SPeter Wemm `ifdef(`_MAILER_uucp', `uucp-new', `unknown')')')') 38c2aa98e2SPeter Wemmifdef(`confUUCP_MAILER',, `define(`confUUCP_MAILER', `uucp-old')') 39c2aa98e2SPeter Wemmdefine(`_SMTP_', `confSMTP_MAILER')dnl for readability only 40c2aa98e2SPeter Wemmdefine(`_LOCAL_', `confLOCAL_MAILER')dnl for readability only 41c2aa98e2SPeter Wemmdefine(`_RELAY_', `confRELAY_MAILER')dnl for readability only 42c2aa98e2SPeter Wemmdefine(`_UUCP_', `confUUCP_MAILER')dnl for readability only 43c2aa98e2SPeter Wemm 44c2aa98e2SPeter Wemm# back compatibility with old config files 45c2aa98e2SPeter Wemmifdef(`confDEF_GROUP_ID', 4606f25ae9SGregory Neil Shapiro`errprint(`*** confDEF_GROUP_ID is obsolete. 4706f25ae9SGregory Neil Shapiro Use confDEF_USER_ID with a colon in the value instead. 4806f25ae9SGregory Neil Shapiro')') 49c2aa98e2SPeter Wemmifdef(`confREAD_TIMEOUT', 5006f25ae9SGregory Neil Shapiro`errprint(`*** confREAD_TIMEOUT is obsolete. 5106f25ae9SGregory Neil Shapiro Use individual confTO_<timeout> parameters instead. 5206f25ae9SGregory Neil Shapiro')') 53c2aa98e2SPeter Wemmifdef(`confMESSAGE_TIMEOUT', 54c2aa98e2SPeter Wemm `define(`_ARG_', index(confMESSAGE_TIMEOUT, /)) 55c2aa98e2SPeter Wemm ifelse(_ARG_, -1, 56c2aa98e2SPeter Wemm `define(`confTO_QUEUERETURN', confMESSAGE_TIMEOUT)', 57c2aa98e2SPeter Wemm `define(`confTO_QUEUERETURN', 58c2aa98e2SPeter Wemm substr(confMESSAGE_TIMEOUT, 0, _ARG_)) 59c2aa98e2SPeter Wemm define(`confTO_QUEUEWARN', 60c2aa98e2SPeter Wemm substr(confMESSAGE_TIMEOUT, eval(_ARG_+1)))')') 61c2aa98e2SPeter Wemmifdef(`confMIN_FREE_BLOCKS', `ifelse(index(confMIN_FREE_BLOCKS, /), -1,, 6206f25ae9SGregory Neil Shapiro`errprint(`*** compound confMIN_FREE_BLOCKS is obsolete. 6306f25ae9SGregory Neil Shapiro Use confMAX_MESSAGE_SIZE for the second part of the value. 6406f25ae9SGregory Neil Shapiro')')') 6506f25ae9SGregory Neil Shapiro 6606f25ae9SGregory Neil Shapiro 6706f25ae9SGregory Neil Shapiro# Sanity check on ldap_routing feature 6806f25ae9SGregory Neil Shapiro# If the user doesn't specify a new map, they better have given as a 6906f25ae9SGregory Neil Shapiro# default LDAP specification which has the LDAP base (and most likely the host) 7006f25ae9SGregory Neil Shapiroifdef(`confLDAP_DEFAULT_SPEC',, `ifdef(`_LDAP_ROUTING_WARN_', `errprint(` 7106f25ae9SGregory Neil ShapiroWARNING: Using default FEATURE(ldap_routing) map definition(s) 7206f25ae9SGregory Neil Shapirowithout setting confLDAP_DEFAULT_SPEC option. 7306f25ae9SGregory Neil Shapiro')')')dnl 74c2aa98e2SPeter Wemm 75c2aa98e2SPeter Wemm# clean option definitions below.... 7606f25ae9SGregory Neil Shapirodefine(`_OPTION', `ifdef(`$2', `O $1`'ifelse(defn(`$2'), `',, `=$2')', `#O $1`'ifelse(`$3', `',,`=$3')')')dnl 77c2aa98e2SPeter Wemm 7806f25ae9SGregory Neil Shapirodnl required to "rename" the check_* rulesets... 7906f25ae9SGregory Neil Shapirodefine(`_U_',ifdef(`_DELAY_CHECKS_',`',`_')) 8006f25ae9SGregory Neil Shapirodnl default relaying denied message 8140266059SGregory Neil Shapiroifdef(`confRELAY_MSG', `', `define(`confRELAY_MSG', 8240266059SGregory Neil Shapiroifdef(`_USE_AUTH_', `"550 Relaying denied. Proper authentication required."', `"550 Relaying denied"'))') 8340266059SGregory Neil Shapiroifdef(`confRCPTREJ_MSG', `', `define(`confRCPTREJ_MSG', `"550 Mailbox disabled for this recipient"')') 8440266059SGregory Neil Shapirodefine(`_CODE553', `553') 85c2aa98e2SPeter Wemmdivert(0)dnl 86c2aa98e2SPeter Wemm 8706f25ae9SGregory Neil Shapiro# override file safeties - setting this option compromises system security, 8806f25ae9SGregory Neil Shapiro# addressing the actual file configuration problem is preferred 8906f25ae9SGregory Neil Shapiro# need to set this before any file actions are encountered in the cf file 9006f25ae9SGregory Neil Shapiro_OPTION(DontBlameSendmail, `confDONT_BLAME_SENDMAIL', `safe') 9106f25ae9SGregory Neil Shapiro 9206f25ae9SGregory Neil Shapiro# default LDAP map specification 9306f25ae9SGregory Neil Shapiro# need to set this now before any LDAP maps are defined 9406f25ae9SGregory Neil Shapiro_OPTION(LDAPDefaultSpec, `confLDAP_DEFAULT_SPEC', `-h localhost') 95c2aa98e2SPeter Wemm 96c2aa98e2SPeter Wemm################## 97c2aa98e2SPeter Wemm# local info # 98c2aa98e2SPeter Wemm################## 99c2aa98e2SPeter Wemm 10040266059SGregory Neil Shapiro# my LDAP cluster 10140266059SGregory Neil Shapiro# need to set this before any LDAP lookups are done (including classes) 10240266059SGregory Neil Shapiroifdef(`confLDAP_CLUSTER', `D{sendmailMTACluster}`'confLDAP_CLUSTER', `#D{sendmailMTACluster}$m') 10340266059SGregory Neil Shapiro 104c2aa98e2SPeter WemmCwlocalhost 105c2aa98e2SPeter Wemmifdef(`USE_CW_FILE', 106c2aa98e2SPeter Wemm`# file containing names of hosts for which we receive email 107c2aa98e2SPeter WemmFw`'confCW_FILE', 108c2aa98e2SPeter Wemm `dnl') 109c2aa98e2SPeter Wemm 110c2aa98e2SPeter Wemm# my official domain name 111c2aa98e2SPeter Wemm# ... `define' this only if sendmail cannot automatically determine your domain 112c2aa98e2SPeter Wemmifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM') 113c2aa98e2SPeter Wemm 114c2aa98e2SPeter WemmCP. 115c2aa98e2SPeter Wemm 116c2aa98e2SPeter Wemmifdef(`UUCP_RELAY', 117c2aa98e2SPeter Wemm`# UUCP relay host 118c2aa98e2SPeter WemmDY`'UUCP_RELAY 119c2aa98e2SPeter WemmCPUUCP 120c2aa98e2SPeter Wemm 121c2aa98e2SPeter Wemm')dnl 122c2aa98e2SPeter Wemmifdef(`BITNET_RELAY', 123c2aa98e2SPeter Wemm`# BITNET relay host 124c2aa98e2SPeter WemmDB`'BITNET_RELAY 125c2aa98e2SPeter WemmCPBITNET 126c2aa98e2SPeter Wemm 127c2aa98e2SPeter Wemm')dnl 128c2aa98e2SPeter Wemmifdef(`DECNET_RELAY', 129c2aa98e2SPeter Wemm`define(`_USE_DECNET_SYNTAX_', 1)dnl 130c2aa98e2SPeter Wemm# DECnet relay host 131c2aa98e2SPeter WemmDC`'DECNET_RELAY 132c2aa98e2SPeter WemmCPDECNET 133c2aa98e2SPeter Wemm 134c2aa98e2SPeter Wemm')dnl 135c2aa98e2SPeter Wemmifdef(`FAX_RELAY', 136c2aa98e2SPeter Wemm`# FAX relay host 137c2aa98e2SPeter WemmDF`'FAX_RELAY 138c2aa98e2SPeter WemmCPFAX 139c2aa98e2SPeter Wemm 140c2aa98e2SPeter Wemm')dnl 141c2aa98e2SPeter Wemm# "Smart" relay host (may be null) 14240266059SGregory Neil ShapiroDS`'ifdef(`SMART_HOST', `SMART_HOST') 143c2aa98e2SPeter Wemm 144c2aa98e2SPeter Wemmifdef(`LUSER_RELAY', `dnl 145c2aa98e2SPeter Wemm# place to which unknown users should be forwarded 146c2aa98e2SPeter WemmKuser user -m -a<> 147c2aa98e2SPeter WemmDL`'LUSER_RELAY', 148c2aa98e2SPeter Wemm`dnl') 149c2aa98e2SPeter Wemm 150c2aa98e2SPeter Wemm# operators that cannot be in local usernames (i.e., network indicators) 151c2aa98e2SPeter WemmCO @ % ifdef(`_NO_UUCP_', `', `!') 152c2aa98e2SPeter Wemm 153c2aa98e2SPeter Wemm# a class with just dot (for identifying canonical names) 154c2aa98e2SPeter WemmC.. 155c2aa98e2SPeter Wemm 156c2aa98e2SPeter Wemm# a class with just a left bracket (for identifying domain literals) 157c2aa98e2SPeter WemmC[[ 158c2aa98e2SPeter Wemm 15906f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 16006f25ae9SGregory Neil Shapiro# access_db acceptance class 16106f25ae9SGregory Neil ShapiroC{Accept}OK RELAY 16240266059SGregory Neil Shapiroifdef(`_DELAY_COMPAT_8_10_',`dnl 16306f25ae9SGregory Neil Shapiroifdef(`_BLACKLIST_RCPT_',`dnl 16406f25ae9SGregory Neil Shapiro# possible access_db RHS for spam friends/haters 16506f25ae9SGregory Neil ShapiroC{SpamTag}SPAMFRIEND SPAMHATER')')', 166c2aa98e2SPeter Wemm`dnl') 167c2aa98e2SPeter Wemm 16840266059SGregory Neil Shapirodnl mark for "domain is ok" (resolved or accepted anyway) 16940266059SGregory Neil Shapirodefine(`_RES_OK_', `OKR')dnl 170c2aa98e2SPeter Wemmifdef(`_ACCEPT_UNRESOLVABLE_DOMAINS_',`dnl',`dnl 171c2aa98e2SPeter Wemm# Resolve map (to check if a host exists in check_mail) 17240266059SGregory Neil ShapiroKresolve host -a<_RES_OK_> -T<TEMP>') 17340266059SGregory Neil ShapiroC{ResOk}_RES_OK_ 174c2aa98e2SPeter Wemm 17513058a91SGregory Neil Shapiroifdef(`_NEED_MACRO_MAP_', `dnl 17613058a91SGregory Neil Shapiroifdef(`_MACRO_MAP_', `', `# macro storage map 17713058a91SGregory Neil Shapirodefine(`_MACRO_MAP_', `1')dnl 17813058a91SGregory Neil ShapiroKmacro macro')', `dnl') 17942e5d165SGregory Neil Shapiro 180c2aa98e2SPeter Wemmifdef(`confCR_FILE', `dnl 18142e5d165SGregory Neil Shapiro# Hosts for which relaying is permitted ($=R) 182c2aa98e2SPeter WemmFR`'confCR_FILE', 183c2aa98e2SPeter Wemm`dnl') 184c2aa98e2SPeter Wemm 18540266059SGregory Neil Shapirodefine(`TLS_SRV_TAG', `"TLS_Srv"')dnl 18640266059SGregory Neil Shapirodefine(`TLS_CLT_TAG', `"TLS_Clt"')dnl 18740266059SGregory Neil Shapirodefine(`TLS_RCPT_TAG', `"TLS_Rcpt"')dnl 18840266059SGregory Neil Shapirodefine(`TLS_TRY_TAG', `"Try_TLS"')dnl 18940266059SGregory Neil Shapirodefine(`SRV_FEAT_TAG', `"Srv_Features"')dnl 19006f25ae9SGregory Neil Shapirodnl this may be useful in other contexts too 19106f25ae9SGregory Neil Shapiroifdef(`_ARITH_MAP_', `', `# arithmetic map 19206f25ae9SGregory Neil Shapirodefine(`_ARITH_MAP_', `1')dnl 19306f25ae9SGregory Neil ShapiroKarith arith') 19406f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 19540266059SGregory Neil Shapiroifdef(`_MACRO_MAP_', `', `# macro storage map 19640266059SGregory Neil Shapirodefine(`_MACRO_MAP_', `1')dnl 19740266059SGregory Neil ShapiroKmacro macro') 19840266059SGregory Neil Shapiro# possible values for TLS_connection in access map 19906f25ae9SGregory Neil ShapiroC{tls}VERIFY ENCR', `dnl') 20006f25ae9SGregory Neil Shapiroifdef(`_CERT_REGEX_ISSUER_', `dnl 20106f25ae9SGregory Neil Shapiro# extract relevant part from cert issuer 20206f25ae9SGregory Neil ShapiroKCERTIssuer regex _CERT_REGEX_ISSUER_', `dnl') 20306f25ae9SGregory Neil Shapiroifdef(`_CERT_REGEX_SUBJECT_', `dnl 20406f25ae9SGregory Neil Shapiro# extract relevant part from cert subject 20506f25ae9SGregory Neil ShapiroKCERTSubject regex _CERT_REGEX_SUBJECT_', `dnl') 20606f25ae9SGregory Neil Shapiro 20740266059SGregory Neil Shapiroifdef(`LOCAL_RELAY', `dnl 208c2aa98e2SPeter Wemm# who I send unqualified names to (null means deliver locally) 20940266059SGregory Neil ShapiroDR`'LOCAL_RELAY') 210c2aa98e2SPeter Wemm 21140266059SGregory Neil Shapiroifdef(`MAIL_HUB', `dnl 212c2aa98e2SPeter Wemm# who gets all local email traffic ($R has precedence for unqualified names) 21340266059SGregory Neil ShapiroDH`'MAIL_HUB') 214c2aa98e2SPeter Wemm 215c2aa98e2SPeter Wemm# dequoting map 21640266059SGregory Neil ShapiroKdequote dequote`'ifdef(`confDEQUOTE_OPTS', ` confDEQUOTE_OPTS', `') 217c2aa98e2SPeter Wemm 218c2aa98e2SPeter Wemmdivert(0)dnl # end of nullclient diversion 219c2aa98e2SPeter Wemm# class E: names that should be exposed as from this host, even if we masquerade 22006f25ae9SGregory Neil Shapiro# class L: names that should be delivered locally, even if we have a relay 221c2aa98e2SPeter Wemm# class M: domains that should be converted to $M 22206f25ae9SGregory Neil Shapiro# class N: domains that should not be converted to $M 223c2aa98e2SPeter Wemm#CL root 224c2aa98e2SPeter Wemmundivert(5)dnl 22506f25ae9SGregory Neil Shapiroifdef(`_VIRTHOSTS_', `CR$={VirtHost}', `dnl') 226c2aa98e2SPeter Wemm 22740266059SGregory Neil Shapiroifdef(`MASQUERADE_NAME', `dnl 228c2aa98e2SPeter Wemm# who I masquerade as (null for no masquerading) (see also $=M) 22940266059SGregory Neil ShapiroDM`'MASQUERADE_NAME') 230c2aa98e2SPeter Wemm 231c2aa98e2SPeter Wemm# my name for error messages 232c2aa98e2SPeter Wemmifdef(`confMAILER_NAME', `Dn`'confMAILER_NAME', `#DnMAILER-DAEMON') 233c2aa98e2SPeter Wemm 23406f25ae9SGregory Neil Shapiroundivert(6)dnl LOCAL_CONFIG 235c2aa98e2SPeter Wemminclude(_CF_DIR_`m4/version.m4') 236c2aa98e2SPeter Wemm 237c2aa98e2SPeter Wemm############### 238c2aa98e2SPeter Wemm# Options # 239c2aa98e2SPeter Wemm############### 24040266059SGregory Neil Shapiroifdef(`confAUTO_REBUILD', 24140266059SGregory Neil Shapiro`errprint(WARNING: `confAUTO_REBUILD' is no longer valid. 24240266059SGregory Neil Shapiro There was a potential for a denial of service attack if this is set. 24340266059SGregory Neil Shapiro)')dnl 244c2aa98e2SPeter Wemm 245c2aa98e2SPeter Wemm# strip message body to 7 bits on input? 24606f25ae9SGregory Neil Shapiro_OPTION(SevenBitInput, `confSEVEN_BIT_INPUT', `False') 247c2aa98e2SPeter Wemm 248c2aa98e2SPeter Wemm# 8-bit data handling 2498774250cSGregory Neil Shapiro_OPTION(EightBitMode, `confEIGHT_BIT_HANDLING', `pass8') 250c2aa98e2SPeter Wemm 251c2aa98e2SPeter Wemm# wait for alias file rebuild (default units: minutes) 25206f25ae9SGregory Neil Shapiro_OPTION(AliasWait, `confALIAS_WAIT', `5m') 253c2aa98e2SPeter Wemm 254c2aa98e2SPeter Wemm# location of alias file 25506f25ae9SGregory Neil Shapiro_OPTION(AliasFile, `ALIAS_FILE', `MAIL_SETTINGS_DIR`'aliases') 25606f25ae9SGregory Neil Shapiro 257c2aa98e2SPeter Wemm# minimum number of free blocks on filesystem 25806f25ae9SGregory Neil Shapiro_OPTION(MinFreeBlocks, `confMIN_FREE_BLOCKS', `100') 259c2aa98e2SPeter Wemm 260c2aa98e2SPeter Wemm# maximum message size 26106f25ae9SGregory Neil Shapiro_OPTION(MaxMessageSize, `confMAX_MESSAGE_SIZE', `1000000') 262c2aa98e2SPeter Wemm 263c2aa98e2SPeter Wemm# substitution for space (blank) characters 26406f25ae9SGregory Neil Shapiro_OPTION(BlankSub, `confBLANK_SUB', `_') 265c2aa98e2SPeter Wemm 266c2aa98e2SPeter Wemm# avoid connecting to "expensive" mailers on initial submission? 26706f25ae9SGregory Neil Shapiro_OPTION(HoldExpensive, `confCON_EXPENSIVE', `False') 268c2aa98e2SPeter Wemm 269c2aa98e2SPeter Wemm# checkpoint queue runs after every N successful deliveries 27006f25ae9SGregory Neil Shapiro_OPTION(CheckpointInterval, `confCHECKPOINT_INTERVAL', `10') 271c2aa98e2SPeter Wemm 272c2aa98e2SPeter Wemm# default delivery mode 27306f25ae9SGregory Neil Shapiro_OPTION(DeliveryMode, `confDELIVERY_MODE', `background') 274c2aa98e2SPeter Wemm 275c2aa98e2SPeter Wemm# error message header/file 27606f25ae9SGregory Neil Shapiro_OPTION(ErrorHeader, `confERROR_MESSAGE', `MAIL_SETTINGS_DIR`'error-header') 277c2aa98e2SPeter Wemm 278c2aa98e2SPeter Wemm# error mode 27906f25ae9SGregory Neil Shapiro_OPTION(ErrorMode, `confERROR_MODE', `print') 280c2aa98e2SPeter Wemm 281c2aa98e2SPeter Wemm# save Unix-style "From_" lines at top of header? 28206f25ae9SGregory Neil Shapiro_OPTION(SaveFromLine, `confSAVE_FROM_LINES', `False') 283c2aa98e2SPeter Wemm 28440266059SGregory Neil Shapiro# queue file mode (qf files) 28540266059SGregory Neil Shapiro_OPTION(QueueFileMode, `confQUEUE_FILE_MODE', `0600') 28640266059SGregory Neil Shapiro 287c2aa98e2SPeter Wemm# temporary file mode 28806f25ae9SGregory Neil Shapiro_OPTION(TempFileMode, `confTEMP_FILE_MODE', `0600') 289c2aa98e2SPeter Wemm 290c2aa98e2SPeter Wemm# match recipients against GECOS field? 29106f25ae9SGregory Neil Shapiro_OPTION(MatchGECOS, `confMATCH_GECOS', `False') 292c2aa98e2SPeter Wemm 293c2aa98e2SPeter Wemm# maximum hop count 29440266059SGregory Neil Shapiro_OPTION(MaxHopCount, `confMAX_HOP', `25') 295c2aa98e2SPeter Wemm 296c2aa98e2SPeter Wemm# location of help file 29706f25ae9SGregory Neil ShapiroO HelpFile=ifdef(`HELP_FILE', HELP_FILE, `MAIL_SETTINGS_DIR`'helpfile') 298c2aa98e2SPeter Wemm 299c2aa98e2SPeter Wemm# ignore dots as terminators in incoming messages? 30006f25ae9SGregory Neil Shapiro_OPTION(IgnoreDots, `confIGNORE_DOTS', `False') 301c2aa98e2SPeter Wemm 302c2aa98e2SPeter Wemm# name resolver options 30306f25ae9SGregory Neil Shapiro_OPTION(ResolverOptions, `confBIND_OPTS', `+AAONLY') 304c2aa98e2SPeter Wemm 305c2aa98e2SPeter Wemm# deliver MIME-encapsulated error messages? 30606f25ae9SGregory Neil Shapiro_OPTION(SendMimeErrors, `confMIME_FORMAT_ERRORS', `True') 307c2aa98e2SPeter Wemm 308c2aa98e2SPeter Wemm# Forward file search path 30906f25ae9SGregory Neil Shapiro_OPTION(ForwardPath, `confFORWARD_PATH', `/var/forward/$u:$z/.forward.$w:$z/.forward') 310c2aa98e2SPeter Wemm 311c2aa98e2SPeter Wemm# open connection cache size 31206f25ae9SGregory Neil Shapiro_OPTION(ConnectionCacheSize, `confMCI_CACHE_SIZE', `2') 313c2aa98e2SPeter Wemm 314c2aa98e2SPeter Wemm# open connection cache timeout 31506f25ae9SGregory Neil Shapiro_OPTION(ConnectionCacheTimeout, `confMCI_CACHE_TIMEOUT', `5m') 316c2aa98e2SPeter Wemm 317c2aa98e2SPeter Wemm# persistent host status directory 31806f25ae9SGregory Neil Shapiro_OPTION(HostStatusDirectory, `confHOST_STATUS_DIRECTORY', `.hoststat') 319c2aa98e2SPeter Wemm 320c2aa98e2SPeter Wemm# single thread deliveries (requires HostStatusDirectory)? 32106f25ae9SGregory Neil Shapiro_OPTION(SingleThreadDelivery, `confSINGLE_THREAD_DELIVERY', `False') 322c2aa98e2SPeter Wemm 323c2aa98e2SPeter Wemm# use Errors-To: header? 32406f25ae9SGregory Neil Shapiro_OPTION(UseErrorsTo, `confUSE_ERRORS_TO', `False') 325c2aa98e2SPeter Wemm 326c2aa98e2SPeter Wemm# log level 32706f25ae9SGregory Neil Shapiro_OPTION(LogLevel, `confLOG_LEVEL', `10') 328c2aa98e2SPeter Wemm 329c2aa98e2SPeter Wemm# send to me too, even in an alias expansion? 33006f25ae9SGregory Neil Shapiro_OPTION(MeToo, `confME_TOO', `True') 331c2aa98e2SPeter Wemm 332c2aa98e2SPeter Wemm# verify RHS in newaliases? 33306f25ae9SGregory Neil Shapiro_OPTION(CheckAliases, `confCHECK_ALIASES', `False') 334c2aa98e2SPeter Wemm 335c2aa98e2SPeter Wemm# default messages to old style headers if no special punctuation? 33606f25ae9SGregory Neil Shapiro_OPTION(OldStyleHeaders, `confOLD_STYLE_HEADERS', `False') 337c2aa98e2SPeter Wemm 338c2aa98e2SPeter Wemm# SMTP daemon options 33906f25ae9SGregory Neil Shapiroifelse(defn(`confDAEMON_OPTIONS'), `', `dnl', 340605302a5SGregory Neil Shapiro`errprint(WARNING: `confDAEMON_OPTIONS' is no longer valid. 341605302a5SGregory Neil Shapiro Use `DAEMON_OPTIONS()'; see cf/README. 34206f25ae9SGregory Neil Shapiro)'dnl 34306f25ae9SGregory Neil Shapiro`DAEMON_OPTIONS(`confDAEMON_OPTIONS')') 34442e5d165SGregory Neil Shapiroifelse(defn(`_DPO_'), `', 34540266059SGregory Neil Shapiro`ifdef(`_NETINET6_', `O DaemonPortOptions=Name=MTA-v4, Family=inet 34640266059SGregory Neil ShapiroO DaemonPortOptions=Name=MTA-v6, Family=inet6',`O DaemonPortOptions=Name=MTA')', `_DPO_') 34706f25ae9SGregory Neil Shapiroifdef(`_NO_MSA_', `dnl', `O DaemonPortOptions=Port=587, Name=MSA, M=E') 34806f25ae9SGregory Neil Shapiro 34906f25ae9SGregory Neil Shapiro# SMTP client options 35040266059SGregory Neil Shapiroifelse(defn(`confCLIENT_OPTIONS'), `', `dnl', 35140266059SGregory Neil Shapiro`errprint(WARNING: `confCLIENT_OPTIONS' is no longer valid. See cf/README for more information. 35240266059SGregory Neil Shapiro)'dnl 35340266059SGregory Neil Shapiro`CLIENT_OPTIONS(`confCLIENT_OPTIONS')') 35440266059SGregory Neil Shapiroifelse(defn(`_CPO_'), `', 35540266059SGregory Neil Shapiro`#O ClientPortOptions=Family=inet, Address=0.0.0.0', `_CPO_') 35640266059SGregory Neil Shapiro 35740266059SGregory Neil Shapiro# Modifiers to `define' {daemon_flags} for direct submissions 35840266059SGregory Neil Shapiro_OPTION(DirectSubmissionModifiers, `confDIRECT_SUBMISSION_MODIFIERS', `') 35940266059SGregory Neil Shapiro 36040266059SGregory Neil Shapiro# Use as mail submission program? See sendmail/SECURITY 36140266059SGregory Neil Shapiro_OPTION(UseMSP, `confUSE_MSP', `') 362c2aa98e2SPeter Wemm 363c2aa98e2SPeter Wemm# privacy flags 36406f25ae9SGregory Neil Shapiro_OPTION(PrivacyOptions, `confPRIVACY_FLAGS', `authwarnings') 365c2aa98e2SPeter Wemm 366c2aa98e2SPeter Wemm# who (if anyone) should get extra copies of error messages 36706f25ae9SGregory Neil Shapiro_OPTION(PostmasterCopy, `confCOPY_ERRORS_TO', `Postmaster') 368c2aa98e2SPeter Wemm 369c2aa98e2SPeter Wemm# slope of queue-only function 37006f25ae9SGregory Neil Shapiro_OPTION(QueueFactor, `confQUEUE_FACTOR', `600000') 371c2aa98e2SPeter Wemm 37240266059SGregory Neil Shapiro# limit on number of concurrent queue runners 37340266059SGregory Neil Shapiro_OPTION(MaxQueueChildren, `confMAX_QUEUE_CHILDREN', `') 37440266059SGregory Neil Shapiro 37540266059SGregory Neil Shapiro# maximum number of queue-runners per queue-grouping with multiple queues 37640266059SGregory Neil Shapiro_OPTION(MaxRunnersPerQueue, `confMAX_RUNNERS_PER_QUEUE', `1') 37740266059SGregory Neil Shapiro 37840266059SGregory Neil Shapiro# priority of queue runners (nice(3)) 37940266059SGregory Neil Shapiro_OPTION(NiceQueueRun, `confNICE_QUEUE_RUN', `') 38040266059SGregory Neil Shapiro 38140266059SGregory Neil Shapiro# shall we sort the queue by hostname first? 38240266059SGregory Neil Shapiro_OPTION(QueueSortOrder, `confQUEUE_SORT_ORDER', `priority') 38340266059SGregory Neil Shapiro 38440266059SGregory Neil Shapiro# minimum time in queue before retry 38540266059SGregory Neil Shapiro_OPTION(MinQueueAge, `confMIN_QUEUE_AGE', `30m') 38640266059SGregory Neil Shapiro 38740266059SGregory Neil Shapiro# how many jobs can you process in the queue? 38840266059SGregory Neil Shapiro_OPTION(MaxQueueRunSize, `confMAX_QUEUE_RUN_SIZE', `10000') 38940266059SGregory Neil Shapiro 39040266059SGregory Neil Shapiro# perform initial split of envelope without checking MX records 39140266059SGregory Neil Shapiro_OPTION(FastSplit, `confFAST_SPLIT', `1') 39240266059SGregory Neil Shapiro 393c2aa98e2SPeter Wemm# queue directory 39406f25ae9SGregory Neil ShapiroO QueueDirectory=ifdef(`QUEUE_DIR', QUEUE_DIR, `/var/spool/mqueue') 395c2aa98e2SPeter Wemm 39640266059SGregory Neil Shapiro# key for shared memory; 0 to turn off 39740266059SGregory Neil Shapiro_OPTION(SharedMemoryKey, `confSHARED_MEMORY_KEY', `0') 39840266059SGregory Neil Shapiro 399605302a5SGregory Neil Shapiroifdef(`confSHARED_MEMORY_KEY_FILE', `dnl 400605302a5SGregory Neil Shapiro# file to store key for shared memory (if SharedMemoryKey = -1) 401605302a5SGregory Neil ShapiroO SharedMemoryKeyFile=confSHARED_MEMORY_KEY_FILE') 402605302a5SGregory Neil Shapiro 403c2aa98e2SPeter Wemm# timeouts (many of these) 40406f25ae9SGregory Neil Shapiro_OPTION(Timeout.initial, `confTO_INITIAL', `5m') 40506f25ae9SGregory Neil Shapiro_OPTION(Timeout.connect, `confTO_CONNECT', `5m') 40640266059SGregory Neil Shapiro_OPTION(Timeout.aconnect, `confTO_ACONNECT', `0s') 40706f25ae9SGregory Neil Shapiro_OPTION(Timeout.iconnect, `confTO_ICONNECT', `5m') 40806f25ae9SGregory Neil Shapiro_OPTION(Timeout.helo, `confTO_HELO', `5m') 40906f25ae9SGregory Neil Shapiro_OPTION(Timeout.mail, `confTO_MAIL', `10m') 41006f25ae9SGregory Neil Shapiro_OPTION(Timeout.rcpt, `confTO_RCPT', `1h') 41106f25ae9SGregory Neil Shapiro_OPTION(Timeout.datainit, `confTO_DATAINIT', `5m') 41206f25ae9SGregory Neil Shapiro_OPTION(Timeout.datablock, `confTO_DATABLOCK', `1h') 41306f25ae9SGregory Neil Shapiro_OPTION(Timeout.datafinal, `confTO_DATAFINAL', `1h') 41406f25ae9SGregory Neil Shapiro_OPTION(Timeout.rset, `confTO_RSET', `5m') 41506f25ae9SGregory Neil Shapiro_OPTION(Timeout.quit, `confTO_QUIT', `2m') 41606f25ae9SGregory Neil Shapiro_OPTION(Timeout.misc, `confTO_MISC', `2m') 41706f25ae9SGregory Neil Shapiro_OPTION(Timeout.command, `confTO_COMMAND', `1h') 41806f25ae9SGregory Neil Shapiro_OPTION(Timeout.ident, `confTO_IDENT', `5s') 41906f25ae9SGregory Neil Shapiro_OPTION(Timeout.fileopen, `confTO_FILEOPEN', `60s') 42006f25ae9SGregory Neil Shapiro_OPTION(Timeout.control, `confTO_CONTROL', `2m') 42106f25ae9SGregory Neil Shapiro_OPTION(Timeout.queuereturn, `confTO_QUEUERETURN', `5d') 42206f25ae9SGregory Neil Shapiro_OPTION(Timeout.queuereturn.normal, `confTO_QUEUERETURN_NORMAL', `5d') 42306f25ae9SGregory Neil Shapiro_OPTION(Timeout.queuereturn.urgent, `confTO_QUEUERETURN_URGENT', `2d') 42406f25ae9SGregory Neil Shapiro_OPTION(Timeout.queuereturn.non-urgent, `confTO_QUEUERETURN_NONURGENT', `7d') 42506f25ae9SGregory Neil Shapiro_OPTION(Timeout.queuewarn, `confTO_QUEUEWARN', `4h') 42606f25ae9SGregory Neil Shapiro_OPTION(Timeout.queuewarn.normal, `confTO_QUEUEWARN_NORMAL', `4h') 42706f25ae9SGregory Neil Shapiro_OPTION(Timeout.queuewarn.urgent, `confTO_QUEUEWARN_URGENT', `1h') 42806f25ae9SGregory Neil Shapiro_OPTION(Timeout.queuewarn.non-urgent, `confTO_QUEUEWARN_NONURGENT', `12h') 42906f25ae9SGregory Neil Shapiro_OPTION(Timeout.hoststatus, `confTO_HOSTSTATUS', `30m') 43006f25ae9SGregory Neil Shapiro_OPTION(Timeout.resolver.retrans, `confTO_RESOLVER_RETRANS', `5s') 43106f25ae9SGregory Neil Shapiro_OPTION(Timeout.resolver.retrans.first, `confTO_RESOLVER_RETRANS_FIRST', `5s') 43206f25ae9SGregory Neil Shapiro_OPTION(Timeout.resolver.retrans.normal, `confTO_RESOLVER_RETRANS_NORMAL', `5s') 43306f25ae9SGregory Neil Shapiro_OPTION(Timeout.resolver.retry, `confTO_RESOLVER_RETRY', `4') 43406f25ae9SGregory Neil Shapiro_OPTION(Timeout.resolver.retry.first, `confTO_RESOLVER_RETRY_FIRST', `4') 43506f25ae9SGregory Neil Shapiro_OPTION(Timeout.resolver.retry.normal, `confTO_RESOLVER_RETRY_NORMAL', `4') 43640266059SGregory Neil Shapiro_OPTION(Timeout.lhlo, `confTO_LHLO', `2m') 43740266059SGregory Neil Shapiro_OPTION(Timeout.auth, `confTO_AUTH', `10m') 43840266059SGregory Neil Shapiro_OPTION(Timeout.starttls, `confTO_STARTTLS', `1h') 43940266059SGregory Neil Shapiro 44040266059SGregory Neil Shapiro# time for DeliverBy; extension disabled if less than 0 44140266059SGregory Neil Shapiro_OPTION(DeliverByMin, `confDELIVER_BY_MIN', `0') 442c2aa98e2SPeter Wemm 443c2aa98e2SPeter Wemm# should we not prune routes in route-addr syntax addresses? 44406f25ae9SGregory Neil Shapiro_OPTION(DontPruneRoutes, `confDONT_PRUNE_ROUTES', `False') 445c2aa98e2SPeter Wemm 446c2aa98e2SPeter Wemm# queue up everything before forking? 44706f25ae9SGregory Neil Shapiro_OPTION(SuperSafe, `confSAFE_QUEUE', `True') 448c2aa98e2SPeter Wemm 449c2aa98e2SPeter Wemm# status file 45006f25ae9SGregory Neil ShapiroO StatusFile=ifdef(`STATUS_FILE', `STATUS_FILE', `MAIL_SETTINGS_DIR`'statistics') 451c2aa98e2SPeter Wemm 452c2aa98e2SPeter Wemm# time zone handling: 453c2aa98e2SPeter Wemm# if undefined, use system default 454c2aa98e2SPeter Wemm# if defined but null, use TZ envariable passed in 455c2aa98e2SPeter Wemm# if defined and non-null, use that info 456c2aa98e2SPeter Wemmifelse(confTIME_ZONE, `USE_SYSTEM', `#O TimeZoneSpec=', 457c2aa98e2SPeter Wemm confTIME_ZONE, `USE_TZ', `O TimeZoneSpec=', 458c2aa98e2SPeter Wemm `O TimeZoneSpec=confTIME_ZONE') 459c2aa98e2SPeter Wemm 460c2aa98e2SPeter Wemm# default UID (can be username or userid:groupid) 46106f25ae9SGregory Neil Shapiro_OPTION(DefaultUser, `confDEF_USER_ID', `mailnull') 462c2aa98e2SPeter Wemm 463c2aa98e2SPeter Wemm# list of locations of user database file (null means no lookup) 46406f25ae9SGregory Neil Shapiro_OPTION(UserDatabaseSpec, `confUSERDB_SPEC', `MAIL_SETTINGS_DIR`'userdb') 465c2aa98e2SPeter Wemm 466c2aa98e2SPeter Wemm# fallback MX host 46706f25ae9SGregory Neil Shapiro_OPTION(FallbackMXhost, `confFALLBACK_MX', `fall.back.host.net') 468c2aa98e2SPeter Wemm 469c2aa98e2SPeter Wemm# if we are the best MX host for a site, try it directly instead of config err 47006f25ae9SGregory Neil Shapiro_OPTION(TryNullMXList, `confTRY_NULL_MX_LIST', `False') 471c2aa98e2SPeter Wemm 472c2aa98e2SPeter Wemm# load average at which we just queue messages 47306f25ae9SGregory Neil Shapiro_OPTION(QueueLA, `confQUEUE_LA', `8') 474c2aa98e2SPeter Wemm 475c2aa98e2SPeter Wemm# load average at which we refuse connections 47606f25ae9SGregory Neil Shapiro_OPTION(RefuseLA, `confREFUSE_LA', `12') 477c2aa98e2SPeter Wemm 47840266059SGregory Neil Shapiro# load average at which we delay connections; 0 means no limit 47940266059SGregory Neil Shapiro_OPTION(DelayLA, `confDELAY_LA', `0') 48040266059SGregory Neil Shapiro 481c2aa98e2SPeter Wemm# maximum number of children we allow at one time 48206f25ae9SGregory Neil Shapiro_OPTION(MaxDaemonChildren, `confMAX_DAEMON_CHILDREN', `12') 483c2aa98e2SPeter Wemm 484c2aa98e2SPeter Wemm# maximum number of new connections per second 485193538b7SGregory Neil Shapiro_OPTION(ConnectionRateThrottle, `confCONNECTION_RATE_THROTTLE', `0') 486c2aa98e2SPeter Wemm 487c2aa98e2SPeter Wemm# work recipient factor 48806f25ae9SGregory Neil Shapiro_OPTION(RecipientFactor, `confWORK_RECIPIENT_FACTOR', `30000') 489c2aa98e2SPeter Wemm 490c2aa98e2SPeter Wemm# deliver each queued job in a separate process? 49106f25ae9SGregory Neil Shapiro_OPTION(ForkEachJob, `confSEPARATE_PROC', `False') 492c2aa98e2SPeter Wemm 493c2aa98e2SPeter Wemm# work class factor 49406f25ae9SGregory Neil Shapiro_OPTION(ClassFactor, `confWORK_CLASS_FACTOR', `1800') 495c2aa98e2SPeter Wemm 496c2aa98e2SPeter Wemm# work time factor 49706f25ae9SGregory Neil Shapiro_OPTION(RetryFactor, `confWORK_TIME_FACTOR', `90000') 498c2aa98e2SPeter Wemm 499c2aa98e2SPeter Wemm# default character set 50006f25ae9SGregory Neil Shapiro_OPTION(DefaultCharSet, `confDEF_CHAR_SET', `iso-8859-1') 501c2aa98e2SPeter Wemm 50240266059SGregory Neil Shapiro# service switch file (name hardwired on Solaris, Ultrix, OSF/1, others) 50306f25ae9SGregory Neil Shapiro_OPTION(ServiceSwitchFile, `confSERVICE_SWITCH_FILE', `MAIL_SETTINGS_DIR`'service.switch') 504c2aa98e2SPeter Wemm 505c2aa98e2SPeter Wemm# hosts file (normally /etc/hosts) 50606f25ae9SGregory Neil Shapiro_OPTION(HostsFile, `confHOSTS_FILE', `/etc/hosts') 507c2aa98e2SPeter Wemm 508c2aa98e2SPeter Wemm# dialup line delay on connection failure 50906f25ae9SGregory Neil Shapiro_OPTION(DialDelay, `confDIAL_DELAY', `10s') 510c2aa98e2SPeter Wemm 511c2aa98e2SPeter Wemm# action to take if there are no recipients in the message 51206f25ae9SGregory Neil Shapiro_OPTION(NoRecipientAction, `confNO_RCPT_ACTION', `add-to-undisclosed') 513c2aa98e2SPeter Wemm 514c2aa98e2SPeter Wemm# chrooted environment for writing to files 51506f25ae9SGregory Neil Shapiro_OPTION(SafeFileEnvironment, `confSAFE_FILE_ENV', `/arch') 516c2aa98e2SPeter Wemm 517c2aa98e2SPeter Wemm# are colons OK in addresses? 51806f25ae9SGregory Neil Shapiro_OPTION(ColonOkInAddr, `confCOLON_OK_IN_ADDR', `True') 519c2aa98e2SPeter Wemm 520c2aa98e2SPeter Wemm# shall I avoid expanding CNAMEs (violates protocols)? 52106f25ae9SGregory Neil Shapiro_OPTION(DontExpandCnames, `confDONT_EXPAND_CNAMES', `False') 522c2aa98e2SPeter Wemm 523c2aa98e2SPeter Wemm# SMTP initial login message (old $e macro) 52406f25ae9SGregory Neil Shapiro_OPTION(SmtpGreetingMessage, `confSMTP_LOGIN_MSG', `$j Sendmail $v ready at $b') 525c2aa98e2SPeter Wemm 526c2aa98e2SPeter Wemm# UNIX initial From header format (old $l macro) 52706f25ae9SGregory Neil Shapiro_OPTION(UnixFromLine, `confFROM_LINE', `From $g $d') 528c2aa98e2SPeter Wemm 529c2aa98e2SPeter Wemm# From: lines that have embedded newlines are unwrapped onto one line 53006f25ae9SGregory Neil Shapiro_OPTION(SingleLineFromHeader, `confSINGLE_LINE_FROM_HEADER', `False') 531c2aa98e2SPeter Wemm 532c2aa98e2SPeter Wemm# Allow HELO SMTP command that does not `include' a host name 53306f25ae9SGregory Neil Shapiro_OPTION(AllowBogusHELO, `confALLOW_BOGUS_HELO', `False') 534c2aa98e2SPeter Wemm 535c2aa98e2SPeter Wemm# Characters to be quoted in a full name phrase (@,;:\()[] are automatic) 53606f25ae9SGregory Neil Shapiro_OPTION(MustQuoteChars, `confMUST_QUOTE_CHARS', `.') 537c2aa98e2SPeter Wemm 538c2aa98e2SPeter Wemm# delimiter (operator) characters (old $o macro) 53906f25ae9SGregory Neil Shapiro_OPTION(OperatorChars, `confOPERATORS', `.:@[]') 540c2aa98e2SPeter Wemm 541c2aa98e2SPeter Wemm# shall I avoid calling initgroups(3) because of high NIS costs? 54206f25ae9SGregory Neil Shapiro_OPTION(DontInitGroups, `confDONT_INIT_GROUPS', `False') 543c2aa98e2SPeter Wemm 544c2aa98e2SPeter Wemm# are group-writable `:include:' and .forward files (un)trustworthy? 54540266059SGregory Neil Shapiro# True (the default) means they are not trustworthy. 54606f25ae9SGregory Neil Shapiro_OPTION(UnsafeGroupWrites, `confUNSAFE_GROUP_WRITES', `True') 54740266059SGregory Neil Shapiroifdef(`confUNSAFE_GROUP_WRITES', 54840266059SGregory Neil Shapiro`errprint(`WARNING: confUNSAFE_GROUP_WRITES is deprecated; use confDONT_BLAME_SENDMAIL. 54940266059SGregory Neil Shapiro')') 550c2aa98e2SPeter Wemm 551c2aa98e2SPeter Wemm# where do errors that occur when sending errors get sent? 55206f25ae9SGregory Neil Shapiro_OPTION(DoubleBounceAddress, `confDOUBLE_BOUNCE_ADDRESS', `postmaster') 55306f25ae9SGregory Neil Shapiro 55406f25ae9SGregory Neil Shapiro# where to save bounces if all else fails 55506f25ae9SGregory Neil Shapiro_OPTION(DeadLetterDrop, `confDEAD_LETTER_DROP', `/var/tmp/dead.letter') 556c2aa98e2SPeter Wemm 557c2aa98e2SPeter Wemm# what user id do we assume for the majority of the processing? 55806f25ae9SGregory Neil Shapiro_OPTION(RunAsUser, `confRUN_AS_USER', `sendmail') 559c2aa98e2SPeter Wemm 560c2aa98e2SPeter Wemm# maximum number of recipients per SMTP envelope 56106f25ae9SGregory Neil Shapiro_OPTION(MaxRecipientsPerMessage, `confMAX_RCPTS_PER_MESSAGE', `100') 562c2aa98e2SPeter Wemm 56340266059SGregory Neil Shapiro# limit the rate recipients per SMTP envelope are accepted 56440266059SGregory Neil Shapiro# once the threshold number of recipients have been rejected 56540266059SGregory Neil Shapiro_OPTION(BadRcptThrottle, `confBAD_RCPT_THROTTLE', `20') 56640266059SGregory Neil Shapiro 567c2aa98e2SPeter Wemm# shall we get local names from our installed interfaces? 56806f25ae9SGregory Neil Shapiro_OPTION(DontProbeInterfaces, `confDONT_PROBE_INTERFACES', `False') 569c2aa98e2SPeter Wemm 57006f25ae9SGregory Neil Shapiro# Return-Receipt-To: header implies DSN request 57106f25ae9SGregory Neil Shapiro_OPTION(RrtImpliesDsn, `confRRT_IMPLIES_DSN', `False') 57206f25ae9SGregory Neil Shapiro 57306f25ae9SGregory Neil Shapiro# override connection address (for testing) 57406f25ae9SGregory Neil Shapiro_OPTION(ConnectOnlyTo, `confCONNECT_ONLY_TO', `0.0.0.0') 57506f25ae9SGregory Neil Shapiro 57606f25ae9SGregory Neil Shapiro# Trusted user for file ownership and starting the daemon 57706f25ae9SGregory Neil Shapiro_OPTION(TrustedUser, `confTRUSTED_USER', `root') 57806f25ae9SGregory Neil Shapiro 57906f25ae9SGregory Neil Shapiro# Control socket for daemon management 58006f25ae9SGregory Neil Shapiro_OPTION(ControlSocketName, `confCONTROL_SOCKET_NAME', `/var/spool/mqueue/.control') 58106f25ae9SGregory Neil Shapiro 58206f25ae9SGregory Neil Shapiro# Maximum MIME header length to protect MUAs 58306f25ae9SGregory Neil Shapiro_OPTION(MaxMimeHeaderLength, `confMAX_MIME_HEADER_LENGTH', `0/0') 58406f25ae9SGregory Neil Shapiro 58506f25ae9SGregory Neil Shapiro# Maximum length of the sum of all headers 58606f25ae9SGregory Neil Shapiro_OPTION(MaxHeadersLength, `confMAX_HEADERS_LENGTH', `32768') 58706f25ae9SGregory Neil Shapiro 58806f25ae9SGregory Neil Shapiro# Maximum depth of alias recursion 58906f25ae9SGregory Neil Shapiro_OPTION(MaxAliasRecursion, `confMAX_ALIAS_RECURSION', `10') 59006f25ae9SGregory Neil Shapiro 59106f25ae9SGregory Neil Shapiro# location of pid file 59206f25ae9SGregory Neil Shapiro_OPTION(PidFile, `confPID_FILE', `/var/run/sendmail.pid') 59306f25ae9SGregory Neil Shapiro 59406f25ae9SGregory Neil Shapiro# Prefix string for the process title shown on 'ps' listings 59506f25ae9SGregory Neil Shapiro_OPTION(ProcessTitlePrefix, `confPROCESS_TITLE_PREFIX', `prefix') 59606f25ae9SGregory Neil Shapiro 59706f25ae9SGregory Neil Shapiro# Data file (df) memory-buffer file maximum size 59806f25ae9SGregory Neil Shapiro_OPTION(DataFileBufferSize, `confDF_BUFFER_SIZE', `4096') 59906f25ae9SGregory Neil Shapiro 60006f25ae9SGregory Neil Shapiro# Transcript file (xf) memory-buffer file maximum size 60106f25ae9SGregory Neil Shapiro_OPTION(XscriptFileBufferSize, `confXF_BUFFER_SIZE', `4096') 60206f25ae9SGregory Neil Shapiro 60340266059SGregory Neil Shapiro# lookup type to find information about local mailboxes 60440266059SGregory Neil Shapiro_OPTION(MailboxDatabase, `confMAILBOX_DATABASE', `pw') 60540266059SGregory Neil Shapiro 60606f25ae9SGregory Neil Shapiro# list of authentication mechanisms 60740266059SGregory Neil Shapiro_OPTION(AuthMechanisms, `confAUTH_MECHANISMS', `EXTERNAL GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5') 60806f25ae9SGregory Neil Shapiro 60906f25ae9SGregory Neil Shapiro# default authentication information for outgoing connections 61006f25ae9SGregory Neil Shapiro_OPTION(DefaultAuthInfo, `confDEF_AUTH_INFO', `MAIL_SETTINGS_DIR`'default-auth-info') 61106f25ae9SGregory Neil Shapiro 61206f25ae9SGregory Neil Shapiro# SMTP AUTH flags 61306f25ae9SGregory Neil Shapiro_OPTION(AuthOptions, `confAUTH_OPTIONS', `') 61406f25ae9SGregory Neil Shapiro 61540266059SGregory Neil Shapiro# SMTP AUTH maximum encryption strength 61640266059SGregory Neil Shapiro_OPTION(AuthMaxBits, `confAUTH_MAX_BITS', `') 61740266059SGregory Neil Shapiro 61840266059SGregory Neil Shapiro# SMTP STARTTLS server options 61940266059SGregory Neil Shapiro_OPTION(TLSSrvOptions, `confTLS_SRV_OPTIONS', `') 62040266059SGregory Neil Shapiro 62106f25ae9SGregory Neil Shapiro# Input mail filters 62206f25ae9SGregory Neil Shapiro_OPTION(InputMailFilters, `confINPUT_MAIL_FILTERS', `') 62306f25ae9SGregory Neil Shapiro 62440266059SGregory Neil Shapiroifdef(`confINPUT_MAIL_FILTERS', `dnl 62506f25ae9SGregory Neil Shapiro# Milter options 62640266059SGregory Neil Shapiro_OPTION(Milter.LogLevel, `confMILTER_LOG_LEVEL', `') 62706f25ae9SGregory Neil Shapiro_OPTION(Milter.macros.connect, `confMILTER_MACROS_CONNECT', `') 62806f25ae9SGregory Neil Shapiro_OPTION(Milter.macros.helo, `confMILTER_MACROS_HELO', `') 62906f25ae9SGregory Neil Shapiro_OPTION(Milter.macros.envfrom, `confMILTER_MACROS_ENVFROM', `') 63006f25ae9SGregory Neil Shapiro_OPTION(Milter.macros.envrcpt, `confMILTER_MACROS_ENVRCPT', `')') 63106f25ae9SGregory Neil Shapiro 63206f25ae9SGregory Neil Shapiro# CA directory 63306f25ae9SGregory Neil Shapiro_OPTION(CACERTPath, `confCACERT_PATH', `') 63406f25ae9SGregory Neil Shapiro# CA file 63506f25ae9SGregory Neil Shapiro_OPTION(CACERTFile, `confCACERT', `') 63606f25ae9SGregory Neil Shapiro# Server Cert 63706f25ae9SGregory Neil Shapiro_OPTION(ServerCertFile, `confSERVER_CERT', `') 63806f25ae9SGregory Neil Shapiro# Server private key 63906f25ae9SGregory Neil Shapiro_OPTION(ServerKeyFile, `confSERVER_KEY', `') 64006f25ae9SGregory Neil Shapiro# Client Cert 64106f25ae9SGregory Neil Shapiro_OPTION(ClientCertFile, `confCLIENT_CERT', `') 64206f25ae9SGregory Neil Shapiro# Client private key 64306f25ae9SGregory Neil Shapiro_OPTION(ClientKeyFile, `confCLIENT_KEY', `') 64406f25ae9SGregory Neil Shapiro# DHParameters (only required if DSA/DH is used) 64506f25ae9SGregory Neil Shapiro_OPTION(DHParameters, `confDH_PARAMETERS', `') 64606f25ae9SGregory Neil Shapiro# Random data source (required for systems without /dev/urandom under OpenSSL) 64706f25ae9SGregory Neil Shapiro_OPTION(RandFile, `confRAND_FILE', `') 64806f25ae9SGregory Neil Shapiro 64940266059SGregory Neil Shapiro############################ 65040266059SGregory Neil Shapiro`# QUEUE GROUP DEFINITIONS #' 65140266059SGregory Neil Shapiro############################ 65240266059SGregory Neil Shapiro_QUEUE_GROUP_ 653065a643dSPeter Wemm 654c2aa98e2SPeter Wemm########################### 655c2aa98e2SPeter Wemm# Message precedences # 656c2aa98e2SPeter Wemm########################### 657c2aa98e2SPeter Wemm 658c2aa98e2SPeter WemmPfirst-class=0 659c2aa98e2SPeter WemmPspecial-delivery=100 660c2aa98e2SPeter WemmPlist=-30 661c2aa98e2SPeter WemmPbulk=-60 662c2aa98e2SPeter WemmPjunk=-100 663c2aa98e2SPeter Wemm 664c2aa98e2SPeter Wemm##################### 665c2aa98e2SPeter Wemm# Trusted users # 666c2aa98e2SPeter Wemm##################### 667c2aa98e2SPeter Wemm 668c2aa98e2SPeter Wemm# this is equivalent to setting class "t" 66906f25ae9SGregory Neil Shapiroifdef(`_USE_CT_FILE_', `', `#')Ft`'ifdef(`confCT_FILE', confCT_FILE, `MAIL_SETTINGS_DIR`'trusted-users') 670c2aa98e2SPeter WemmTroot 671c2aa98e2SPeter WemmTdaemon 672c2aa98e2SPeter Wemmifdef(`_NO_UUCP_', `dnl', `Tuucp') 673c2aa98e2SPeter Wemmifdef(`confTRUSTED_USERS', `T`'confTRUSTED_USERS', `dnl') 674c2aa98e2SPeter Wemm 675c2aa98e2SPeter Wemm######################### 676c2aa98e2SPeter Wemm# Format of headers # 677c2aa98e2SPeter Wemm######################### 678c2aa98e2SPeter Wemm 679c2aa98e2SPeter Wemmifdef(`confFROM_HEADER',, `define(`confFROM_HEADER', `$?x$x <$g>$|$g$.')')dnl 680c2aa98e2SPeter WemmH?P?Return-Path: <$g> 681c2aa98e2SPeter WemmHReceived: confRECEIVED_HEADER 682c2aa98e2SPeter WemmH?D?Resent-Date: $a 683c2aa98e2SPeter WemmH?D?Date: $a 684c2aa98e2SPeter WemmH?F?Resent-From: confFROM_HEADER 685c2aa98e2SPeter WemmH?F?From: confFROM_HEADER 686c2aa98e2SPeter WemmH?x?Full-Name: $x 687c2aa98e2SPeter Wemm# HPosted-Date: $a 688c2aa98e2SPeter Wemm# H?l?Received-Date: $b 689c2aa98e2SPeter WemmH?M?Resent-Message-Id: <$t.$i@$j> 690c2aa98e2SPeter WemmH?M?Message-Id: <$t.$i@$j> 69106f25ae9SGregory Neil Shapiro 692c2aa98e2SPeter Wemm# 693c2aa98e2SPeter Wemm###################################################################### 694c2aa98e2SPeter Wemm###################################################################### 695c2aa98e2SPeter Wemm##### 696c2aa98e2SPeter Wemm##### REWRITING RULES 697c2aa98e2SPeter Wemm##### 698c2aa98e2SPeter Wemm###################################################################### 699c2aa98e2SPeter Wemm###################################################################### 700c2aa98e2SPeter Wemm 701c2aa98e2SPeter Wemm############################################ 702c2aa98e2SPeter Wemm### Ruleset 3 -- Name Canonicalization ### 703c2aa98e2SPeter Wemm############################################ 70406f25ae9SGregory Neil ShapiroScanonify=3 705c2aa98e2SPeter Wemm 706c2aa98e2SPeter Wemm# handle null input (translate to <@> special case) 707c2aa98e2SPeter WemmR$@ $@ <@> 708c2aa98e2SPeter Wemm 709c2aa98e2SPeter Wemm# strip group: syntax (not inside angle brackets!) and trailing semicolon 710c2aa98e2SPeter WemmR$* $: $1 <@> mark addresses 711c2aa98e2SPeter WemmR$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr> 712c2aa98e2SPeter WemmR@ $* <@> $: @ $1 unmark @host:... 71340266059SGregory Neil ShapiroR$* [ IPv6 : $+ ] <@> $: $1 [ IPv6 : $2 ] unmark IPv6 addr 714c2aa98e2SPeter WemmR$* :: $* <@> $: $1 :: $2 unmark node::addr 715c2aa98e2SPeter WemmR:`include': $* <@> $: :`include': $1 unmark :`include':... 716c2aa98e2SPeter WemmR$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon 717c2aa98e2SPeter WemmR$* : $* <@> $: $2 strip colon if marked 718c2aa98e2SPeter WemmR$* <@> $: $1 unmark 719c2aa98e2SPeter WemmR$* ; $1 strip trailing semi 720193538b7SGregory Neil ShapiroR$* < $+ :; > $* $@ $2 :; <@> catch <list:;> 721c2aa98e2SPeter WemmR$* < $* ; > $1 < $2 > bogus bracketed semi 722c2aa98e2SPeter Wemm 723c2aa98e2SPeter Wemm# null input now results from list:; syntax 724c2aa98e2SPeter WemmR$@ $@ :; <@> 725c2aa98e2SPeter Wemm 726c2aa98e2SPeter Wemm# strip angle brackets -- note RFC733 heuristic to get innermost item 727c2aa98e2SPeter WemmR$* $: < $1 > housekeeping <> 728c2aa98e2SPeter WemmR$+ < $* > < $2 > strip excess on left 729c2aa98e2SPeter WemmR< $* > $+ < $1 > strip excess on right 730c2aa98e2SPeter WemmR<> $@ < @ > MAIL FROM:<> case 731c2aa98e2SPeter WemmR< $+ > $: $1 remove housekeeping <> 732c2aa98e2SPeter Wemm 73306f25ae9SGregory Neil Shapiroifdef(`_USE_DEPRECATED_ROUTE_ADDR_',`dnl 734c2aa98e2SPeter Wemm# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 735c2aa98e2SPeter WemmR@ $+ , $+ @ $1 : $2 change all "," to ":" 736c2aa98e2SPeter Wemm 737c2aa98e2SPeter Wemm# localize and dispose of route-based addresses 73840266059SGregory Neil Shapirodnl XXX: IPv6 colon conflict 73940266059SGregory Neil Shapiroifdef(`NO_NETINET6', `dnl', 74040266059SGregory Neil Shapiro`R@ [$+] : $+ $@ $>Canonify2 < @ [$1] > : $2 handle <route-addr>') 74106f25ae9SGregory Neil ShapiroR@ $+ : $+ $@ $>Canonify2 < @$1 > : $2 handle <route-addr> 74206f25ae9SGregory Neil Shapirodnl',`dnl 74306f25ae9SGregory Neil Shapiro# strip route address <@a,@b,@c:user@d> -> <user@d> 74406f25ae9SGregory Neil ShapiroR@ $+ , $+ $2 74540266059SGregory Neil Shapiroifdef(`NO_NETINET6', `dnl', 74640266059SGregory Neil Shapiro`R@ [ $* ] : $+ $2') 74706f25ae9SGregory Neil ShapiroR@ $+ : $+ $2 74806f25ae9SGregory Neil Shapirodnl') 749c2aa98e2SPeter Wemm 750c2aa98e2SPeter Wemm# find focus for list syntax 75106f25ae9SGregory Neil ShapiroR $+ : $* ; @ $+ $@ $>Canonify2 $1 : $2 ; < @ $3 > list syntax 752c2aa98e2SPeter WemmR $+ : $* ; $@ $1 : $2; list syntax 753c2aa98e2SPeter Wemm 754c2aa98e2SPeter Wemm# find focus for @ syntax addresses 755c2aa98e2SPeter WemmR$+ @ $+ $: $1 < @ $2 > focus on domain 756c2aa98e2SPeter WemmR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 75706f25ae9SGregory Neil ShapiroR$+ < @ $+ > $@ $>Canonify2 $1 < @ $2 > already canonical 758c2aa98e2SPeter Wemm 75940266059SGregory Neil Shapirodnl This is flagged as an error in S0; no need to silently fix it here. 76040266059SGregory Neil Shapirodnl # do some sanity checking 76140266059SGregory Neil Shapirodnl R$* < @ $~[ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs 762c2aa98e2SPeter Wemm 763c2aa98e2SPeter Wemmifdef(`_NO_UUCP_', `dnl', 764c2aa98e2SPeter Wemm`# convert old-style addresses to a domain-based address 76506f25ae9SGregory Neil ShapiroR$- ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > resolve uucp names 76606f25ae9SGregory Neil ShapiroR$+ . $- ! $+ $@ $>Canonify2 $3 < @ $1 . $2 > domain uucps 76706f25ae9SGregory Neil ShapiroR$+ ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > uucp subdomains 768c2aa98e2SPeter Wemm') 769c2aa98e2SPeter Wemmifdef(`_USE_DECNET_SYNTAX_', 770c2aa98e2SPeter Wemm`# convert node::user addresses into a domain-based address 77106f25ae9SGregory Neil ShapiroR$- :: $+ $@ $>Canonify2 $2 < @ $1 .DECNET > resolve DECnet names 77206f25ae9SGregory Neil ShapiroR$- . $- :: $+ $@ $>Canonify2 $3 < @ $1.$2 .DECNET > numeric DECnet addr 773c2aa98e2SPeter Wemm', 774c2aa98e2SPeter Wemm `dnl') 775c2aa98e2SPeter Wemm# if we have % signs, take the rightmost one 776c2aa98e2SPeter WemmR$* % $* $1 @ $2 First make them all @s. 777c2aa98e2SPeter WemmR$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 77806f25ae9SGregory Neil ShapiroR$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish 779c2aa98e2SPeter Wemm 780c2aa98e2SPeter Wemm# else we must be a local name 78106f25ae9SGregory Neil ShapiroR$* $@ $>Canonify2 $1 782c2aa98e2SPeter Wemm 783c2aa98e2SPeter Wemm 784c2aa98e2SPeter Wemm################################################ 785c2aa98e2SPeter Wemm### Ruleset 96 -- bottom half of ruleset 3 ### 786c2aa98e2SPeter Wemm################################################ 787c2aa98e2SPeter Wemm 78806f25ae9SGregory Neil ShapiroSCanonify2=96 789c2aa98e2SPeter Wemm 790c2aa98e2SPeter Wemm# handle special cases for local names 791c2aa98e2SPeter WemmR$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 792c2aa98e2SPeter WemmR$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 793c2aa98e2SPeter Wemmifdef(`_NO_UUCP_', `dnl', 794c2aa98e2SPeter Wemm`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 79506f25ae9SGregory Neil Shapiro 79640266059SGregory Neil Shapiro# check for IPv4/IPv6 domain literal 79740266059SGregory Neil ShapiroR$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [addr] 798c2aa98e2SPeter WemmR$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal 799c2aa98e2SPeter WemmR$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr 800c2aa98e2SPeter Wemm 80106f25ae9SGregory Neil Shapiroifdef(`_DOMAIN_TABLE_', `dnl 802c2aa98e2SPeter Wemm# look up domains in the domain table 803c2aa98e2SPeter WemmR$* < @ $+ > $* $: $1 < @ $(domaintable $2 $) > $3', `dnl') 804c2aa98e2SPeter Wemm 80506f25ae9SGregory Neil Shapiroundivert(2)dnl LOCAL_RULE_3 806c2aa98e2SPeter Wemm 80706f25ae9SGregory Neil Shapiroifdef(`_BITDOMAIN_TABLE_', `dnl 808c2aa98e2SPeter Wemm# handle BITNET mapping 809c2aa98e2SPeter WemmR$* < @ $+ .BITNET > $* $: $1 < @ $(bitdomain $2 $: $2.BITNET $) > $3', `dnl') 810c2aa98e2SPeter Wemm 81106f25ae9SGregory Neil Shapiroifdef(`_UUDOMAIN_TABLE_', `dnl 812c2aa98e2SPeter Wemm# handle UUCP mapping 813c2aa98e2SPeter WemmR$* < @ $+ .UUCP > $* $: $1 < @ $(uudomain $2 $: $2.UUCP $) > $3', `dnl') 814c2aa98e2SPeter Wemm 815c2aa98e2SPeter Wemmifdef(`_NO_UUCP_', `dnl', 816c2aa98e2SPeter Wemm`ifdef(`UUCP_RELAY', 817c2aa98e2SPeter Wemm`# pass UUCP addresses straight through 818c2aa98e2SPeter WemmR$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', 819c2aa98e2SPeter Wemm`# if really UUCP, handle it immediately 820c2aa98e2SPeter Wemmifdef(`_CLASS_U_', 821c2aa98e2SPeter Wemm`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 822c2aa98e2SPeter Wemmifdef(`_CLASS_V_', 823c2aa98e2SPeter Wemm`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 824c2aa98e2SPeter Wemmifdef(`_CLASS_W_', 825c2aa98e2SPeter Wemm`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 826c2aa98e2SPeter Wemmifdef(`_CLASS_X_', 827c2aa98e2SPeter Wemm`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 828c2aa98e2SPeter Wemmifdef(`_CLASS_Y_', 829c2aa98e2SPeter Wemm`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 830c2aa98e2SPeter Wemm 831c2aa98e2SPeter Wemmifdef(`_NO_CANONIFY_', `dnl', `dnl 832c2aa98e2SPeter Wemm# try UUCP traffic as a local address 833c2aa98e2SPeter WemmR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3 834c2aa98e2SPeter WemmR$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3') 835c2aa98e2SPeter Wemm')') 83606f25ae9SGregory Neil Shapiro# hostnames ending in class P are always canonical 83706f25ae9SGregory Neil ShapiroR$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 83806f25ae9SGregory Neil Shapirodnl apply the next rule only for hostnames not in class P 83906f25ae9SGregory Neil Shapirodnl this even works for phrases in class P since . is in class P 84006f25ae9SGregory Neil Shapirodnl which daemon flags are set? 84106f25ae9SGregory Neil ShapiroR$* < @ $* $~P > $* $: $&{daemon_flags} $| $1 < @ $2 $3 > $4 84206f25ae9SGregory Neil Shapirodnl the other rules in this section only apply if the hostname 84306f25ae9SGregory Neil Shapirodnl does not end in class P hence no further checks are done here 84406f25ae9SGregory Neil Shapirodnl if this ever changes make sure the lookups are "protected" again! 84506f25ae9SGregory Neil Shapiroifdef(`_NO_CANONIFY_', `dnl 84606f25ae9SGregory Neil Shapirodnl do not canonify unless: 84706f25ae9SGregory Neil Shapirodnl domain ends in class {Canonify} (this does not work if the intersection 84806f25ae9SGregory Neil Shapirodnl with class P is non-empty) 84906f25ae9SGregory Neil Shapirodnl or {daemon_flags} has c set 85006f25ae9SGregory Neil Shapiro# pass to name server to make hostname canonical if in class {Canonify} 85106f25ae9SGregory Neil ShapiroR$* $| $* < @ $* $={Canonify} > $* $: $2 < @ $[ $3 $4 $] > $5 85206f25ae9SGregory Neil Shapiro# pass to name server to make hostname canonical if requested 85306f25ae9SGregory Neil ShapiroR$* c $* $| $* < @ $* > $* $: $3 < @ $[ $4 $] > $5 85406f25ae9SGregory Neil Shapirodnl trailing dot? -> do not apply _CANONIFY_HOSTS_ 85506f25ae9SGregory Neil ShapiroR$* $| $* < @ $+ . > $* $: $2 < @ $3 . > $4 85606f25ae9SGregory Neil Shapiro# add a trailing dot to qualified hostnames so other rules will work 85706f25ae9SGregory Neil ShapiroR$* $| $* < @ $+.$+ > $* $: $2 < @ $3.$4 . > $5 85806f25ae9SGregory Neil Shapiroifdef(`_CANONIFY_HOSTS_', `dnl 85906f25ae9SGregory Neil Shapirodnl this should only apply to unqualified hostnames 86006f25ae9SGregory Neil Shapirodnl but if a valid character inside an unqualified hostname is an OperatorChar 86106f25ae9SGregory Neil Shapirodnl then $- does not work. 86206f25ae9SGregory Neil Shapiro# lookup unqualified hostnames 86306f25ae9SGregory Neil ShapiroR$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4', `dnl')', `dnl 86406f25ae9SGregory Neil Shapirodnl _NO_CANONIFY_ is not set: canonify unless: 86506f25ae9SGregory Neil Shapirodnl {daemon_flags} contains CC (do not canonify) 866193538b7SGregory Neil Shapirodnl but add a trailing dot to qualified hostnames so other rules will work 867193538b7SGregory Neil Shapirodnl should we do this for every hostname: even unqualified? 868193538b7SGregory Neil ShapiroR$* CC $* $| $* < @ $+.$+ > $* $: $3 < @ $4.$5 . > $6 86906f25ae9SGregory Neil ShapiroR$* CC $* $| $* $: $3 87040266059SGregory Neil Shapiroifdef(`_FFR_NOCANONIFY_HEADERS', `dnl 87140266059SGregory Neil Shapiro# do not canonify header addresses 87240266059SGregory Neil ShapiroR$* $| $* < @ $* $~P > $* $: $&{addr_type} $| $2 < @ $3 $4 > $5 87340266059SGregory Neil ShapiroR$* h $* $| $* < @ $+.$+ > $* $: $3 < @ $4.$5 . > $6 87440266059SGregory Neil ShapiroR$* h $* $| $* $: $3', `dnl') 875c2aa98e2SPeter Wemm# pass to name server to make hostname canonical 87606f25ae9SGregory Neil ShapiroR$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4') 87706f25ae9SGregory Neil Shapirodnl remove {daemon_flags} for other cases 87806f25ae9SGregory Neil ShapiroR$* $| $* $: $2 879c2aa98e2SPeter Wemm 880c2aa98e2SPeter Wemm# local host aliases and pseudo-domains are always canonical 881c2aa98e2SPeter WemmR$* < @ $=w > $* $: $1 < @ $2 . > $3 882c2aa98e2SPeter Wemmifdef(`_MASQUERADE_ENTIRE_DOMAIN_', 883c2aa98e2SPeter Wemm`R$* < @ $* $=M > $* $: $1 < @ $2 $3 . > $4', 884c2aa98e2SPeter Wemm`R$* < @ $=M > $* $: $1 < @ $2 . > $3') 88506f25ae9SGregory Neil Shapiroifdef(`_VIRTUSER_TABLE_', `dnl 88606f25ae9SGregory Neil Shapirodnl virtual hosts are also canonical 88706f25ae9SGregory Neil Shapiroifdef(`_VIRTUSER_ENTIRE_DOMAIN_', 88806f25ae9SGregory Neil Shapiro`R$* < @ $* $={VirtHost} > $* $: $1 < @ $2 $3 . > $4', 88906f25ae9SGregory Neil Shapiro`R$* < @ $={VirtHost} > $* $: $1 < @ $2 . > $3')', 89006f25ae9SGregory Neil Shapiro`dnl') 89140266059SGregory Neil Shapiroifdef(`_GENERICS_TABLE_', `dnl 89240266059SGregory Neil Shapirodnl hosts for genericstable are also canonical 89340266059SGregory Neil Shapiroifdef(`_GENERICS_ENTIRE_DOMAIN_', 89440266059SGregory Neil Shapiro`R$* < @ $* $=G > $* $: $1 < @ $2 $3 . > $4', 89540266059SGregory Neil Shapiro`R$* < @ $=G > $* $: $1 < @ $2 . > $3')', 89640266059SGregory Neil Shapiro`dnl') 89706f25ae9SGregory Neil Shapirodnl remove superfluous dots (maybe repeatedly) which may have been added 89806f25ae9SGregory Neil Shapirodnl by one of the rules before 899c2aa98e2SPeter WemmR$* < @ $* . . > $* $1 < @ $2 . > $3 900c2aa98e2SPeter Wemm 901c2aa98e2SPeter Wemm 902c2aa98e2SPeter Wemm################################################## 903c2aa98e2SPeter Wemm### Ruleset 4 -- Final Output Post-rewriting ### 904c2aa98e2SPeter Wemm################################################## 90506f25ae9SGregory Neil ShapiroSfinal=4 906c2aa98e2SPeter Wemm 907193538b7SGregory Neil ShapiroR$+ :; <@> $@ $1 : handle <list:;> 908c2aa98e2SPeter WemmR$* <@> $@ handle <> and list:; 909c2aa98e2SPeter Wemm 910c2aa98e2SPeter Wemm# strip trailing dot off possibly canonical name 911c2aa98e2SPeter WemmR$* < @ $+ . > $* $1 < @ $2 > $3 912c2aa98e2SPeter Wemm 91306f25ae9SGregory Neil Shapiro# eliminate internal code 914c2aa98e2SPeter WemmR$* < @ *LOCAL* > $* $1 < @ $j > $2 915c2aa98e2SPeter Wemm 916c2aa98e2SPeter Wemm# externalize local domain info 917c2aa98e2SPeter WemmR$* < $+ > $* $1 $2 $3 defocus 918c2aa98e2SPeter WemmR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 919c2aa98e2SPeter WemmR@ $* $@ @ $1 ... and exit 920c2aa98e2SPeter Wemm 921c2aa98e2SPeter Wemmifdef(`_NO_UUCP_', `dnl', 922c2aa98e2SPeter Wemm`# UUCP must always be presented in old form 923c2aa98e2SPeter WemmR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 924c2aa98e2SPeter Wemm 925c2aa98e2SPeter Wemmifdef(`_USE_DECNET_SYNTAX_', 926c2aa98e2SPeter Wemm`# put DECnet back in :: form 927c2aa98e2SPeter WemmR$+ @ $+ . DECNET $2 :: $1 u@h.DECNET => h::u', 928c2aa98e2SPeter Wemm `dnl') 929c2aa98e2SPeter Wemm# delete duplicate local names 930c2aa98e2SPeter WemmR$+ % $=w @ $=w $1 @ $2 u%host@host => u@host 931c2aa98e2SPeter Wemm 932c2aa98e2SPeter Wemm 933c2aa98e2SPeter Wemm 934c2aa98e2SPeter Wemm############################################################## 935c2aa98e2SPeter Wemm### Ruleset 97 -- recanonicalize and call ruleset zero ### 936c2aa98e2SPeter Wemm### (used for recursive calls) ### 937c2aa98e2SPeter Wemm############################################################## 938c2aa98e2SPeter Wemm 93906f25ae9SGregory Neil ShapiroSRecurse=97 94006f25ae9SGregory Neil ShapiroR$* $: $>canonify $1 94106f25ae9SGregory Neil ShapiroR$* $@ $>parse $1 942c2aa98e2SPeter Wemm 943c2aa98e2SPeter Wemm 944c2aa98e2SPeter Wemm###################################### 945c2aa98e2SPeter Wemm### Ruleset 0 -- Parse Address ### 946c2aa98e2SPeter Wemm###################################### 947c2aa98e2SPeter Wemm 94806f25ae9SGregory Neil ShapiroSparse=0 949c2aa98e2SPeter Wemm 950c2aa98e2SPeter WemmR$* $: $>Parse0 $1 initial parsing 951c2aa98e2SPeter WemmR<@> $#_LOCAL_ $: <@> special case error msgs 95206f25ae9SGregory Neil ShapiroR$* $: $>ParseLocal $1 handle local hacks 953c2aa98e2SPeter WemmR$* $: $>Parse1 $1 final parsing 954c2aa98e2SPeter Wemm 955c2aa98e2SPeter Wemm# 956c2aa98e2SPeter Wemm# Parse0 -- do initial syntax checking and eliminate local addresses. 957c2aa98e2SPeter Wemm# This should either return with the (possibly modified) input 958c2aa98e2SPeter Wemm# or return with a #error mailer. It should not return with a 959c2aa98e2SPeter Wemm# #mailer other than the #error mailer. 960c2aa98e2SPeter Wemm# 961c2aa98e2SPeter Wemm 962c2aa98e2SPeter WemmSParse0 963c2aa98e2SPeter WemmR<@> $@ <@> special case error msgs 96440266059SGregory Neil ShapiroR$* : $* ; <@> $#error $@ 5.1.3 $: "_CODE553 List:; syntax illegal for recipient addresses" 96506f25ae9SGregory Neil ShapiroR@ <@ $* > < @ $1 > catch "@@host" bogosity 96640266059SGregory Neil ShapiroR<@ $+> $#error $@ 5.1.3 $: "_CODE553 User address required" 96740266059SGregory Neil ShapiroR$+ <@> $#error $@ 5.1.3 $: "_CODE553 Hostname required" 968c2aa98e2SPeter WemmR$* $: <> $1 96940266059SGregory Neil Shapirodnl allow tricks like [host1]:[host2] 97040266059SGregory Neil ShapiroR<> $* < @ [ $* ] : $+ > $* $1 < @ [ $2 ] : $3 > $4 97140266059SGregory Neil ShapiroR<> $* < @ [ $* ] , $+ > $* $1 < @ [ $2 ] , $3 > $4 97240266059SGregory Neil Shapirodnl but no a@[b]c 97340266059SGregory Neil ShapiroR<> $* < @ [ $* ] $+ > $* $#error $@ 5.1.2 $: "_CODE553 Invalid address" 974c2aa98e2SPeter WemmR<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3 97540266059SGregory Neil ShapiroR<> $* <$* : $* > $* $#error $@ 5.1.3 $: "_CODE553 Colon illegal in host name part" 976c2aa98e2SPeter WemmR<> $* $1 97740266059SGregory Neil ShapiroR$* < @ . $* > $* $#error $@ 5.1.2 $: "_CODE553 Invalid host name" 97840266059SGregory Neil ShapiroR$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "_CODE553 Invalid host name" 97940266059SGregory Neil Shapirodnl no a@b@ 98040266059SGregory Neil ShapiroR$* < @ $* @ > $* $#error $@ 5.1.2 $: "_CODE553 Invalid route address" 98140266059SGregory Neil Shapirodnl no a@b@c 98240266059SGregory Neil ShapiroR$* @ $* < @ $* > $* $#error $@ 5.1.3 $: "_CODE553 Invalid route address" 98306f25ae9SGregory Neil Shapirodnl comma only allowed before @; this check is not complete 98440266059SGregory Neil ShapiroR$* , $~O $* $#error $@ 5.1.3 $: "_CODE553 Invalid route address" 98540266059SGregory Neil Shapiro 98640266059SGregory Neil Shapiroifdef(`_STRICT_RFC821_', `# more RFC 821 checks 98740266059SGregory Neil ShapiroR$* . < @ $* > $* $#error $@ 5.1.2 $: "_CODE553 Local part must not end with a dot" 98840266059SGregory Neil ShapiroR. $* < @ $* > $* $#error $@ 5.1.2 $: "_CODE553 Local part must not begin with a dot" 98940266059SGregory Neil Shapirodnl', `dnl') 990c2aa98e2SPeter Wemm 991c2aa98e2SPeter Wemm# now delete the local info -- note $=O to find characters that cause forwarding 99206f25ae9SGregory Neil ShapiroR$* < @ > $* $@ $>Parse0 $>canonify $1 user@ => user 99306f25ae9SGregory Neil ShapiroR< @ $=w . > : $* $@ $>Parse0 $>canonify $2 @here:... -> ... 994c2aa98e2SPeter WemmR$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here 99540266059SGregory Neil ShapiroR< @ $+ > $#error $@ 5.1.3 $: "_CODE553 User address required" 99606f25ae9SGregory Neil ShapiroR$* $=O $* < @ $=w . > $@ $>Parse0 $>canonify $1 $2 $3 ...@here -> ... 997c2aa98e2SPeter WemmR$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo" 99840266059SGregory Neil ShapiroR< @ *LOCAL* > $#error $@ 5.1.3 $: "_CODE553 User address required" 999c2aa98e2SPeter WemmR$* $=O $* < @ *LOCAL* > 100006f25ae9SGregory Neil Shapiro $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ... 1001c2aa98e2SPeter WemmR$* < @ *LOCAL* > $: $1 1002c2aa98e2SPeter Wemm 1003c2aa98e2SPeter Wemm# 1004c2aa98e2SPeter Wemm# Parse1 -- the bottom half of ruleset 0. 1005c2aa98e2SPeter Wemm# 1006c2aa98e2SPeter Wemm 1007c2aa98e2SPeter WemmSParse1 100806f25ae9SGregory Neil Shapiroifdef(`_LDAP_ROUTING_', `dnl 100906f25ae9SGregory Neil Shapiro# handle LDAP routing for hosts in $={LDAPRoute} 101040266059SGregory Neil ShapiroR$+ < @ $={LDAPRoute} . > $: $>LDAPExpand <$1 < @ $2 . >> <$1 @ $2> <> 101140266059SGregory Neil ShapiroR$+ < @ $={LDAPRouteEquiv} . > $: $>LDAPExpand <$1 < @ $2 . >> <$1 @ $M> <>', 1012c2aa98e2SPeter Wemm`dnl') 1013c2aa98e2SPeter Wemm 101406f25ae9SGregory Neil Shapiroifdef(`_MAILER_smtp_', 101506f25ae9SGregory Neil Shapiro`# handle numeric address spec 101606f25ae9SGregory Neil Shapirodnl there is no check whether this is really an IP number 101706f25ae9SGregory Neil ShapiroR$* < @ [ $+ ] > $* $: $>ParseLocal $1 < @ [ $2 ] > $3 numeric internet spec 101806f25ae9SGregory Neil ShapiroR$* < @ [ $+ ] > $* $1 < @ [ $2 ] : $S > $3 Add smart host to path 101906f25ae9SGregory Neil ShapiroR$* < @ [ $+ ] : > $* $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3 no smarthost: send 102006f25ae9SGregory Neil ShapiroR$* < @ [ $+ ] : $- : $*> $* $#$3 $@ $4 $: $1 < @ [$2] > $5 smarthost with mailer 102106f25ae9SGregory Neil ShapiroR$* < @ [ $+ ] : $+ > $* $#_SMTP_ $@ $3 $: $1 < @ [$2] > $4 smarthost without mailer', 102206f25ae9SGregory Neil Shapiro `dnl') 102306f25ae9SGregory Neil Shapiro 102406f25ae9SGregory Neil Shapiroifdef(`_VIRTUSER_TABLE_', `dnl 1025c2aa98e2SPeter Wemm# handle virtual users 102640266059SGregory Neil Shapiroifdef(`_VIRTUSER_STOP_ONE_LEVEL_RECURSION_',`dnl 102740266059SGregory Neil Shapirodnl this is not a documented option 102840266059SGregory Neil Shapirodnl it stops looping in virtusertable mapping if input and output 102940266059SGregory Neil Shapirodnl are identical, i.e., if address A is mapped to A. 103040266059SGregory Neil Shapirodnl it does not deal with multi-level recursion 103140266059SGregory Neil Shapiro# handle full domains in RHS of virtusertable 103240266059SGregory Neil ShapiroR$+ < @ $+ > $: $(macro {RecipientAddress} $) $1 < @ $2 > 103340266059SGregory Neil ShapiroR$+ < @ $+ > $: <?> $1 < @ $2 > $| $>final $1 < @ $2 > 103440266059SGregory Neil ShapiroR<?> $+ $| $+ $: $1 $(macro {RecipientAddress} $@ $2 $) 103540266059SGregory Neil ShapiroR<?> $+ $| $* $: $1', 103640266059SGregory Neil Shapiro`dnl') 103706f25ae9SGregory Neil ShapiroR$+ $: <!> $1 Mark for lookup 103840266059SGregory Neil Shapirodnl input: <!> local<@domain> 103906f25ae9SGregory Neil Shapiroifdef(`_VIRTUSER_ENTIRE_DOMAIN_', 104006f25ae9SGregory Neil Shapiro`R<!> $+ < @ $* $={VirtHost} . > $: < $(virtuser $1 @ $2 $3 $@ $1 $: @ $) > $1 < @ $2 $3 . >', 104106f25ae9SGregory Neil Shapiro`R<!> $+ < @ $={VirtHost} . > $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >') 104240266059SGregory Neil Shapirodnl input: <result-of-lookup | @> local<@domain> | <!> local<@domain> 104306f25ae9SGregory Neil ShapiroR<!> $+ < @ $=w . > $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . > 104440266059SGregory Neil Shapirodnl if <@> local<@domain>: no match but try lookup 104540266059SGregory Neil Shapirodnl user+detail: try user++@domain if detail not empty 104640266059SGregory Neil ShapiroR<@> $+ + $+ < @ $* . > 104740266059SGregory Neil Shapiro $: < $(virtuser $1 + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . > 104840266059SGregory Neil Shapirodnl user+detail: try user+*@domain 1049c2aa98e2SPeter WemmR<@> $+ + $* < @ $* . > 105040266059SGregory Neil Shapiro $: < $(virtuser $1 + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . > 105140266059SGregory Neil Shapirodnl user+detail: try user@domain 1052c2aa98e2SPeter WemmR<@> $+ + $* < @ $* . > 105340266059SGregory Neil Shapiro $: < $(virtuser $1 @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . > 105406f25ae9SGregory Neil Shapirodnl try default entry: @domain 105540266059SGregory Neil Shapirodnl ++@domain 105640266059SGregory Neil ShapiroR<@> $+ + $+ < @ $+ . > $: < $(virtuser + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . > 105706f25ae9SGregory Neil Shapirodnl +*@domain 105840266059SGregory Neil ShapiroR<@> $+ + $* < @ $+ . > $: < $(virtuser + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . > 105906f25ae9SGregory Neil Shapirodnl @domain if +detail exists 106094c01205SGregory Neil Shapirodnl if no match, change marker to prevent a second @domain lookup 106194c01205SGregory Neil ShapiroR<@> $+ + $* < @ $+ . > $: < $(virtuser @ $3 $@ $1 $@ $2 $@ +$2 $: ! $) > $1 + $2 < @ $3 . > 106294c01205SGregory Neil Shapirodnl without +detail 1063c2aa98e2SPeter WemmR<@> $+ < @ $+ . > $: < $(virtuser @ $2 $@ $1 $: @ $) > $1 < @ $2 . > 106440266059SGregory Neil Shapirodnl no match 1065c2aa98e2SPeter WemmR<@> $+ $: $1 106640266059SGregory Neil Shapirodnl remove mark 106706f25ae9SGregory Neil ShapiroR<!> $+ $: $1 106806f25ae9SGregory Neil ShapiroR< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4 1069c2aa98e2SPeter WemmR< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2 107040266059SGregory Neil Shapiroifdef(`_VIRTUSER_STOP_ONE_LEVEL_RECURSION_',`dnl 107140266059SGregory Neil Shapiro# check virtuser input address against output address, if same, skip recursion 107240266059SGregory Neil ShapiroR< $+ > $+ < @ $+ > $: < $1 > $2 < @ $3 > $| $1 107340266059SGregory Neil Shapiro# it is the same: stop now 107440266059SGregory Neil ShapiroR< $+ > $+ < @ $+ > $| $&{RecipientAddress} $: $>ParseLocal $>Parse0 $>canonify $1 107540266059SGregory Neil ShapiroR< $+ > $+ < @ $+ > $| $* $: < $1 > $2 < @ $3 > 107640266059SGregory Neil Shapirodnl', `dnl') 107713058a91SGregory Neil Shapirodnl this is not a documented option 107813058a91SGregory Neil Shapirodnl it performs no looping at all for virtusertable 10798774250cSGregory Neil Shapiroifdef(`_NO_VIRTUSER_RECURSION_', 10808774250cSGregory Neil Shapiro`R< $+ > $+ < @ $+ > $: $>ParseLocal $>Parse0 $>canonify $1', 10818774250cSGregory Neil Shapiro`R< $+ > $+ < @ $+ > $: $>Recurse $1') 10828774250cSGregory Neil Shapirodnl', `dnl') 1083c2aa98e2SPeter Wemm 1084c2aa98e2SPeter Wemm# short circuit local delivery so forwarded email works 1085c2aa98e2SPeter Wemmifdef(`_MAILER_usenet_', `dnl 108606f25ae9SGregory Neil ShapiroR$+ . USENET < @ $=w . > $#usenet $@ usenet $: $1 handle usenet specially', `dnl') 108742e5d165SGregory Neil Shapiro 108842e5d165SGregory Neil Shapiro 1089c2aa98e2SPeter Wemmifdef(`_STICKY_LOCAL_DOMAIN_', 1090c2aa98e2SPeter Wemm`R$+ < @ $=w . > $: < $H > $1 < @ $2 . > first try hub 109106f25ae9SGregory Neil ShapiroR< $+ > $+ < $+ > $>MailerToTriple < $1 > $2 < $3 > yep .... 109206f25ae9SGregory Neil Shapirodnl $H empty (but @$=w.) 1093c2aa98e2SPeter WemmR< > $+ + $* < $+ > $#_LOCAL_ $: $1 + $2 plussed name? 1094c2aa98e2SPeter WemmR< > $+ < $+ > $#_LOCAL_ $: @ $1 nope, local address', 1095c2aa98e2SPeter Wemm`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names 1096c2aa98e2SPeter WemmR$+ < @ $=w . > $#_LOCAL_ $: $1 regular local name') 1097c2aa98e2SPeter Wemm 109806f25ae9SGregory Neil Shapiroifdef(`_MAILER_TABLE_', `dnl 1099c2aa98e2SPeter Wemm# not local -- try mailer table lookup 1100c2aa98e2SPeter WemmR$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 1101c2aa98e2SPeter WemmR< $+ . > $* $: < $1 > $2 strip trailing dot 1102c2aa98e2SPeter WemmR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 110306f25ae9SGregory Neil Shapirodnl it is $~[ instead of $- to avoid matches on IPv6 addresses 110406f25ae9SGregory Neil ShapiroR< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3 check -- resolved? 110506f25ae9SGregory Neil ShapiroR< $+ > $* $: $>Mailertable <$1> $2 try domain', 1106c2aa98e2SPeter Wemm`dnl') 110706f25ae9SGregory Neil Shapiroundivert(4)dnl UUCP rules from `MAILER(uucp)' 1108c2aa98e2SPeter Wemm 1109c2aa98e2SPeter Wemmifdef(`_NO_UUCP_', `dnl', 1110c2aa98e2SPeter Wemm`# resolve remotely connected UUCP links (if any) 1111c2aa98e2SPeter Wemmifdef(`_CLASS_V_', 111206f25ae9SGregory Neil Shapiro`R$* < @ $=V . UUCP . > $* $: $>MailerToTriple < $V > $1 <@$2.UUCP.> $3', 1113c2aa98e2SPeter Wemm `dnl') 1114c2aa98e2SPeter Wemmifdef(`_CLASS_W_', 111506f25ae9SGregory Neil Shapiro`R$* < @ $=W . UUCP . > $* $: $>MailerToTriple < $W > $1 <@$2.UUCP.> $3', 1116c2aa98e2SPeter Wemm `dnl') 1117c2aa98e2SPeter Wemmifdef(`_CLASS_X_', 111806f25ae9SGregory Neil Shapiro`R$* < @ $=X . UUCP . > $* $: $>MailerToTriple < $X > $1 <@$2.UUCP.> $3', 1119c2aa98e2SPeter Wemm `dnl')') 1120c2aa98e2SPeter Wemm 1121c2aa98e2SPeter Wemm# resolve fake top level domains by forwarding to other hosts 1122c2aa98e2SPeter Wemmifdef(`BITNET_RELAY', 112306f25ae9SGregory Neil Shapiro`R$*<@$+.BITNET.>$* $: $>MailerToTriple < $B > $1 <@$2.BITNET.> $3 user@host.BITNET', 1124c2aa98e2SPeter Wemm `dnl') 1125c2aa98e2SPeter Wemmifdef(`DECNET_RELAY', 112606f25ae9SGregory Neil Shapiro`R$*<@$+.DECNET.>$* $: $>MailerToTriple < $C > $1 <@$2.DECNET.> $3 user@host.DECNET', 1127c2aa98e2SPeter Wemm `dnl') 1128c2aa98e2SPeter Wemmifdef(`_MAILER_pop_', 1129c2aa98e2SPeter Wemm`R$+ < @ POP. > $#pop $: $1 user@POP', 1130c2aa98e2SPeter Wemm `dnl') 1131c2aa98e2SPeter Wemmifdef(`_MAILER_fax_', 1132c2aa98e2SPeter Wemm`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX', 1133c2aa98e2SPeter Wemm`ifdef(`FAX_RELAY', 113406f25ae9SGregory Neil Shapiro`R$*<@$+.FAX.>$* $: $>MailerToTriple < $F > $1 <@$2.FAX.> $3 user@host.FAX', 1135c2aa98e2SPeter Wemm `dnl')') 1136c2aa98e2SPeter Wemm 1137c2aa98e2SPeter Wemmifdef(`UUCP_RELAY', 1138c2aa98e2SPeter Wemm`# forward non-local UUCP traffic to our UUCP relay 113906f25ae9SGregory Neil ShapiroR$*<@$*.UUCP.>$* $: $>MailerToTriple < $Y > $1 <@$2.UUCP.> $3 uucp mail', 1140c2aa98e2SPeter Wemm`ifdef(`_MAILER_uucp_', 1141c2aa98e2SPeter Wemm`# forward other UUCP traffic straight to UUCP 1142c2aa98e2SPeter WemmR$* < @ $+ .UUCP. > $* $#_UUCP_ $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP', 1143c2aa98e2SPeter Wemm `dnl')') 1144c2aa98e2SPeter Wemmifdef(`_MAILER_usenet_', ` 1145c2aa98e2SPeter Wemm# addresses sent to net.group.USENET will get forwarded to a newsgroup 114606f25ae9SGregory Neil ShapiroR$+ . USENET $#usenet $@ usenet $: $1', 1147c2aa98e2SPeter Wemm `dnl') 1148c2aa98e2SPeter Wemm 1149c2aa98e2SPeter Wemmifdef(`_LOCAL_RULES_', 1150c2aa98e2SPeter Wemm`# figure out what should stay in our local mail system 1151c2aa98e2SPeter Wemmundivert(1)', `dnl') 1152c2aa98e2SPeter Wemm 1153c2aa98e2SPeter Wemm# pass names that still have a host to a smarthost (if defined) 115406f25ae9SGregory Neil ShapiroR$* < @ $* > $* $: $>MailerToTriple < $S > $1 < @ $2 > $3 glue on smarthost name 1155c2aa98e2SPeter Wemm 1156c2aa98e2SPeter Wemm# deal with other remote names 1157c2aa98e2SPeter Wemmifdef(`_MAILER_smtp_', 1158c2aa98e2SPeter Wemm`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain', 115940266059SGregory Neil Shapiro`R$* < @$* > $* $#error $@ 5.1.2 $: "_CODE553 Unrecognized host name " $2') 1160c2aa98e2SPeter Wemm 1161c2aa98e2SPeter Wemm# handle locally delivered names 1162c2aa98e2SPeter WemmR$=L $#_LOCAL_ $: @ $1 special local names 1163c2aa98e2SPeter WemmR$+ $#_LOCAL_ $: $1 regular local names 1164c2aa98e2SPeter Wemm 1165c2aa98e2SPeter Wemm########################################################################### 1166c2aa98e2SPeter Wemm### Ruleset 5 -- special rewriting after aliases have been expanded ### 1167c2aa98e2SPeter Wemm########################################################################### 1168c2aa98e2SPeter Wemm 116906f25ae9SGregory Neil ShapiroSLocal_localaddr 117006f25ae9SGregory Neil ShapiroSlocaladdr=5 117106f25ae9SGregory Neil ShapiroR$+ $: $1 $| $>"Local_localaddr" $1 117240266059SGregory Neil ShapiroR$+ $| $#ok $@ $1 no change 117306f25ae9SGregory Neil ShapiroR$+ $| $#$* $#$2 117406f25ae9SGregory Neil ShapiroR$+ $| $* $: $1 1175c2aa98e2SPeter Wemm 117640266059SGregory Neil Shapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 117740266059SGregory Neil Shapiro# Preserve rcpt_host in {Host} 117840266059SGregory Neil ShapiroR$+ $: $1 $| $&h $| $&{Host} check h and {Host} 117940266059SGregory Neil ShapiroR$+ $| $| $: $(macro {Host} $@ $) $1 no h or {Host} 118040266059SGregory Neil ShapiroR$+ $| $| $+ $: $1 h not set, {Host} set 118140266059SGregory Neil ShapiroR$+ $| +$* $| $* $: $1 h is +detail, {Host} set 11826a2f2ff3SGregory Neil ShapiroR$+ $| $* @ $+ $| $* $: $(macro {Host} $@ @$3 $) $1 set {Host} to host in h 118340266059SGregory Neil ShapiroR$+ $| $+ $| $* $: $(macro {Host} $@ @$2 $) $1 set {Host} to h 118440266059SGregory Neil Shapiro')dnl 118540266059SGregory Neil Shapiro 118640266059SGregory Neil Shapiroifdef(`_FFR_5_', `dnl 118742e5d165SGregory Neil Shapiro# Preserve host in a macro 118842e5d165SGregory Neil ShapiroR$+ $: $(macro {LocalAddrHost} $) $1 118942e5d165SGregory Neil ShapiroR$+ @ $+ $: $(macro {LocalAddrHost} $@ @ $2 $) $1') 1190c2aa98e2SPeter Wemm 119140266059SGregory Neil Shapiroifdef(`_PRESERVE_LOCAL_PLUS_DETAIL_', `', `dnl 119242e5d165SGregory Neil Shapiro# deal with plussed users so aliases work nicely 119342e5d165SGregory Neil ShapiroR$+ + * $#_LOCAL_ $@ $&h $: $1`'ifdef(`_FFR_5_', ` $&{LocalAddrHost}') 119442e5d165SGregory Neil ShapiroR$+ + $* $#_LOCAL_ $@ + $2 $: $1 + *`'ifdef(`_FFR_5_', ` $&{LocalAddrHost}') 119542e5d165SGregory Neil Shapiro') 1196c2aa98e2SPeter Wemm# prepend an empty "forward host" on the front 1197c2aa98e2SPeter WemmR$+ $: <> $1 1198c2aa98e2SPeter Wemm 1199c2aa98e2SPeter Wemmifdef(`LUSER_RELAY', `dnl 1200c2aa98e2SPeter Wemm# send unrecognized local users to a relay host 120140266059SGregory Neil Shapiroifdef(`_PRESERVE_LOCAL_PLUS_DETAIL_', `dnl 120242e5d165SGregory Neil ShapiroR< > $+ + $* $: < ? $L > <+ $2> $(user $1 $) look up user+ 120342e5d165SGregory Neil ShapiroR< > $+ $: < ? $L > < > $(user $1 $) look up user 120442e5d165SGregory Neil ShapiroR< ? $* > < $* > $+ <> $: < > $3 $2 found; strip $L 120542e5d165SGregory Neil ShapiroR< ? $* > < $* > $+ $: < $1 > $3 $2 not found', ` 120606f25ae9SGregory Neil ShapiroR< > $+ $: < $L > $(user $1 $) look up user 120740266059SGregory Neil ShapiroR< $* > $+ <> $: < > $2 found; strip $L') 120840266059SGregory Neil Shapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 120940266059SGregory Neil ShapiroR< $+ > $+ $: < $1 > $2 $&{Host}') 121040266059SGregory Neil Shapirodnl') 1211c2aa98e2SPeter Wemm 121240266059SGregory Neil Shapiroifdef(`MAIL_HUB', `dnl 121340266059SGregory Neil ShapiroR< > $+ $: < $H > $1 try hub', `dnl') 121440266059SGregory Neil Shapiroifdef(`LOCAL_RELAY', `dnl 121540266059SGregory Neil ShapiroR< > $+ $: < $R > $1 try relay', `dnl') 121640266059SGregory Neil Shapiroifdef(`_PRESERVE_LOCAL_PLUS_DETAIL_', `dnl 121740266059SGregory Neil ShapiroR< > $+ $@ $1', `dnl 121806f25ae9SGregory Neil ShapiroR< > $+ $: < > < $1 <> $&h > nope, restore +detail 121940266059SGregory Neil Shapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 122040266059SGregory Neil ShapiroR< > < $+ @ $+ <> + $* > $: < > < $1 + $3 @ $2 > check whether +detail') 122106f25ae9SGregory Neil ShapiroR< > < $+ <> + $* > $: < > < $1 + $2 > check whether +detail 122206f25ae9SGregory Neil ShapiroR< > < $+ <> $* > $: < > < $1 > else discard 1223c2aa98e2SPeter WemmR< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part 122442e5d165SGregory Neil ShapiroR< > < $+ > + $* $#_LOCAL_ $@ $2 $: @ $1`'ifdef(`_FFR_5_', ` $&{LocalAddrHost}') strip the extra + 1225c2aa98e2SPeter WemmR< > < $+ > $@ $1 no +detail 12262e43090eSPeter WemmR$+ $: $1 <> $&h add +detail back in 122740266059SGregory Neil Shapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 122840266059SGregory Neil ShapiroR$+ @ $+ <> + $* $: $1 + $3 @ $2 check whether +detail') 12292e43090eSPeter WemmR$+ <> + $* $: $1 + $2 check whether +detail 123042e5d165SGregory Neil ShapiroR$+ <> $* $: $1 else discard') 123106f25ae9SGregory Neil ShapiroR< local : $* > $* $: $>MailerToTriple < local : $1 > $2 no host extension 123206f25ae9SGregory Neil ShapiroR< error : $* > $* $: $>MailerToTriple < error : $1 > $2 no host extension 123340266059SGregory Neil Shapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 123440266059SGregory Neil Shapirodnl it is $~[ instead of $- to avoid matches on IPv6 addresses 123540266059SGregory Neil ShapiroR< $~[ : $+ > $+ @ $+ $: $>MailerToTriple < $1 : $2 > $3 < @ $4 >') 123640266059SGregory Neil ShapiroR< $~[ : $+ > $+ $: $>MailerToTriple < $1 : $2 > $3 < @ $2 > 123740266059SGregory Neil Shapiroifdef(`_PRESERVE_LUSER_HOST_', `dnl 123840266059SGregory Neil ShapiroR< $+ > $+ @ $+ $@ $>MailerToTriple < $1 > $2 < @ $3 >') 123906f25ae9SGregory Neil ShapiroR< $+ > $+ $@ $>MailerToTriple < $1 > $2 < @ $1 > 1240c2aa98e2SPeter Wemm 124106f25ae9SGregory Neil Shapiroifdef(`_MAILER_TABLE_', `dnl 124240266059SGregory Neil Shapiroifdef(`_LDAP_ROUTING_', `dnl 124340266059SGregory Neil Shapiro################################################################### 124440266059SGregory Neil Shapiro### Ruleset LDAPMailertable -- mailertable lookup for LDAP ### 124540266059SGregory Neil Shapirodnl input: <Domain> FullAddress 124640266059SGregory Neil Shapiro################################################################### 124740266059SGregory Neil Shapiro 124840266059SGregory Neil ShapiroSLDAPMailertable 124940266059SGregory Neil ShapiroR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 125040266059SGregory Neil ShapiroR< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3 check resolved? 125140266059SGregory Neil ShapiroR< $+ > $* $: < $1 > $>Mailertable <$1> $2 try domain 125240266059SGregory Neil ShapiroR< $+ > $#$* $#$2 found 125340266059SGregory Neil ShapiroR< $+ > $* $#_RELAY_ $@ $1 $: $2 not found, direct relay', 125440266059SGregory Neil Shapiro`dnl') 125540266059SGregory Neil Shapiro 1256c2aa98e2SPeter Wemm################################################################### 1257c2aa98e2SPeter Wemm### Ruleset 90 -- try domain part of mailertable entry ### 125806f25ae9SGregory Neil Shapirodnl input: LeftPartOfDomain <RightPartOfDomain> FullAddress 1259c2aa98e2SPeter Wemm################################################################### 1260c2aa98e2SPeter Wemm 126106f25ae9SGregory Neil ShapiroSMailertable=90 126206f25ae9SGregory Neil Shapirodnl shift and check 126306f25ae9SGregory Neil Shapirodnl %2 is not documented in cf/README 1264c2aa98e2SPeter WemmR$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4 126506f25ae9SGregory Neil Shapirodnl it is $~[ instead of $- to avoid matches on IPv6 addresses 126606f25ae9SGregory Neil ShapiroR$* <$~[ : $* > $* $>MailerToTriple < $2 : $3 > $4 check -- resolved? 126706f25ae9SGregory Neil ShapiroR$* < . $+ > $* $@ $>Mailertable $1 . <$2> $3 no -- strip & try again 126806f25ae9SGregory Neil Shapirodnl is $2 always empty? 1269c2aa98e2SPeter WemmR$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "." 127006f25ae9SGregory Neil ShapiroR< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3 "." found? 127106f25ae9SGregory Neil Shapirodnl return full address 1272c2aa98e2SPeter WemmR< $* > $* $@ $2 no mailertable match', 1273c2aa98e2SPeter Wemm`dnl') 1274c2aa98e2SPeter Wemm 1275c2aa98e2SPeter Wemm################################################################### 1276c2aa98e2SPeter Wemm### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ### 127706f25ae9SGregory Neil Shapirodnl input: in general: <[mailer:]host> lp<@domain>rest 127806f25ae9SGregory Neil Shapirodnl <> address -> address 127906f25ae9SGregory Neil Shapirodnl <error:d.s.n:text> -> error 128006f25ae9SGregory Neil Shapirodnl <error:text> -> error 128106f25ae9SGregory Neil Shapirodnl <mailer:user@host> lp<@domain>rest -> mailer host user 128206f25ae9SGregory Neil Shapirodnl <mailer:host> address -> mailer host address 128306f25ae9SGregory Neil Shapirodnl <localdomain> address -> address 128406f25ae9SGregory Neil Shapirodnl <host> address -> relay host address 1285c2aa98e2SPeter Wemm################################################################### 1286c2aa98e2SPeter Wemm 128706f25ae9SGregory Neil ShapiroSMailerToTriple=95 1288c2aa98e2SPeter WemmR< > $* $@ $1 strip off null relay 128906f25ae9SGregory Neil ShapiroR< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4 1290c2aa98e2SPeter WemmR< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2 1291c2aa98e2SPeter WemmR< local : $* > $* $>CanonLocal < $1 > $2 129240266059SGregory Neil Shapirodnl it is $~[ instead of $- to avoid matches on IPv6 addresses 129340266059SGregory Neil ShapiroR< $~[ : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user 129440266059SGregory Neil ShapiroR< $~[ : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 1295c2aa98e2SPeter WemmR< $=w > $* $@ $2 delete local host 1296c2aa98e2SPeter WemmR< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer 1297c2aa98e2SPeter Wemm 1298c2aa98e2SPeter Wemm################################################################### 1299c2aa98e2SPeter Wemm### Ruleset CanonLocal -- canonify local: syntax ### 130006f25ae9SGregory Neil Shapirodnl input: <user> address 130106f25ae9SGregory Neil Shapirodnl <x> <@host> : rest -> Recurse rest 130206f25ae9SGregory Neil Shapirodnl <x> p1 $=O p2 <@host> -> Recurse p1 $=O p2 130306f25ae9SGregory Neil Shapirodnl <> user <@host> rest -> local user@host user 130406f25ae9SGregory Neil Shapirodnl <> user -> local user user 130506f25ae9SGregory Neil Shapirodnl <user@host> lp <@domain> rest -> <user> lp <@host> [cont] 130606f25ae9SGregory Neil Shapirodnl <user> lp <@host> rest -> local lp@host user 130706f25ae9SGregory Neil Shapirodnl <user> lp -> local lp user 1308c2aa98e2SPeter Wemm################################################################### 1309c2aa98e2SPeter Wemm 1310c2aa98e2SPeter WemmSCanonLocal 13112e43090eSPeter Wemm# strip local host from routed addresses 131206f25ae9SGregory Neil ShapiroR< $* > < @ $+ > : $+ $@ $>Recurse $3 131306f25ae9SGregory Neil ShapiroR< $* > $+ $=O $+ < @ $+ > $@ $>Recurse $2 $3 $4 13142e43090eSPeter Wemm 1315c2aa98e2SPeter Wemm# strip trailing dot from any host name that may appear 1316c2aa98e2SPeter WemmR< $* > $* < @ $* . > $: < $1 > $2 < @ $3 > 1317c2aa98e2SPeter Wemm 1318c2aa98e2SPeter Wemm# handle local: syntax -- use old user, either with or without host 1319c2aa98e2SPeter WemmR< > $* < @ $* > $* $#_LOCAL_ $@ $1@$2 $: $1 1320c2aa98e2SPeter WemmR< > $+ $#_LOCAL_ $@ $1 $: $1 1321c2aa98e2SPeter Wemm 1322c2aa98e2SPeter Wemm# handle local:user@host syntax -- ignore host part 1323c2aa98e2SPeter WemmR< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 > 1324c2aa98e2SPeter Wemm 1325c2aa98e2SPeter Wemm# handle local:user syntax 1326c2aa98e2SPeter WemmR< $+ > $* <@ $* > $* $#_LOCAL_ $@ $2@$3 $: $1 1327c2aa98e2SPeter WemmR< $+ > $* $#_LOCAL_ $@ $2 $: $1 1328c2aa98e2SPeter Wemm 1329c2aa98e2SPeter Wemm################################################################### 1330c2aa98e2SPeter Wemm### Ruleset 93 -- convert header names to masqueraded form ### 1331c2aa98e2SPeter Wemm################################################################### 1332c2aa98e2SPeter Wemm 133306f25ae9SGregory Neil ShapiroSMasqHdr=93 1334c2aa98e2SPeter Wemm 133506f25ae9SGregory Neil Shapiroifdef(`_GENERICS_TABLE_', `dnl 1336c2aa98e2SPeter Wemm# handle generics database 1337c2aa98e2SPeter Wemmifdef(`_GENERICS_ENTIRE_DOMAIN_', 133806f25ae9SGregory Neil Shapirodnl if generics should be applied add a @ as mark 1339c2aa98e2SPeter Wemm`R$+ < @ $* $=G . > $: < $1@$2$3 > $1 < @ $2$3 . > @ mark', 1340c2aa98e2SPeter Wemm`R$+ < @ $=G . > $: < $1@$2 > $1 < @ $2 . > @ mark') 1341c2aa98e2SPeter WemmR$+ < @ *LOCAL* > $: < $1@$j > $1 < @ *LOCAL* > @ mark 134206f25ae9SGregory Neil Shapirodnl workspace: either user<@domain> or <user@domain> user <@domain> @ 134306f25ae9SGregory Neil Shapirodnl ignore the first case for now 134406f25ae9SGregory Neil Shapirodnl if it has the mark lookup full address 134540266059SGregory Neil Shapirodnl broken: %1 is full address not just detail 134606f25ae9SGregory Neil ShapiroR< $+ > $+ < $* > @ $: < $(generics $1 $: @ $1 $) > $2 < $3 > 134706f25ae9SGregory Neil Shapirodnl workspace: ... or <match|@user@domain> user <@domain> 134806f25ae9SGregory Neil Shapirodnl no match, try user+detail@domain 134906f25ae9SGregory Neil ShapiroR<@$+ + $* @ $+> $+ < @ $+ > 135006f25ae9SGregory Neil Shapiro $: < $(generics $1+*@$3 $@ $2 $:@$1 + $2@$3 $) > $4 < @ $5 > 135106f25ae9SGregory Neil ShapiroR<@$+ + $* @ $+> $+ < @ $+ > 135206f25ae9SGregory Neil Shapiro $: < $(generics $1@$3 $: $) > $4 < @ $5 > 135306f25ae9SGregory Neil Shapirodnl no match, remove mark 135406f25ae9SGregory Neil ShapiroR<@$+ > $+ < @ $+ > $: < > $2 < @ $3 > 135506f25ae9SGregory Neil Shapirodnl no match, try @domain for exceptions 135606f25ae9SGregory Neil ShapiroR< > $+ < @ $+ . > $: < $(generics @$2 $@ $1 $: $) > $1 < @ $2 . > 135706f25ae9SGregory Neil Shapirodnl workspace: ... or <match> user <@domain> 135806f25ae9SGregory Neil Shapirodnl no match, try local part 1359c2aa98e2SPeter WemmR< > $+ < @ $+ > $: < $(generics $1 $: $) > $1 < @ $2 > 136006f25ae9SGregory Neil ShapiroR< > $+ + $* < @ $+ > $: < $(generics $1+* $@ $2 $: $) > $1 + $2 < @ $3 > 136106f25ae9SGregory Neil ShapiroR< > $+ + $* < @ $+ > $: < $(generics $1 $: $) > $1 + $2 < @ $3 > 136206f25ae9SGregory Neil ShapiroR< $* @ $* > $* < $* > $@ $>canonify $1 @ $2 found qualified 136306f25ae9SGregory Neil ShapiroR< $+ > $* < $* > $: $>canonify $1 @ *LOCAL* found unqualified 1364c2aa98e2SPeter WemmR< > $* $: $1 not found', 1365c2aa98e2SPeter Wemm`dnl') 1366c2aa98e2SPeter Wemm 136706f25ae9SGregory Neil Shapiro# do not masquerade anything in class N 136806f25ae9SGregory Neil ShapiroR$* < @ $* $=N . > $@ $1 < @ $2 $3 . > 136906f25ae9SGregory Neil Shapiro 137040266059SGregory Neil Shapiroifdef(`MASQUERADE_NAME', `dnl 1371c2aa98e2SPeter Wemm# special case the users that should be exposed 1372c2aa98e2SPeter WemmR$=E < @ *LOCAL* > $@ $1 < @ $j . > leave exposed 1373c2aa98e2SPeter Wemmifdef(`_MASQUERADE_ENTIRE_DOMAIN_', 1374c2aa98e2SPeter Wemm`R$=E < @ $* $=M . > $@ $1 < @ $2 $3 . >', 1375c2aa98e2SPeter Wemm`R$=E < @ $=M . > $@ $1 < @ $2 . >') 1376c2aa98e2SPeter Wemmifdef(`_LIMITED_MASQUERADE_', `dnl', 1377c2aa98e2SPeter Wemm`R$=E < @ $=w . > $@ $1 < @ $2 . >') 1378c2aa98e2SPeter Wemm 1379c2aa98e2SPeter Wemm# handle domain-specific masquerading 1380c2aa98e2SPeter Wemmifdef(`_MASQUERADE_ENTIRE_DOMAIN_', 1381c2aa98e2SPeter Wemm`R$* < @ $* $=M . > $* $: $1 < @ $2 $3 . @ $M > $4 convert masqueraded doms', 1382c2aa98e2SPeter Wemm`R$* < @ $=M . > $* $: $1 < @ $2 . @ $M > $3 convert masqueraded doms') 1383c2aa98e2SPeter Wemmifdef(`_LIMITED_MASQUERADE_', `dnl', 1384c2aa98e2SPeter Wemm`R$* < @ $=w . > $* $: $1 < @ $2 . @ $M > $3') 1385c2aa98e2SPeter WemmR$* < @ *LOCAL* > $* $: $1 < @ $j . @ $M > $2 1386c2aa98e2SPeter WemmR$* < @ $+ @ > $* $: $1 < @ $2 > $3 $M is null 1387c2aa98e2SPeter WemmR$* < @ $+ @ $+ > $* $: $1 < @ $3 . > $4 $M is not null 138840266059SGregory Neil Shapirodnl', `dnl no masquerading 138940266059SGregory Neil Shapirodnl just fix *LOCAL* leftovers 139040266059SGregory Neil ShapiroR$* < @ *LOCAL* > $@ $1 < @ $j . >') 1391c2aa98e2SPeter Wemm 1392c2aa98e2SPeter Wemm################################################################### 1393c2aa98e2SPeter Wemm### Ruleset 94 -- convert envelope names to masqueraded form ### 1394c2aa98e2SPeter Wemm################################################################### 1395c2aa98e2SPeter Wemm 139606f25ae9SGregory Neil ShapiroSMasqEnv=94 1397c2aa98e2SPeter Wemmifdef(`_MASQUERADE_ENVELOPE_', 139806f25ae9SGregory Neil Shapiro`R$+ $@ $>MasqHdr $1', 1399c2aa98e2SPeter Wemm`R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2') 1400c2aa98e2SPeter Wemm 1401c2aa98e2SPeter Wemm################################################################### 1402c2aa98e2SPeter Wemm### Ruleset 98 -- local part of ruleset zero (can be null) ### 1403c2aa98e2SPeter Wemm################################################################### 1404c2aa98e2SPeter Wemm 140506f25ae9SGregory Neil ShapiroSParseLocal=98 140606f25ae9SGregory Neil Shapiroundivert(3)dnl LOCAL_RULE_0 1407c2aa98e2SPeter Wemm 140806f25ae9SGregory Neil Shapiroifdef(`_LDAP_ROUTING_', `dnl 140940266059SGregory Neil Shapiro###################################################################### 141040266059SGregory Neil Shapiro### LDAPExpand: Expand address using LDAP routing 141140266059SGregory Neil Shapiro### 141240266059SGregory Neil Shapiro### Parameters: 141340266059SGregory Neil Shapiro### <$1> -- parsed address (user < @ domain . >) (pass through) 141440266059SGregory Neil Shapiro### <$2> -- RFC822 address (user @ domain) (used for lookup) 141540266059SGregory Neil Shapiro### <$3> -- +detail information 141640266059SGregory Neil Shapiro### 141740266059SGregory Neil Shapiro### Returns: 141840266059SGregory Neil Shapiro### Mailer triplet ($#mailer $@ host $: address) 141940266059SGregory Neil Shapiro### Parsed address (user < @ domain . >) 142040266059SGregory Neil Shapiro###################################################################### 142140266059SGregory Neil Shapiro 142206f25ae9SGregory Neil ShapiroSLDAPExpand 142306f25ae9SGregory Neil Shapiro# do the LDAP lookups 142440266059SGregory Neil ShapiroR<$+><$+><$*> $: <$(ldapmra $2 $: $)> <$(ldapmh $2 $: $)> <$1> <$2> <$3> 142506f25ae9SGregory Neil Shapiro 1426605302a5SGregory Neil Shapiro# look for temporary failures (return original address, MTA will queue up) 1427605302a5SGregory Neil ShapiroR<$* <TMPF>> <$*> <$+> <$+> <$*> $@ $2 1428605302a5SGregory Neil ShapiroR<$*> <$* <TMPF>> <$+> <$+> <$*> $@ $2 1429605302a5SGregory Neil Shapiro 143006f25ae9SGregory Neil Shapiro# if mailRoutingAddress and local or non-existant mailHost, 143106f25ae9SGregory Neil Shapiro# return the new mailRoutingAddress 143240266059SGregory Neil Shapiroifelse(_LDAP_ROUTE_DETAIL_, `_PRESERVE_', `dnl 143340266059SGregory Neil ShapiroR<$+@$+> <$=w> <$+> <$+> <$*> $@ $>Parse0 $>canonify $1 $6 @ $2 143440266059SGregory Neil ShapiroR<$+@$+> <> <$+> <$+> <$*> $@ $>Parse0 $>canonify $1 $5 @ $2') 143540266059SGregory Neil ShapiroR<$+> <$=w> <$+> <$+> <$*> $@ $>Parse0 $>canonify $1 143640266059SGregory Neil ShapiroR<$+> <> <$+> <$+> <$*> $@ $>Parse0 $>canonify $1 143706f25ae9SGregory Neil Shapiro 143894c01205SGregory Neil Shapiro 143906f25ae9SGregory Neil Shapiro# if mailRoutingAddress and non-local mailHost, 144006f25ae9SGregory Neil Shapiro# relay to mailHost with new mailRoutingAddress 144140266059SGregory Neil Shapiroifelse(_LDAP_ROUTE_DETAIL_, `_PRESERVE_', `dnl 144240266059SGregory Neil Shapiroifdef(`_MAILER_TABLE_', `dnl 144340266059SGregory Neil Shapiro# check mailertable for host, relay from there 144440266059SGregory Neil ShapiroR<$+@$+> <$+> <$+> <$+> <$*> $>LDAPMailertable <$3> $>canonify $1 $6 @ $2', 144540266059SGregory Neil Shapiro`R<$+@$+> <$+> <$+> <$+> <$*> $#_RELAY_ $@ $3 $: $>canonify $1 $6 @ $2')') 144640266059SGregory Neil Shapiroifdef(`_MAILER_TABLE_', `dnl 144740266059SGregory Neil Shapiro# check mailertable for host, relay from there 144840266059SGregory Neil ShapiroR<$+> <$+> <$+> <$+> <$*> $>LDAPMailertable <$2> $>canonify $1', 144940266059SGregory Neil Shapiro`R<$+> <$+> <$+> <$+> <$*> $#_RELAY_ $@ $2 $: $>canonify $1') 145006f25ae9SGregory Neil Shapiro 145106f25ae9SGregory Neil Shapiro# if no mailRoutingAddress and local mailHost, 145206f25ae9SGregory Neil Shapiro# return original address 145340266059SGregory Neil ShapiroR<> <$=w> <$+> <$+> <$*> $@ $2 145406f25ae9SGregory Neil Shapiro 145594c01205SGregory Neil Shapiro 145606f25ae9SGregory Neil Shapiro# if no mailRoutingAddress and non-local mailHost, 145706f25ae9SGregory Neil Shapiro# relay to mailHost with original address 145840266059SGregory Neil Shapiroifdef(`_MAILER_TABLE_', `dnl 145940266059SGregory Neil Shapiro# check mailertable for host, relay from there 146040266059SGregory Neil ShapiroR<> <$+> <$+> <$+> <$*> $>LDAPMailertable <$1> $2', 146140266059SGregory Neil Shapiro`R<> <$+> <$+> <$+> <$*> $#_RELAY_ $@ $1 $: $2') 146206f25ae9SGregory Neil Shapiro 146340266059SGregory Neil Shapiroifdef(`_LDAP_ROUTE_DETAIL_', 146440266059SGregory Neil Shapiro`# if no mailRoutingAddress and no mailHost, 146540266059SGregory Neil Shapiro# try without +detail 146640266059SGregory Neil ShapiroR<> <> <$+> <$+ + $* @ $+> <> $@ $>LDAPExpand <$1> <$2 @ $4> <+$3>')dnl 146740266059SGregory Neil Shapiro 146840266059SGregory Neil Shapiro# if still no mailRoutingAddress and no mailHost, 146906f25ae9SGregory Neil Shapiro# try @domain 147040266059SGregory Neil Shapiroifelse(_LDAP_ROUTE_DETAIL_, `_PRESERVE_', `dnl 147140266059SGregory Neil ShapiroR<> <> <$+> <$+ + $* @ $+> <> $@ $>LDAPExpand <$1> <@ $4> <+$3>') 147240266059SGregory Neil ShapiroR<> <> <$+> <$+ @ $+> <$*> $@ $>LDAPExpand <$1> <@ $3> <$4> 147306f25ae9SGregory Neil Shapiro 147406f25ae9SGregory Neil Shapiro# if no mailRoutingAddress and no mailHost and this was a domain attempt, 147506f25ae9SGregory Neil Shapiroifelse(_LDAP_ROUTING_, `_MUST_EXIST_', `dnl 147606f25ae9SGregory Neil Shapiro# user does not exist 147740266059SGregory Neil ShapiroR<> <> <$+> <@ $+> <$*> $: <?> < $&{addr_type} > < $1 > 147840266059SGregory Neil Shapiro# only give error for envelope recipient 147940266059SGregory Neil ShapiroR<?> <e r> <$+> $#error $@ nouser $: "550 User unknown" 148040266059SGregory Neil ShapiroR<?> <$*> <$+> $@ $2', 148106f25ae9SGregory Neil Shapiro`dnl 148206f25ae9SGregory Neil Shapiro# return the original address 148340266059SGregory Neil ShapiroR<> <> <$+> <@ $+> <$*> $@ $1')', 148406f25ae9SGregory Neil Shapiro`dnl') 148506f25ae9SGregory Neil Shapiro 148606f25ae9SGregory Neil Shapiroifelse(substr(confDELIVERY_MODE,0,1), `d', `errprint(`WARNING: Antispam rules not available in deferred delivery mode. 148706f25ae9SGregory Neil Shapiro')') 148840266059SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl', `divert(-1)') 1489c2aa98e2SPeter Wemm###################################################################### 149040266059SGregory Neil Shapiro### D: LookUpDomain -- search for domain in access database 1491c2aa98e2SPeter Wemm### 1492c2aa98e2SPeter Wemm### Parameters: 1493c2aa98e2SPeter Wemm### <$1> -- key (domain name) 1494c2aa98e2SPeter Wemm### <$2> -- default (what to return if not found in db) 149506f25ae9SGregory Neil Shapirodnl must not be empty 149640266059SGregory Neil Shapiro### <$3> -- mark (must be <(!|+) single-token>) 149706f25ae9SGregory Neil Shapiro### ! does lookup only with tag 149806f25ae9SGregory Neil Shapiro### + does lookup with and without tag 149940266059SGregory Neil Shapiro### <$4> -- passthru (additional data passed unchanged through) 150006f25ae9SGregory Neil Shapirodnl returns: <default> <passthru> 150106f25ae9SGregory Neil Shapirodnl <result> <passthru> 1502c2aa98e2SPeter Wemm###################################################################### 1503c2aa98e2SPeter Wemm 150440266059SGregory Neil ShapiroSD 150506f25ae9SGregory Neil Shapirodnl workspace <key> <default> <passthru> <mark> 150606f25ae9SGregory Neil Shapirodnl lookup with tag (in front, no delimiter here) 150740266059SGregory Neil Shapirodnl 2 3 4 5 150840266059SGregory Neil ShapiroR<$*> <$+> <$- $-> <$*> $: < $(access $4`'_TAG_DELIM_`'$1 $: ? $) > <$1> <$2> <$3 $4> <$5> 150906f25ae9SGregory Neil Shapirodnl workspace <result-of-lookup|?> <key> <default> <passthru> <mark> 151006f25ae9SGregory Neil Shapirodnl lookup without tag? 151140266059SGregory Neil Shapirodnl 1 2 3 4 151240266059SGregory Neil ShapiroR<?> <$+> <$+> <+ $-> <$*> $: < $(access $1 $: ? $) > <$1> <$2> <+ $3> <$4> 151340266059SGregory Neil Shapiroifdef(`_LOOKUPDOTDOMAIN_', `dnl omit first component: lookup .rest 151440266059SGregory Neil Shapirodnl XXX apply this also to IP addresses? 151540266059SGregory Neil Shapirodnl currently it works the wrong way round for [1.2.3.4] 151640266059SGregory Neil Shapirodnl 1 2 3 4 5 6 151740266059SGregory Neil ShapiroR<?> <$+.$+> <$+> <$- $-> <$*> $: < $(access $5`'_TAG_DELIM_`'.$2 $: ? $) > <$1.$2> <$3> <$4 $5> <$6> 151840266059SGregory Neil Shapirodnl 1 2 3 4 5 151940266059SGregory Neil ShapiroR<?> <$+.$+> <$+> <+ $-> <$*> $: < $(access .$2 $: ? $) > <$1.$2> <$3> <+ $4> <$5>', `dnl') 152040266059SGregory Neil Shapiroifdef(`_ACCESS_SKIP_', `dnl 152140266059SGregory Neil Shapirodnl found SKIP: return <default> and <passthru> 152240266059SGregory Neil Shapirodnl 1 2 3 4 5 152340266059SGregory Neil ShapiroR<SKIP> <$+> <$+> <$- $-> <$*> $@ <$2> <$5>', `dnl') 152440266059SGregory Neil Shapirodnl not found: IPv4 net (no check is done whether it is an IP number!) 152540266059SGregory Neil Shapirodnl 1 2 3 4 5 6 152640266059SGregory Neil ShapiroR<?> <[$+.$-]> <$+> <$- $-> <$*> $@ $>D <[$1]> <$3> <$4 $5> <$6> 152740266059SGregory Neil Shapiroifdef(`NO_NETINET6', `dnl', 152840266059SGregory Neil Shapiro`dnl not found: IPv6 net 152940266059SGregory Neil Shapirodnl (could be merged with previous rule if we have a class containing .:) 153040266059SGregory Neil Shapirodnl 1 2 3 4 5 6 153140266059SGregory Neil ShapiroR<?> <[$+::$-]> <$+> <$- $-> <$*> $: $>D <[$1]> <$3> <$4 $5> <$6> 153240266059SGregory Neil ShapiroR<?> <[$+:$-]> <$+> <$- $-> <$*> $: $>D <[$1]> <$3> <$4 $5> <$6>') 153306f25ae9SGregory Neil Shapirodnl not found, but subdomain: try again 153440266059SGregory Neil Shapirodnl 1 2 3 4 5 6 153540266059SGregory Neil ShapiroR<?> <$+.$+> <$+> <$- $-> <$*> $@ $>D <$2> <$3> <$4 $5> <$6> 153640266059SGregory Neil Shapiroifdef(`_FFR_LOOKUPTAG_', `dnl lookup Tag: 153740266059SGregory Neil Shapirodnl 1 2 3 4 153840266059SGregory Neil ShapiroR<?> <$+> <$+> <! $-> <$*> $: < $(access $3`'_TAG_DELIM_ $: ? $) > <$1> <$2> <! $3> <$4>', `dnl') 153940266059SGregory Neil Shapirodnl not found, no subdomain: return <default> and <passthru> 154040266059SGregory Neil Shapirodnl 1 2 3 4 5 154140266059SGregory Neil ShapiroR<?> <$+> <$+> <$- $-> <$*> $@ <$2> <$5> 154240266059SGregory Neil Shapiroifdef(`_ATMPF_', `dnl tempfail? 154340266059SGregory Neil Shapirodnl 2 3 4 5 6 154440266059SGregory Neil ShapiroR<$* _ATMPF_> <$+> <$+> <$- $-> <$*> $@ <_ATMPF_> <$6>', `dnl') 154540266059SGregory Neil Shapirodnl return <result of lookup> and <passthru> 154640266059SGregory Neil Shapirodnl 2 3 4 5 6 154740266059SGregory Neil ShapiroR<$*> <$+> <$+> <$- $-> <$*> $@ <$1> <$6> 1548c2aa98e2SPeter Wemm 1549c2aa98e2SPeter Wemm###################################################################### 155040266059SGregory Neil Shapiro### A: LookUpAddress -- search for host address in access database 1551c2aa98e2SPeter Wemm### 1552c2aa98e2SPeter Wemm### Parameters: 1553c2aa98e2SPeter Wemm### <$1> -- key (dot quadded host address) 1554c2aa98e2SPeter Wemm### <$2> -- default (what to return if not found in db) 155506f25ae9SGregory Neil Shapirodnl must not be empty 155640266059SGregory Neil Shapiro### <$3> -- mark (must be <(!|+) single-token>) 155706f25ae9SGregory Neil Shapiro### ! does lookup only with tag 155806f25ae9SGregory Neil Shapiro### + does lookup with and without tag 155940266059SGregory Neil Shapiro### <$4> -- passthru (additional data passed through) 156006f25ae9SGregory Neil Shapirodnl returns: <default> <passthru> 156106f25ae9SGregory Neil Shapirodnl <result> <passthru> 1562c2aa98e2SPeter Wemm###################################################################### 1563c2aa98e2SPeter Wemm 156440266059SGregory Neil ShapiroSA 156506f25ae9SGregory Neil Shapirodnl lookup with tag 156640266059SGregory Neil Shapirodnl 2 3 4 5 156740266059SGregory Neil ShapiroR<$+> <$+> <$- $-> <$*> $: < $(access $4`'_TAG_DELIM_`'$1 $: ? $) > <$1> <$2> <$3 $4> <$5> 156806f25ae9SGregory Neil Shapirodnl lookup without tag 156940266059SGregory Neil Shapirodnl 1 2 3 4 157040266059SGregory Neil ShapiroR<?> <$+> <$+> <+ $-> <$*> $: < $(access $1 $: ? $) > <$1> <$2> <+ $3> <$4> 157140266059SGregory Neil Shapirodnl workspace <result-of-lookup|?> <key> <default> <mark> <passthru> 157240266059SGregory Neil Shapiroifdef(`_ACCESS_SKIP_', `dnl 157340266059SGregory Neil Shapirodnl found SKIP: return <default> and <passthru> 157440266059SGregory Neil Shapirodnl 1 2 3 4 5 157540266059SGregory Neil ShapiroR<SKIP> <$+> <$+> <$- $-> <$*> $@ <$2> <$5>', `dnl') 157640266059SGregory Neil Shapiroifdef(`NO_NETINET6', `dnl', 157740266059SGregory Neil Shapiro`dnl no match; IPv6: remove last part 157840266059SGregory Neil Shapirodnl 1 2 3 4 5 6 157940266059SGregory Neil ShapiroR<?> <$+::$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6> 158040266059SGregory Neil ShapiroR<?> <$+:$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6>') 158106f25ae9SGregory Neil Shapirodnl no match; IPv4: remove last part 158240266059SGregory Neil Shapirodnl 1 2 3 4 5 6 158340266059SGregory Neil ShapiroR<?> <$+.$-> <$+> <$- $-> <$*> $@ $>A <$1> <$3> <$4 $5> <$6> 158406f25ae9SGregory Neil Shapirodnl no match: return default 158540266059SGregory Neil Shapirodnl 1 2 3 4 5 158640266059SGregory Neil ShapiroR<?> <$+> <$+> <$- $-> <$*> $@ <$2> <$5> 158740266059SGregory Neil Shapiroifdef(`_ATMPF_', `dnl tempfail? 158840266059SGregory Neil Shapirodnl 2 3 4 5 6 158940266059SGregory Neil ShapiroR<$* _ATMPF_> <$+> <$+> <$- $-> <$*> $@ <_ATMPF_> <$6>', `dnl') 159006f25ae9SGregory Neil Shapirodnl match: return result 159140266059SGregory Neil Shapirodnl 2 3 4 5 6 159240266059SGregory Neil ShapiroR<$*> <$+> <$+> <$- $-> <$*> $@ <$1> <$6> 159340266059SGregory Neil Shapirodnl endif _ACCESS_TABLE_ 159440266059SGregory Neil Shapirodivert(0) 1595c2aa98e2SPeter Wemm###################################################################### 1596065a643dSPeter Wemm### CanonAddr -- Convert an address into a standard form for 1597065a643dSPeter Wemm### relay checking. Route address syntax is 1598065a643dSPeter Wemm### crudely converted into a %-hack address. 1599065a643dSPeter Wemm### 1600065a643dSPeter Wemm### Parameters: 1601065a643dSPeter Wemm### $1 -- full recipient address 1602065a643dSPeter Wemm### 1603065a643dSPeter Wemm### Returns: 1604065a643dSPeter Wemm### parsed address, not in source route form 160506f25ae9SGregory Neil Shapirodnl user%host%host<@domain> 160606f25ae9SGregory Neil Shapirodnl host!user<@domain> 1607065a643dSPeter Wemm###################################################################### 1608065a643dSPeter Wemm 1609065a643dSPeter WemmSCanonAddr 161006f25ae9SGregory Neil ShapiroR$* $: $>Parse0 $>canonify $1 make domain canonical 161106f25ae9SGregory Neil Shapiroifdef(`_USE_DEPRECATED_ROUTE_ADDR_',`dnl 1612065a643dSPeter WemmR< @ $+ > : $* @ $* < @ $1 > : $2 % $3 change @ to % in src route 1613065a643dSPeter WemmR$* < @ $+ > : $* : $* $3 $1 < @ $2 > : $4 change to % hack. 1614065a643dSPeter WemmR$* < @ $+ > : $* $3 $1 < @ $2 > 161506f25ae9SGregory Neil Shapirodnl') 1616065a643dSPeter Wemm 1617065a643dSPeter Wemm###################################################################### 1618c2aa98e2SPeter Wemm### ParseRecipient -- Strip off hosts in $=R as well as possibly 1619c2aa98e2SPeter Wemm### $* $=m or the access database. 1620c2aa98e2SPeter Wemm### Check user portion for host separators. 1621c2aa98e2SPeter Wemm### 1622c2aa98e2SPeter Wemm### Parameters: 1623c2aa98e2SPeter Wemm### $1 -- full recipient address 1624c2aa98e2SPeter Wemm### 1625c2aa98e2SPeter Wemm### Returns: 1626c2aa98e2SPeter Wemm### parsed, non-local-relaying address 1627c2aa98e2SPeter Wemm###################################################################### 1628c2aa98e2SPeter Wemm 1629c2aa98e2SPeter WemmSParseRecipient 163006f25ae9SGregory Neil Shapirodnl mark and canonify address 1631065a643dSPeter WemmR$* $: <?> $>CanonAddr $1 163206f25ae9SGregory Neil Shapirodnl workspace: <?> localpart<@domain[.]> 1633c2aa98e2SPeter WemmR<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots 163406f25ae9SGregory Neil Shapirodnl workspace: <?> localpart<@domain> 1635c2aa98e2SPeter WemmR<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part 1636c2aa98e2SPeter Wemm 1637c2aa98e2SPeter Wemm# if no $=O character, no host in the user portion, we are done 1638c2aa98e2SPeter WemmR<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4> 163906f25ae9SGregory Neil Shapirodnl no $=O in localpart: return 1640c2aa98e2SPeter WemmR<?> $* $@ $1 1641c2aa98e2SPeter Wemm 164240266059SGregory Neil Shapirodnl workspace: <NO> localpart<@domain>, where localpart contains $=O 164306f25ae9SGregory Neil Shapirodnl mark everything which has an "authorized" domain with <RELAY> 1644c2aa98e2SPeter Wemmifdef(`_RELAY_ENTIRE_DOMAIN_', `dnl 1645c2aa98e2SPeter Wemm# if we relay, check username portion for user%host so host can be checked also 1646c2aa98e2SPeter WemmR<NO> $* < @ $* $=m > $: <RELAY> $1 < @ $2 $3 >', `dnl') 164706f25ae9SGregory Neil Shapirodnl workspace: <(NO|RELAY)> localpart<@domain>, where localpart contains $=O 164806f25ae9SGregory Neil Shapirodnl if mark is <NO> then change it to <RELAY> if domain is "authorized" 164940266059SGregory Neil Shapiro 165040266059SGregory Neil Shapirodnl what if access map returns something else than RELAY? 165140266059SGregory Neil Shapirodnl we are only interested in RELAY entries... 165240266059SGregory Neil Shapirodnl other To: entries: blacklist recipient; generic entries? 165340266059SGregory Neil Shapirodnl if it is an error we probably do not want to relay anyway 1654c2aa98e2SPeter Wemmifdef(`_RELAY_HOSTS_ONLY_', 1655c2aa98e2SPeter Wemm`R<NO> $* < @ $=R > $: <RELAY> $1 < @ $2 > 165606f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 165706f25ae9SGregory Neil ShapiroR<NO> $* < @ $+ > $: <$(access To:$2 $: NO $)> $1 < @ $2 > 1658065a643dSPeter WemmR<NO> $* < @ $+ > $: <$(access $2 $: NO $)> $1 < @ $2 >',`dnl')', 1659c2aa98e2SPeter Wemm`R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 > 166006f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 166140266059SGregory Neil ShapiroR<NO> $* < @ $+ > $: $>D <$2> <NO> <+ To> <$1 < @ $2 >> 1662c2aa98e2SPeter WemmR<$+> <$+> $: <$1> $2',`dnl')') 1663065a643dSPeter Wemm 166406f25ae9SGregory Neil Shapiro 166540266059SGregory Neil Shapiroifdef(`_RELAY_MX_SERVED_', `dnl 166640266059SGregory Neil Shapirodnl do "we" ($=w) act as backup MX server for the destination domain? 166740266059SGregory Neil ShapiroR<NO> $* < @ $+ > $: <MX> < : $(mxserved $2 $) : > < $1 < @$2 > > 166840266059SGregory Neil ShapiroR<MX> < : $* <TEMP> : > $* $#TEMP $@ 4.7.1 $: "450 Can not check MX records for recipient host " $1 166940266059SGregory Neil Shapirodnl yes: mark it as <RELAY> 167040266059SGregory Neil ShapiroR<MX> < $* : $=w. : $* > < $+ > $: <RELAY> $4 167140266059SGregory Neil Shapirodnl no: put old <NO> mark back 167240266059SGregory Neil ShapiroR<MX> < : $* : > < $+ > $: <NO> $2', `dnl') 167340266059SGregory Neil Shapiro 167440266059SGregory Neil Shapirodnl do we relay to this recipient domain? 1675c2aa98e2SPeter WemmR<RELAY> $* < @ $* > $@ $>ParseRecipient $1 167640266059SGregory Neil Shapirodnl something else 167740266059SGregory Neil ShapiroR<$+> $* $@ $2 1678c2aa98e2SPeter Wemm 167906f25ae9SGregory Neil Shapiro 1680c2aa98e2SPeter Wemm###################################################################### 1681c2aa98e2SPeter Wemm### check_relay -- check hostname/address on SMTP startup 1682c2aa98e2SPeter Wemm###################################################################### 1683c2aa98e2SPeter Wemm 1684c2aa98e2SPeter WemmSLocal_check_relay 168506f25ae9SGregory Neil ShapiroScheck`'_U_`'relay 1686c2aa98e2SPeter WemmR$* $: $1 $| $>"Local_check_relay" $1 1687c2aa98e2SPeter WemmR$* $| $* $| $#$* $#$3 1688c2aa98e2SPeter WemmR$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2 1689c2aa98e2SPeter Wemm 1690c2aa98e2SPeter WemmSBasic_check_relay 1691c2aa98e2SPeter Wemm# check for deferred delivery mode 169294c01205SGregory Neil ShapiroR$* $: < $&{deliveryMode} > $1 1693c2aa98e2SPeter WemmR< d > $* $@ deferred 1694c2aa98e2SPeter WemmR< $* > $* $: $2 1695c2aa98e2SPeter Wemm 169606f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 169742e5d165SGregory Neil Shapirodnl workspace: {client_name} $| {client_addr} 169840266059SGregory Neil ShapiroR$+ $| $+ $: $>D < $1 > <?> <+ Connect> < $2 > 169942e5d165SGregory Neil Shapirodnl workspace: <result-of-lookup> <{client_addr}> 170040266059SGregory Neil ShapiroR<?> <$+> $: $>A < $1 > <?> <+ Connect> <> no: another lookup 170140266059SGregory Neil Shapirodnl workspace: <result-of-lookup> (<>|<{client_addr}>) 170240266059SGregory Neil ShapiroR<?> <$*> $: OK found nothing 170340266059SGregory Neil Shapirodnl workspace: <result-of-lookup> (<>|<{client_addr}>) | OK 170442e5d165SGregory Neil ShapiroR<$={Accept}> <$*> $@ $1 return value of lookup 170540266059SGregory Neil ShapiroR<REJECT> <$*> $#error ifdef(`confREJECT_MSG', `$: "confREJECT_MSG"', `$@ 5.7.1 $: "550 Access denied"') 170640266059SGregory Neil ShapiroR<DISCARD> <$*> $#discard $: discard 170740266059SGregory Neil Shapiroifdef(`_FFR_QUARANTINE', 170840266059SGregory Neil Shapiro`R<QUARANTINE:$+> <$*> $#error $@ quarantine $: $1', `dnl') 170906f25ae9SGregory Neil Shapirodnl error tag 171042e5d165SGregory Neil ShapiroR<ERROR:$-.$-.$-:$+> <$*> $#error $@ $1.$2.$3 $: $4 171142e5d165SGregory Neil ShapiroR<ERROR:$+> <$*> $#error $: $1 171240266059SGregory Neil Shapiroifdef(`_ATMPF_', `R<$* _ATMPF_> <$*> $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 171306f25ae9SGregory Neil Shapirodnl generic error from access map 171442e5d165SGregory Neil ShapiroR<$+> <$*> $#error $: $1', `dnl') 1715c2aa98e2SPeter Wemm 1716c2aa98e2SPeter Wemmifdef(`_RBL_',`dnl 171706f25ae9SGregory Neil Shapiro# DNS based IP address spam list 171840266059SGregory Neil Shapirodnl workspace: ignored... 1719c2aa98e2SPeter WemmR$* $: $&{client_addr} 172006f25ae9SGregory Neil ShapiroR$-.$-.$-.$- $: <?> $(host $4.$3.$2.$1._RBL_. $: OK $) 172106f25ae9SGregory Neil ShapiroR<?>OK $: OKSOFAR 172294c01205SGregory Neil ShapiroR<?>$+ $#error $@ 5.7.1 $: "550 Rejected: " $&{client_addr} " listed at _RBL_"', 1723c2aa98e2SPeter Wemm`dnl') 172406f25ae9SGregory Neil Shapiroundivert(8) 1725c2aa98e2SPeter Wemm 1726c2aa98e2SPeter Wemm###################################################################### 1727c2aa98e2SPeter Wemm### check_mail -- check SMTP ``MAIL FROM:'' command argument 1728c2aa98e2SPeter Wemm###################################################################### 1729c2aa98e2SPeter Wemm 1730c2aa98e2SPeter WemmSLocal_check_mail 173106f25ae9SGregory Neil ShapiroScheck`'_U_`'mail 1732c2aa98e2SPeter WemmR$* $: $1 $| $>"Local_check_mail" $1 1733c2aa98e2SPeter WemmR$* $| $#$* $#$2 1734c2aa98e2SPeter WemmR$* $| $* $@ $>"Basic_check_mail" $1 1735c2aa98e2SPeter Wemm 1736c2aa98e2SPeter WemmSBasic_check_mail 1737c2aa98e2SPeter Wemm# check for deferred delivery mode 173894c01205SGregory Neil ShapiroR$* $: < $&{deliveryMode} > $1 1739c2aa98e2SPeter WemmR< d > $* $@ deferred 1740c2aa98e2SPeter WemmR< $* > $* $: $2 1741c2aa98e2SPeter Wemm 174206f25ae9SGregory Neil Shapiro# authenticated? 174306f25ae9SGregory Neil Shapirodnl done first: we can require authentication for every mail transaction 174406f25ae9SGregory Neil Shapirodnl workspace: address as given by MAIL FROM: (sender) 174506f25ae9SGregory Neil ShapiroR$* $: $1 $| $>"tls_client" $&{verify} $| MAIL 174606f25ae9SGregory Neil ShapiroR$* $| $#$+ $#$2 174706f25ae9SGregory Neil Shapirodnl undo damage: remove result of tls_client call 174806f25ae9SGregory Neil ShapiroR$* $| $* $: $1 174906f25ae9SGregory Neil Shapiro 175006f25ae9SGregory Neil Shapirodnl workspace: address as given by MAIL FROM: 175106f25ae9SGregory Neil ShapiroR<> $@ <OK> we MUST accept <> (RFC 1123) 175206f25ae9SGregory Neil Shapiroifdef(`_ACCEPT_UNQUALIFIED_SENDERS_',`dnl',`dnl 175306f25ae9SGregory Neil Shapirodnl do some additional checks 175406f25ae9SGregory Neil Shapirodnl no user@host 175506f25ae9SGregory Neil Shapirodnl no user@localhost (if nonlocal sender) 175606f25ae9SGregory Neil Shapirodnl this is a pretty simple canonification, it will not catch every case 175706f25ae9SGregory Neil Shapirodnl just make sure the address has <> around it (which is required by 175806f25ae9SGregory Neil Shapirodnl the RFC anyway, maybe we should complain if they are missing...) 175906f25ae9SGregory Neil Shapirodnl dirty trick: if it is user@host, just add a dot: user@host. this will 176006f25ae9SGregory Neil Shapirodnl not be modified by host lookups. 176106f25ae9SGregory Neil ShapiroR$+ $: <?> $1 176206f25ae9SGregory Neil ShapiroR<?><$+> $: <@> <$1> 176306f25ae9SGregory Neil ShapiroR<?>$+ $: <@> <$1> 176406f25ae9SGregory Neil Shapirodnl workspace: <@> <address> 176506f25ae9SGregory Neil Shapirodnl prepend daemon_flags 176606f25ae9SGregory Neil ShapiroR$* $: $&{daemon_flags} $| $1 176706f25ae9SGregory Neil Shapirodnl workspace: ${daemon_flags} $| <@> <address> 176806f25ae9SGregory Neil Shapirodnl do not allow these at all or only from local systems? 176906f25ae9SGregory Neil ShapiroR$* f $* $| <@> < $* @ $- > $: < ? $&{client_name} > < $3 @ $4 > 177006f25ae9SGregory Neil Shapirodnl accept unqualified sender: change mark to avoid test 177106f25ae9SGregory Neil ShapiroR$* u $* $| <@> < $* > $: <?> < $3 > 177206f25ae9SGregory Neil Shapirodnl workspace: ${daemon_flags} $| <@> <address> 177306f25ae9SGregory Neil Shapirodnl or: <? ${client_name} > <address> 177406f25ae9SGregory Neil Shapirodnl or: <?> <address> 177506f25ae9SGregory Neil Shapirodnl remove daemon_flags 177606f25ae9SGregory Neil ShapiroR$* $| $* $: $2 177706f25ae9SGregory Neil Shapiro# handle case of @localhost on address 177806f25ae9SGregory Neil ShapiroR<@> < $* @ localhost > $: < ? $&{client_name} > < $1 @ localhost > 177906f25ae9SGregory Neil ShapiroR<@> < $* @ [127.0.0.1] > 178006f25ae9SGregory Neil Shapiro $: < ? $&{client_name} > < $1 @ [127.0.0.1] > 178106f25ae9SGregory Neil ShapiroR<@> < $* @ localhost.$m > 178206f25ae9SGregory Neil Shapiro $: < ? $&{client_name} > < $1 @ localhost.$m > 178306f25ae9SGregory Neil Shapiroifdef(`_NO_UUCP_', `dnl', 178406f25ae9SGregory Neil Shapiro`R<@> < $* @ localhost.UUCP > 178506f25ae9SGregory Neil Shapiro $: < ? $&{client_name} > < $1 @ localhost.UUCP >') 178606f25ae9SGregory Neil Shapirodnl workspace: < ? $&{client_name} > <user@localhost|host> 178706f25ae9SGregory Neil Shapirodnl or: <@> <address> 178806f25ae9SGregory Neil Shapirodnl or: <?> <address> (thanks to u in ${daemon_flags}) 178906f25ae9SGregory Neil ShapiroR<@> $* $: $1 no localhost as domain 179006f25ae9SGregory Neil Shapirodnl workspace: < ? $&{client_name} > <user@localhost|host> 179106f25ae9SGregory Neil Shapirodnl or: <address> 179206f25ae9SGregory Neil Shapirodnl or: <?> <address> (thanks to u in ${daemon_flags}) 179306f25ae9SGregory Neil ShapiroR<? $=w> $* $: $2 local client: ok 179440266059SGregory Neil ShapiroR<? $+> <$+> $#error $@ 5.5.4 $: "_CODE553 Real domain name required for sender address" 179506f25ae9SGregory Neil Shapirodnl remove <?> (happens only if ${client_name} == "" or u in ${daemon_flags}) 179606f25ae9SGregory Neil ShapiroR<?> $* $: $1') 179706f25ae9SGregory Neil Shapirodnl workspace: address (or <address>) 179806f25ae9SGregory Neil ShapiroR$* $: <?> $>CanonAddr $1 canonify sender address and mark it 179906f25ae9SGregory Neil Shapirodnl workspace: <?> CanonicalAddress (i.e. address in canonical form localpart<@host>) 180006f25ae9SGregory Neil Shapirodnl there is nothing behind the <@host> so no trailing $* needed 1801065a643dSPeter WemmR<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots 1802c2aa98e2SPeter Wemm# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc) 180306f25ae9SGregory Neil ShapiroR<?> $* < @ $* $=P > $: <OK> $1 < @ $2 $3 > 180406f25ae9SGregory Neil Shapirodnl workspace <mark> CanonicalAddress where mark is ? or OK 180594c01205SGregory Neil Shapirodnl A sender address with my local host name ($j) is safe 180694c01205SGregory Neil ShapiroR<?> $* < @ $j > $: <OK> $1 < @ $j > 1807c2aa98e2SPeter Wemmifdef(`_ACCEPT_UNRESOLVABLE_DOMAINS_', 180840266059SGregory Neil Shapiro`R<?> $* < @ $+ > $: <_RES_OK_> $1 < @ $2 > ... unresolvable OK', 180906f25ae9SGregory Neil Shapiro`R<?> $* < @ $+ > $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > 181006f25ae9SGregory Neil ShapiroR<? $* <$->> $* < @ $+ > 181106f25ae9SGregory Neil Shapiro $: <$2> $3 < @ $4 >') 181240266059SGregory Neil Shapirodnl workspace <mark> CanonicalAddress where mark is ?, _RES_OK_, PERM, TEMP 181306f25ae9SGregory Neil Shapirodnl mark is ? iff the address is user (wo @domain) 1814c2aa98e2SPeter Wemm 181506f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 181606f25ae9SGregory Neil Shapiro# check sender address: user@address, user@, address 181706f25ae9SGregory Neil Shapirodnl should we remove +ext from user? 181840266059SGregory Neil Shapirodnl workspace: <mark> CanonicalAddress where mark is: ?, _RES_OK_, PERM, TEMP 181940266059SGregory Neil ShapiroR<$+> $+ < @ $* > $: @<$1> <$2 < @ $3 >> $| <F:$2@$3> <U:$2@> <D:$3> 182006f25ae9SGregory Neil ShapiroR<$+> $+ $: @<$1> <$2> $| <U:$2@> 182106f25ae9SGregory Neil Shapirodnl workspace: @<mark> <CanonicalAddress> $| <@type:address> .... 182206f25ae9SGregory Neil Shapirodnl $| is used as delimiter, otherwise false matches may occur: <user<@domain>> 182306f25ae9SGregory Neil Shapirodnl will only return user<@domain when "reversing" the args 182406f25ae9SGregory Neil ShapiroR@ <$+> <$*> $| <$+> $: <@> <$1> <$2> $| $>SearchList <+ From> $| <$3> <> 182506f25ae9SGregory Neil Shapirodnl workspace: <@><mark> <CanonicalAddress> $| <result> 182606f25ae9SGregory Neil ShapiroR<@> <$+> <$*> $| <$*> $: <$3> <$1> <$2> reverse result 182706f25ae9SGregory Neil Shapirodnl workspace: <result> <mark> <CanonicalAddress> 1828c2aa98e2SPeter Wemm# retransform for further use 182906f25ae9SGregory Neil Shapirodnl required form: 183006f25ae9SGregory Neil Shapirodnl <ResultOfLookup|mark> CanonicalAddress 183106f25ae9SGregory Neil ShapiroR<?> <$+> <$*> $: <$1> $2 no match 183206f25ae9SGregory Neil ShapiroR<$+> <$+> <$*> $: <$1> $3 relevant result, keep it', `dnl') 183306f25ae9SGregory Neil Shapirodnl workspace <ResultOfLookup|mark> CanonicalAddress 183406f25ae9SGregory Neil Shapirodnl mark is ? iff the address is user (wo @domain) 1835c2aa98e2SPeter Wemm 1836c2aa98e2SPeter Wemmifdef(`_ACCEPT_UNQUALIFIED_SENDERS_',`dnl',`dnl 1837c2aa98e2SPeter Wemm# handle case of no @domain on address 183806f25ae9SGregory Neil Shapirodnl prepend daemon_flags 183906f25ae9SGregory Neil ShapiroR<?> $* $: $&{daemon_flags} $| <?> $1 184006f25ae9SGregory Neil Shapirodnl accept unqualified sender: change mark to avoid test 184140266059SGregory Neil ShapiroR$* u $* $| <?> $* $: <_RES_OK_> $3 184206f25ae9SGregory Neil Shapirodnl remove daemon_flags 184306f25ae9SGregory Neil ShapiroR$* $| $* $: $2 1844c2aa98e2SPeter WemmR<?> $* $: < ? $&{client_name} > $1 1845c2aa98e2SPeter WemmR<?> $* $@ <OK> ...local unqualed ok 184640266059SGregory Neil ShapiroR<? $+> $* $#error $@ 5.5.4 $: "_CODE553 Domain name required for sender address " $&f 1847c2aa98e2SPeter Wemm ...remote is not') 1848c2aa98e2SPeter Wemm# check results 184906f25ae9SGregory Neil ShapiroR<?> $* $: @ $1 mark address: nothing known about it 185040266059SGregory Neil ShapiroR<$={ResOk}> $* $@ <_RES_OK_> domain ok: stop 185106f25ae9SGregory Neil ShapiroR<TEMP> $* $#error $@ 4.1.8 $: "451 Domain of sender address " $&f " does not resolve" 185240266059SGregory Neil ShapiroR<PERM> $* $#error $@ 5.1.8 $: "_CODE553 Domain of sender address " $&f " does not exist" 185306f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 185440266059SGregory Neil ShapiroR<$={Accept}> $* $# $1 accept from access map 1855c2aa98e2SPeter WemmR<DISCARD> $* $#discard $: discard 185640266059SGregory Neil Shapiroifdef(`_FFR_QUARANTINE', 185740266059SGregory Neil Shapiro`R<QUARANTINE:$+> $* $#error $@ quarantine $: $1', `dnl') 185806f25ae9SGregory Neil ShapiroR<REJECT> $* $#error ifdef(`confREJECT_MSG', `$: "confREJECT_MSG"', `$@ 5.7.1 $: "550 Access denied"') 185906f25ae9SGregory Neil Shapirodnl error tag 186006f25ae9SGregory Neil ShapiroR<ERROR:$-.$-.$-:$+> $* $#error $@ $1.$2.$3 $: $4 186106f25ae9SGregory Neil ShapiroR<ERROR:$+> $* $#error $: $1 186240266059SGregory Neil Shapiroifdef(`_ATMPF_', `R<_ATMPF_> $* $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 186306f25ae9SGregory Neil Shapirodnl generic error from access map 186406f25ae9SGregory Neil ShapiroR<$+> $* $#error $: $1 error from access db', 1865c2aa98e2SPeter Wemm`dnl') 1866c2aa98e2SPeter Wemm 1867c2aa98e2SPeter Wemm###################################################################### 1868c2aa98e2SPeter Wemm### check_rcpt -- check SMTP ``RCPT TO:'' command argument 1869c2aa98e2SPeter Wemm###################################################################### 1870c2aa98e2SPeter Wemm 1871c2aa98e2SPeter WemmSLocal_check_rcpt 187206f25ae9SGregory Neil ShapiroScheck`'_U_`'rcpt 1873c2aa98e2SPeter WemmR$* $: $1 $| $>"Local_check_rcpt" $1 1874c2aa98e2SPeter WemmR$* $| $#$* $#$2 1875c2aa98e2SPeter WemmR$* $| $* $@ $>"Basic_check_rcpt" $1 1876c2aa98e2SPeter Wemm 1877c2aa98e2SPeter WemmSBasic_check_rcpt 187840266059SGregory Neil Shapiro# empty address? 187940266059SGregory Neil ShapiroR<> $#error $@ nouser $: "553 User address required" 188040266059SGregory Neil ShapiroR$@ $#error $@ nouser $: "553 User address required" 1881c2aa98e2SPeter Wemm# check for deferred delivery mode 188294c01205SGregory Neil ShapiroR$* $: < $&{deliveryMode} > $1 1883c2aa98e2SPeter WemmR< d > $* $@ deferred 1884c2aa98e2SPeter WemmR< $* > $* $: $2 1885c2aa98e2SPeter Wemm 188606f25ae9SGregory Neil Shapiroifdef(`_REQUIRE_QUAL_RCPT_', `dnl 188740266059SGregory Neil Shapirodnl this code checks for user@host where host is not a FQHN. 188840266059SGregory Neil Shapirodnl it is not activated. 188940266059SGregory Neil Shapirodnl notice: code to check for a recipient without a domain name is 189040266059SGregory Neil Shapirodnl available down below; look for the same macro. 189140266059SGregory Neil Shapirodnl this check is done here because the name might be qualified by the 189240266059SGregory Neil Shapirodnl canonicalization. 189340266059SGregory Neil Shapiro# require fully qualified domain part? 189440266059SGregory Neil Shapirodnl very simple canonification: make sure the address is in < > 189506f25ae9SGregory Neil ShapiroR$+ $: <?> $1 189606f25ae9SGregory Neil ShapiroR<?> <$+> $: <@> <$1> 189706f25ae9SGregory Neil ShapiroR<?> $+ $: <@> <$1> 189840266059SGregory Neil ShapiroR<@> < postmaster > $: postmaster 189940266059SGregory Neil ShapiroR<@> < $* @ $+ . $+ > $: < $3 @ $4 . $5 > 190006f25ae9SGregory Neil Shapirodnl prepend daemon_flags 190140266059SGregory Neil ShapiroR<@> $* $: $&{daemon_flags} $| <@> $1 190206f25ae9SGregory Neil Shapirodnl workspace: ${daemon_flags} $| <@> <address> 190306f25ae9SGregory Neil Shapirodnl do not allow these at all or only from local systems? 190440266059SGregory Neil ShapiroR$* r $* $| <@> < $* @ $* > $: < ? $&{client_name} > < $3 @ $4 > 190506f25ae9SGregory Neil ShapiroR<?> < $* > $: <$1> 190606f25ae9SGregory Neil ShapiroR<? $=w> < $* > $: <$1> 190740266059SGregory Neil ShapiroR<? $+> <$+> $#error $@ 5.5.4 $: "553 Fully qualified domain name required" 190806f25ae9SGregory Neil Shapirodnl remove daemon_flags for other cases 190906f25ae9SGregory Neil ShapiroR$* $| <@> $* $: $2', `dnl') 191006f25ae9SGregory Neil Shapiro 191140266059SGregory Neil Shapirodnl ################################################################## 191240266059SGregory Neil Shapirodnl call subroutines for recipient and relay 191340266059SGregory Neil Shapirodnl possible returns from subroutines: 191440266059SGregory Neil Shapirodnl $#TEMP temporary failure 191540266059SGregory Neil Shapirodnl $#error permanent failure (or temporary if from access map) 191640266059SGregory Neil Shapirodnl $#other stop processing 191740266059SGregory Neil Shapirodnl RELAY RELAYing allowed 191840266059SGregory Neil Shapirodnl other otherwise 191940266059SGregory Neil Shapiro###################################################################### 192040266059SGregory Neil ShapiroR$* $: $1 $| @ $>"Rcpt_ok" $1 192140266059SGregory Neil Shapirodnl temporary failure? remove mark @ and remember 192240266059SGregory Neil ShapiroR$* $| @ $#TEMP $+ $: $1 $| T $2 192340266059SGregory Neil Shapirodnl error or ok (stop) 192440266059SGregory Neil ShapiroR$* $| @ $#$* $#$2 192540266059SGregory Neil Shapiroifdef(`_PROMISCUOUS_RELAY_', `divert(-1)', `dnl') 192640266059SGregory Neil ShapiroR$* $| @ RELAY $@ RELAY 192740266059SGregory Neil Shapirodnl something else: call check sender (relay) 192840266059SGregory Neil ShapiroR$* $| @ $* $: O $| $>"Relay_ok" $1 192940266059SGregory Neil Shapirodnl temporary failure: call check sender (relay) 193040266059SGregory Neil ShapiroR$* $| T $+ $: T $2 $| $>"Relay_ok" $1 193140266059SGregory Neil Shapirodnl temporary failure? return that 193240266059SGregory Neil ShapiroR$* $| $#TEMP $+ $#error $2 193340266059SGregory Neil Shapirodnl error or ok (stop) 193440266059SGregory Neil ShapiroR$* $| $#$* $#$2 193540266059SGregory Neil ShapiroR$* $| RELAY $@ RELAY 193640266059SGregory Neil Shapirodnl something else: return previous temp failure 193740266059SGregory Neil ShapiroR T $+ $| $* $#error $1 193840266059SGregory Neil Shapiro# anything else is bogus 193940266059SGregory Neil ShapiroR$* $#error $@ 5.7.1 $: confRELAY_MSG 194040266059SGregory Neil Shapirodivert(0) 194140266059SGregory Neil Shapiro 194240266059SGregory Neil Shapiro###################################################################### 194340266059SGregory Neil Shapiro### Rcpt_ok: is the recipient ok? 194440266059SGregory Neil Shapirodnl input: recipient address (RCPT TO) 194540266059SGregory Neil Shapirodnl output: see explanation at call 194640266059SGregory Neil Shapiro###################################################################### 194740266059SGregory Neil ShapiroSRcpt_ok 1948c2aa98e2SPeter Wemmifdef(`_LOOSE_RELAY_CHECK_',`dnl 1949065a643dSPeter WemmR$* $: $>CanonAddr $1 1950c2aa98e2SPeter WemmR$* < @ $* . > $1 < @ $2 > strip trailing dots', 1951c2aa98e2SPeter Wemm`R$* $: $>ParseRecipient $1 strip relayable hosts') 1952c2aa98e2SPeter Wemm 1953065a643dSPeter Wemmifdef(`_BESTMX_IS_LOCAL_',`dnl 1954065a643dSPeter Wemmifelse(_BESTMX_IS_LOCAL_, `', `dnl 1955065a643dSPeter Wemm# unlimited bestmx 1956065a643dSPeter WemmR$* < @ $* > $* $: $1 < @ $2 @@ $(bestmx $2 $) > $3', 1957065a643dSPeter Wemm`dnl 1958065a643dSPeter Wemm# limit bestmx to $=B 19592e43090eSPeter WemmR$* < @ $* $=B > $* $: $1 < @ $2 $3 @@ $(bestmx $2 $3 $) > $4') 196040266059SGregory Neil ShapiroR$* $=O $* < @ $* @@ $=w . > $* $@ $>"Rcpt_ok" $1 $2 $3 1961065a643dSPeter WemmR$* < @ $* @@ $=w . > $* $: $1 < @ $3 > $4 1962065a643dSPeter WemmR$* < @ $* @@ $* > $* $: $1 < @ $2 > $4') 1963065a643dSPeter Wemm 1964c2aa98e2SPeter Wemmifdef(`_BLACKLIST_RCPT_',`dnl 196506f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 1966c2aa98e2SPeter Wemm# blacklist local users or any host from receiving mail 1967c2aa98e2SPeter WemmR$* $: <?> $1 196806f25ae9SGregory Neil Shapirodnl user is now tagged with @ to be consistent with check_mail 196906f25ae9SGregory Neil Shapirodnl and to distinguish users from hosts (com would be host, com@ would be user) 197040266059SGregory Neil ShapiroR<?> $+ < @ $=w > $: <> <$1 < @ $2 >> $| <F:$1@$2> <U:$1@> <D:$2> 197140266059SGregory Neil ShapiroR<?> $+ < @ $* > $: <> <$1 < @ $2 >> $| <F:$1@$2> <D:$2> 197206f25ae9SGregory Neil ShapiroR<?> $+ $: <> <$1> $| <U:$1@> 197306f25ae9SGregory Neil Shapirodnl $| is used as delimiter, otherwise false matches may occur: <user<@domain>> 197406f25ae9SGregory Neil Shapirodnl will only return user<@domain when "reversing" the args 197506f25ae9SGregory Neil ShapiroR<> <$*> $| <$+> $: <@> <$1> $| $>SearchList <+ To> $| <$2> <> 197606f25ae9SGregory Neil ShapiroR<@> <$*> $| <$*> $: <$2> <$1> reverse result 197706f25ae9SGregory Neil ShapiroR<?> <$*> $: @ $1 mark address as no match 197840266059SGregory Neil Shapirodnl we may have to filter here because otherwise some RHSs 197940266059SGregory Neil Shapirodnl would be interpreted as generic error messages... 198040266059SGregory Neil Shapirodnl error messages should be "tagged" by prefixing them with error: ! 198140266059SGregory Neil Shapirodnl that would make a lot of things easier. 198206f25ae9SGregory Neil ShapiroR<$={Accept}> <$*> $: @ $2 mark address as no match 198340266059SGregory Neil Shapiroifdef(`_ACCESS_SKIP_', `dnl 198440266059SGregory Neil ShapiroR<SKIP> <$*> $: @ $1 mark address as no match', `dnl') 198540266059SGregory Neil Shapiroifdef(`_DELAY_COMPAT_8_10_',`dnl 198640266059SGregory Neil Shapirodnl compatility with 8.11/8.10: 198706f25ae9SGregory Neil Shapirodnl we have to filter these because otherwise they would be interpreted 198806f25ae9SGregory Neil Shapirodnl as generic error message... 198906f25ae9SGregory Neil Shapirodnl error messages should be "tagged" by prefixing them with error: ! 199006f25ae9SGregory Neil Shapirodnl that would make a lot of things easier. 199106f25ae9SGregory Neil Shapirodnl maybe we should stop checks already here (if SPAM_xyx)? 199206f25ae9SGregory Neil ShapiroR<$={SpamTag}> <$*> $: @ $2 mark address as no match') 199340266059SGregory Neil ShapiroR<REJECT> $* $#error $@ 5.2.1 $: confRCPTREJ_MSG 199406f25ae9SGregory Neil ShapiroR<DISCARD> $* $#discard $: discard 199540266059SGregory Neil Shapiroifdef(`_FFR_QUARANTINE', 199640266059SGregory Neil Shapiro`R<QUARANTINE:$+> $* $#error $@ quarantine $: $1', `dnl') 199706f25ae9SGregory Neil Shapirodnl error tag 199806f25ae9SGregory Neil ShapiroR<ERROR:$-.$-.$-:$+> $* $#error $@ $1.$2.$3 $: $4 199906f25ae9SGregory Neil ShapiroR<ERROR:$+> $* $#error $: $1 200040266059SGregory Neil Shapiroifdef(`_ATMPF_', `R<_ATMPF_> $* $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 200106f25ae9SGregory Neil Shapirodnl generic error from access map 200206f25ae9SGregory Neil ShapiroR<$+> $* $#error $: $1 error from access db 200306f25ae9SGregory Neil ShapiroR@ $* $1 remove mark', `dnl')', `dnl') 2004c2aa98e2SPeter Wemm 200540266059SGregory Neil Shapiroifdef(`_PROMISCUOUS_RELAY_', `divert(-1)', `dnl') 200640266059SGregory Neil Shapiro# authenticated via TLS? 200740266059SGregory Neil ShapiroR$* $: $1 $| $>RelayTLS client authenticated? 200806f25ae9SGregory Neil ShapiroR$* $| $# $+ $# $2 error/ok? 200906f25ae9SGregory Neil ShapiroR$* $| $* $: $1 no 201006f25ae9SGregory Neil Shapiro 201140266059SGregory Neil ShapiroR$* $: $1 $| $>"Local_Relay_Auth" $&{auth_type} 201240266059SGregory Neil Shapirodnl workspace: localpart<@domain> $| result of Local_Relay_Auth 201340266059SGregory Neil ShapiroR$* $| $# $* $# $2 201440266059SGregory Neil Shapirodnl if Local_Relay_Auth returns NO then do not check $={TrustAuthMech} 201540266059SGregory Neil ShapiroR$* $| NO $: $1 201640266059SGregory Neil ShapiroR$* $| $* $: $1 $| $&{auth_type} 201740266059SGregory Neil Shapirodnl workspace: localpart<@domain> [ $| ${auth_type} ] 201806f25ae9SGregory Neil Shapirodnl empty ${auth_type}? 201906f25ae9SGregory Neil ShapiroR$* $| $: $1 202006f25ae9SGregory Neil Shapirodnl mechanism ${auth_type} accepted? 202106f25ae9SGregory Neil Shapirodnl use $# to override further tests (delay_checks): see check_rcpt below 202240266059SGregory Neil ShapiroR$* $| $={TrustAuthMech} $# RELAY 202340266059SGregory Neil Shapirodnl remove ${auth_type} 202406f25ae9SGregory Neil ShapiroR$* $| $* $: $1 2025193538b7SGregory Neil Shapirodnl workspace: localpart<@domain> | localpart 202606f25ae9SGregory Neil Shapiroifelse(defn(`_NO_UUCP_'), `r', 2027193538b7SGregory Neil Shapiro`R$* ! $* < @ $* > $: <REMOTE> $2 < @ BANG_PATH > 2028193538b7SGregory Neil ShapiroR$* ! $* $: <REMOTE> $2 < @ BANG_PATH >', `dnl') 2029c2aa98e2SPeter Wemm# anything terminating locally is ok 2030c2aa98e2SPeter Wemmifdef(`_RELAY_ENTIRE_DOMAIN_', `dnl 203140266059SGregory Neil ShapiroR$+ < @ $* $=m > $@ RELAY', `dnl') 203240266059SGregory Neil ShapiroR$+ < @ $=w > $@ RELAY 2033c2aa98e2SPeter Wemmifdef(`_RELAY_HOSTS_ONLY_', 203440266059SGregory Neil Shapiro`R$+ < @ $=R > $@ RELAY 203506f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 203606f25ae9SGregory Neil ShapiroR$+ < @ $+ > $: <$(access To:$2 $: ? $)> <$1 < @ $2 >> 203706f25ae9SGregory Neil Shapirodnl workspace: <Result-of-lookup | ?> <localpart<@domain>> 203806f25ae9SGregory Neil ShapiroR<?> <$+ < @ $+ >> $: <$(access $2 $: ? $)> <$1 < @ $2 >>',`dnl')', 203940266059SGregory Neil Shapiro`R$+ < @ $* $=R > $@ RELAY 204006f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 204140266059SGregory Neil ShapiroR$+ < @ $+ > $: $>D <$2> <?> <+ To> <$1 < @ $2 >>',`dnl')') 204206f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 204306f25ae9SGregory Neil Shapirodnl workspace: <Result-of-lookup | ?> <localpart<@domain>> 204440266059SGregory Neil ShapiroR<RELAY> $* $@ RELAY 204540266059SGregory Neil Shapiroifdef(`_ATMPF_', `R<$* _ATMPF_> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 2046c2aa98e2SPeter WemmR<$*> <$*> $: $2',`dnl') 2047c2aa98e2SPeter Wemm 204806f25ae9SGregory Neil Shapiro 2049c2aa98e2SPeter Wemmifdef(`_RELAY_MX_SERVED_', `dnl 2050c2aa98e2SPeter Wemm# allow relaying for hosts which we MX serve 205106f25ae9SGregory Neil ShapiroR$+ < @ $+ > $: < : $(mxserved $2 $) : > $1 < @ $2 > 205206f25ae9SGregory Neil Shapirodnl this must not necessarily happen if the client is checked first... 205340266059SGregory Neil ShapiroR< : $* <TEMP> : > $* $#TEMP $@ 4.7.1 $: "450 Can not check MX records for recipient host " $1 205440266059SGregory Neil ShapiroR<$* : $=w . : $*> $* $@ RELAY 2055065a643dSPeter WemmR< : $* : > $* $: $2', 2056c2aa98e2SPeter Wemm`dnl') 2057c2aa98e2SPeter Wemm 2058c2aa98e2SPeter Wemm# check for local user (i.e. unqualified address) 2059c2aa98e2SPeter WemmR$* $: <?> $1 2060065a643dSPeter WemmR<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 > 2061c2aa98e2SPeter Wemm# local user is ok 206206f25ae9SGregory Neil Shapirodnl is it really? the standard requires user@domain, not just user 206306f25ae9SGregory Neil Shapirodnl but we should accept it anyway (maybe making it an option: 206406f25ae9SGregory Neil Shapirodnl RequireFQDN ?) 206506f25ae9SGregory Neil Shapirodnl postmaster must be accepted without domain (DRUMS) 206606f25ae9SGregory Neil Shapiroifdef(`_REQUIRE_QUAL_RCPT_', `dnl 206740266059SGregory Neil ShapiroR<?> postmaster $@ OK 206806f25ae9SGregory Neil Shapiro# require qualified recipient? 206906f25ae9SGregory Neil Shapirodnl prepend daemon_flags 207006f25ae9SGregory Neil ShapiroR<?> $+ $: $&{daemon_flags} $| <?> $1 207106f25ae9SGregory Neil Shapirodnl workspace: ${daemon_flags} $| <?> localpart 207206f25ae9SGregory Neil Shapirodnl do not allow these at all or only from local systems? 207306f25ae9SGregory Neil Shapirodnl r flag? add client_name 207406f25ae9SGregory Neil ShapiroR$* r $* $| <?> $+ $: < ? $&{client_name} > <?> $3 207506f25ae9SGregory Neil Shapirodnl no r flag: relay to local user (only local part) 207606f25ae9SGregory Neil Shapiro# no qualified recipient required 207740266059SGregory Neil ShapiroR$* $| <?> $+ $@ RELAY 207806f25ae9SGregory Neil Shapirodnl client_name is empty 207940266059SGregory Neil ShapiroR<?> <?> $+ $@ RELAY 208006f25ae9SGregory Neil Shapirodnl client_name is local 208140266059SGregory Neil ShapiroR<? $=w> <?> $+ $@ RELAY 208206f25ae9SGregory Neil Shapirodnl client_name is not local 208306f25ae9SGregory Neil ShapiroR<? $+> $+ $#error $@ 5.5.4 $: "553 Domain name required"', `dnl 208406f25ae9SGregory Neil Shapirodnl no qualified recipient required 208540266059SGregory Neil ShapiroR<?> $+ $@ RELAY') 208606f25ae9SGregory Neil Shapirodnl it is a remote user: remove mark and then check client 2087c2aa98e2SPeter WemmR<$+> $* $: $2 208806f25ae9SGregory Neil Shapirodnl currently the recipient address is not used below 2089c2aa98e2SPeter Wemm 209040266059SGregory Neil Shapiro###################################################################### 209140266059SGregory Neil Shapiro### Relay_ok: is the relay/sender ok? 209240266059SGregory Neil Shapirodnl input: ignored 209340266059SGregory Neil Shapirodnl output: see explanation at call 209440266059SGregory Neil Shapiro###################################################################### 209540266059SGregory Neil ShapiroSRelay_ok 2096c2aa98e2SPeter Wemm# anything originating locally is ok 2097c2aa98e2SPeter Wemm# check IP address 2098c2aa98e2SPeter WemmR$* $: $&{client_addr} 209940266059SGregory Neil ShapiroR$@ $@ RELAY originated locally 210040266059SGregory Neil ShapiroR0 $@ RELAY originated locally 210140266059SGregory Neil ShapiroR$=R $* $@ RELAY relayable IP address 210206f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 210340266059SGregory Neil ShapiroR$* $: $>A <$1> <?> <+ Connect> <$1> 210440266059SGregory Neil ShapiroR<RELAY> $* $@ RELAY relayable IP address 210594c01205SGregory Neil ShapiroR<REJECT> $* $@ REJECT rejected IP address 210640266059SGregory Neil Shapiroifdef(`_ATMPF_', `R<_ATMPF_> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 2107c2aa98e2SPeter WemmR<$*> <$*> $: $2', `dnl') 2108c2aa98e2SPeter WemmR$* $: [ $1 ] put brackets around it... 210940266059SGregory Neil ShapiroR$=w $@ RELAY ... and see if it is local 2110c2aa98e2SPeter Wemm 211106f25ae9SGregory Neil Shapiroifdef(`_RELAY_DB_FROM_', `define(`_RELAY_MAIL_FROM_', `1')')dnl 211206f25ae9SGregory Neil Shapiroifdef(`_RELAY_LOCAL_FROM_', `define(`_RELAY_MAIL_FROM_', `1')')dnl 211306f25ae9SGregory Neil Shapiroifdef(`_RELAY_MAIL_FROM_', `dnl 211406f25ae9SGregory Neil Shapirodnl input: {client_addr} or something "broken" 211506f25ae9SGregory Neil Shapirodnl just throw the input away; we do not need it. 211606f25ae9SGregory Neil Shapiro# check whether FROM is allowed to use system as relay 211706f25ae9SGregory Neil ShapiroR$* $: <?> $>CanonAddr $&f 211840266059SGregory Neil ShapiroR<?> $+ < @ $+ . > <?> $1 < @ $2 > remove trailing dot 2119c2aa98e2SPeter Wemmifdef(`_RELAY_LOCAL_FROM_', `dnl 212006f25ae9SGregory Neil Shapiro# check whether local FROM is ok 212140266059SGregory Neil ShapiroR<?> $+ < @ $=w > $@ RELAY FROM local', `dnl') 212206f25ae9SGregory Neil Shapiroifdef(`_RELAY_DB_FROM_', `dnl 2123605302a5SGregory Neil ShapiroR<?> $+ < @ $+ > $: <@> $>SearchList <! From> $| <F:$1@$2> ifdef(`_RELAY_DB_FROM_DOMAIN_', ifdef(`_RELAY_HOSTS_ONLY_', `<E:$2>', `<D:$2>')) <> 212440266059SGregory Neil ShapiroR<@> <RELAY> $@ RELAY RELAY FROM sender ok 212540266059SGregory Neil Shapiroifdef(`_ATMPF_', `R<@> <_ATMPF_> $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 212640266059SGregory Neil Shapiro', `dnl 212740266059SGregory Neil Shapiroifdef(`_RELAY_DB_FROM_DOMAIN_', 212840266059SGregory Neil Shapiro`errprint(`*** ERROR: _RELAY_DB_FROM_DOMAIN_ requires _RELAY_DB_FROM_ 212906f25ae9SGregory Neil Shapiro')', 213006f25ae9SGregory Neil Shapiro`dnl') 213106f25ae9SGregory Neil Shapirodnl')', `dnl') 213240266059SGregory Neil Shapirodnl notice: the rulesets above do not leave a unique workspace behind. 213340266059SGregory Neil Shapirodnl it does not matter in this case because the following rule ignores 213440266059SGregory Neil Shapirodnl the input. otherwise these rules must "clean up" the workspace. 213506f25ae9SGregory Neil Shapiro 213606f25ae9SGregory Neil Shapiro# check client name: first: did it resolve? 213706f25ae9SGregory Neil Shapirodnl input: ignored 213806f25ae9SGregory Neil ShapiroR$* $: < $&{client_resolve} > 213940266059SGregory Neil ShapiroR<TEMP> $#TEMP $@ 4.7.1 $: "450 Relaying temporarily denied. Cannot resolve PTR record for " $&{client_addr} 214006f25ae9SGregory Neil ShapiroR<FORGED> $#error $@ 5.7.1 $: "550 Relaying denied. IP name possibly forged " $&{client_name} 214106f25ae9SGregory Neil ShapiroR<FAIL> $#error $@ 5.7.1 $: "550 Relaying denied. IP name lookup failed " $&{client_name} 214206f25ae9SGregory Neil Shapirodnl ${client_resolve} should be OK, so go ahead 214340266059SGregory Neil ShapiroR$* $: <@> $&{client_name} 214406f25ae9SGregory Neil Shapirodnl should not be necessary since it has been done for client_addr already 214540266059SGregory Neil ShapiroR<@> $@ RELAY 214640266059SGregory Neil Shapirodnl workspace: <@> ${client_name} (not empty) 214740266059SGregory Neil Shapiro# pass to name server to make hostname canonical 214840266059SGregory Neil ShapiroR<@> $* $=P $:<?> $1 $2 214940266059SGregory Neil ShapiroR<@> $+ $:<?> $[ $1 $] 215040266059SGregory Neil Shapirodnl workspace: <?> ${client_name} (canonified) 215140266059SGregory Neil ShapiroR$* . $1 strip trailing dots 215206f25ae9SGregory Neil Shapiroifdef(`_RELAY_ENTIRE_DOMAIN_', `dnl 215340266059SGregory Neil ShapiroR<?> $* $=m $@ RELAY', `dnl') 215440266059SGregory Neil ShapiroR<?> $=w $@ RELAY 215506f25ae9SGregory Neil Shapiroifdef(`_RELAY_HOSTS_ONLY_', 215640266059SGregory Neil Shapiro`R<?> $=R $@ RELAY 215706f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 215806f25ae9SGregory Neil ShapiroR<?> $* $: <$(access Connect:$1 $: ? $)> <$1> 215906f25ae9SGregory Neil ShapiroR<?> <$*> $: <$(access $1 $: ? $)> <$1>',`dnl')', 216040266059SGregory Neil Shapiro`R<?> $* $=R $@ RELAY 216106f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 216240266059SGregory Neil ShapiroR<?> $* $: $>D <$1> <?> <+ Connect> <$1>',`dnl')') 216306f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 216440266059SGregory Neil ShapiroR<RELAY> $* $@ RELAY 216540266059SGregory Neil Shapiroifdef(`_ATMPF_', `R<$* _ATMPF_> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 216606f25ae9SGregory Neil ShapiroR<$*> <$*> $: $2',`dnl') 216740266059SGregory Neil Shapirodnl end of _PROMISCUOUS_RELAY_ 216806f25ae9SGregory Neil Shapirodivert(0) 216906f25ae9SGregory Neil Shapiroifdef(`_DELAY_CHECKS_',`dnl 217006f25ae9SGregory Neil Shapiro# turn a canonical address in the form user<@domain> 217106f25ae9SGregory Neil Shapiro# qualify unqual. addresses with $j 217206f25ae9SGregory Neil Shapirodnl it might have been only user (without <@domain>) 217306f25ae9SGregory Neil ShapiroSFullAddr 217406f25ae9SGregory Neil ShapiroR$* <@ $+ . > $1 <@ $2 > 217506f25ae9SGregory Neil ShapiroR$* <@ $* > $@ $1 <@ $2 > 217606f25ae9SGregory Neil ShapiroR$+ $@ $1 <@ $j > 2177c2aa98e2SPeter Wemm 217806f25ae9SGregory Neil Shapiro# call all necessary rulesets 217906f25ae9SGregory Neil ShapiroScheck_rcpt 218006f25ae9SGregory Neil Shapirodnl this test should be in the Basic_check_rcpt ruleset 218106f25ae9SGregory Neil Shapirodnl which is the correct DSN code? 218206f25ae9SGregory Neil Shapiro# R$@ $#error $@ 5.1.3 $: "553 Recipient address required" 218306f25ae9SGregory Neil ShapiroR$+ $: $1 $| $>checkrcpt $1 218406f25ae9SGregory Neil Shapirodnl now we can simply stop checks by returning "$# xyz" instead of just "ok" 218506f25ae9SGregory Neil ShapiroR$+ $| $#$* $#$2 218606f25ae9SGregory Neil ShapiroR$+ $| $* $: <?> $>FullAddr $>CanonAddr $1 218706f25ae9SGregory Neil Shapiroifdef(`_SPAM_FH_', 218806f25ae9SGregory Neil Shapiro`dnl lookup user@ and user@address 218906f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `', 219006f25ae9SGregory Neil Shapiro`errprint(`*** ERROR: FEATURE(`delay_checks', `argument') requires FEATURE(`access_db') 219106f25ae9SGregory Neil Shapiro')')dnl 219206f25ae9SGregory Neil Shapirodnl one of the next two rules is supposed to match 219306f25ae9SGregory Neil Shapirodnl this code has been copied from BLACKLIST... etc 219406f25ae9SGregory Neil Shapirodnl and simplified by omitting some < >. 219540266059SGregory Neil ShapiroR<?> $+ < @ $=w > $: <> $1 < @ $2 > $| <F: $1@$2 > <D: $2 > <U: $1@> 219640266059SGregory Neil ShapiroR<?> $+ < @ $* > $: <> $1 < @ $2 > $| <F: $1@$2 > <D: $2 > 219706f25ae9SGregory Neil Shapirodnl R<?> $@ something_is_very_wrong_here 219840266059SGregory Neil Shapiro# lookup the addresses only with Spam tag 219940266059SGregory Neil ShapiroR<> $* $| <$+> $: <@> $1 $| $>SearchList <! Spam> $| <$2> <> 220006f25ae9SGregory Neil ShapiroR<@> $* $| $* $: $2 $1 reverse result 220106f25ae9SGregory Neil Shapirodnl', `dnl') 220206f25ae9SGregory Neil Shapiroifdef(`_SPAM_FRIEND_', 220306f25ae9SGregory Neil Shapiro`# is the recipient a spam friend? 220406f25ae9SGregory Neil Shapiroifdef(`_SPAM_HATER_', 220506f25ae9SGregory Neil Shapiro `errprint(`*** ERROR: define either SpamHater or SpamFriend 220606f25ae9SGregory Neil Shapiro')', `dnl') 220740266059SGregory Neil ShapiroR<FRIEND> $+ $@ SPAMFRIEND 220806f25ae9SGregory Neil ShapiroR<$*> $+ $: $2', 220906f25ae9SGregory Neil Shapiro`dnl') 221006f25ae9SGregory Neil Shapiroifdef(`_SPAM_HATER_', 221106f25ae9SGregory Neil Shapiro`# is the recipient no spam hater? 221240266059SGregory Neil ShapiroR<HATER> $+ $: $1 spam hater: continue checks 221306f25ae9SGregory Neil ShapiroR<$*> $+ $@ NOSPAMHATER everyone else: stop 221406f25ae9SGregory Neil Shapirodnl',`dnl') 221506f25ae9SGregory Neil Shapirodnl run further checks: check_mail 221606f25ae9SGregory Neil Shapirodnl should we "clean up" $&f? 221740266059SGregory Neil Shapiroifdef(`_FFR_MAIL_MACRO', 221840266059SGregory Neil Shapiro`R$* $: $1 $| $>checkmail $&{mail_from}', 221940266059SGregory Neil Shapiro`R$* $: $1 $| $>checkmail <$&f>') 2220605302a5SGregory Neil Shapirodnl recipient (canonical format) $| result of checkmail 222106f25ae9SGregory Neil ShapiroR$* $| $#$* $#$2 222206f25ae9SGregory Neil Shapirodnl run further checks: check_relay 2223605302a5SGregory Neil ShapiroR$* $| $* $: $1 $| $>checkrelay $&{client_name} $| $&{client_addr} 222406f25ae9SGregory Neil ShapiroR$* $| $#$* $#$2 222506f25ae9SGregory Neil ShapiroR$* $| $* $: $1 222606f25ae9SGregory Neil Shapiro', `dnl') 222740266059SGregory Neil Shapiro 222840266059SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl', `divert(-1)') 222940266059SGregory Neil Shapiro###################################################################### 223040266059SGregory Neil Shapiro### F: LookUpFull -- search for an entry in access database 223140266059SGregory Neil Shapiro### 223240266059SGregory Neil Shapiro### lookup of full key (which should be an address) and 223340266059SGregory Neil Shapiro### variations if +detail exists: +* and without +detail 223440266059SGregory Neil Shapiro### 223540266059SGregory Neil Shapiro### Parameters: 223640266059SGregory Neil Shapiro### <$1> -- key 223740266059SGregory Neil Shapiro### <$2> -- default (what to return if not found in db) 223840266059SGregory Neil Shapirodnl must not be empty 223940266059SGregory Neil Shapiro### <$3> -- mark (must be <(!|+) single-token>) 224040266059SGregory Neil Shapiro### ! does lookup only with tag 224140266059SGregory Neil Shapiro### + does lookup with and without tag 224240266059SGregory Neil Shapiro### <$4> -- passthru (additional data passed unchanged through) 224340266059SGregory Neil Shapirodnl returns: <default> <passthru> 224440266059SGregory Neil Shapirodnl <result> <passthru> 224540266059SGregory Neil Shapiro###################################################################### 224640266059SGregory Neil Shapiro 224740266059SGregory Neil ShapiroSF 224840266059SGregory Neil Shapirodnl workspace: <key> <def> <o tag> <thru> 224940266059SGregory Neil Shapirodnl full lookup 225040266059SGregory Neil Shapirodnl 2 3 4 5 225140266059SGregory Neil ShapiroR<$+> <$*> <$- $-> <$*> $: <$(access $4`'_TAG_DELIM_`'$1 $: ? $)> <$1> <$2> <$3 $4> <$5> 225240266059SGregory Neil Shapirodnl no match, try without tag 225340266059SGregory Neil Shapirodnl 1 2 3 4 225440266059SGregory Neil ShapiroR<?> <$+> <$*> <+ $-> <$*> $: <$(access $1 $: ? $)> <$1> <$2> <+ $3> <$4> 225540266059SGregory Neil Shapirodnl no match, +detail: try +* 225640266059SGregory Neil Shapirodnl 1 2 3 4 5 6 7 225740266059SGregory Neil ShapiroR<?> <$+ + $* @ $+> <$*> <$- $-> <$*> 225840266059SGregory Neil Shapiro $: <$(access $6`'_TAG_DELIM_`'$1+*@$3 $: ? $)> <$1+$2@$3> <$4> <$5 $6> <$7> 225940266059SGregory Neil Shapirodnl no match, +detail: try +* without tag 226040266059SGregory Neil Shapirodnl 1 2 3 4 5 6 226140266059SGregory Neil ShapiroR<?> <$+ + $* @ $+> <$*> <+ $-> <$*> 226240266059SGregory Neil Shapiro $: <$(access $1+*@$3 $: ? $)> <$1+$2@$3> <$4> <+ $5> <$6> 226340266059SGregory Neil Shapirodnl no match, +detail: try without +detail 226440266059SGregory Neil Shapirodnl 1 2 3 4 5 6 7 226540266059SGregory Neil ShapiroR<?> <$+ + $* @ $+> <$*> <$- $-> <$*> 226640266059SGregory Neil Shapiro $: <$(access $6`'_TAG_DELIM_`'$1@$3 $: ? $)> <$1+$2@$3> <$4> <$5 $6> <$7> 226740266059SGregory Neil Shapirodnl no match, +detail: try without +detail and without tag 226840266059SGregory Neil Shapirodnl 1 2 3 4 5 6 226940266059SGregory Neil ShapiroR<?> <$+ + $* @ $+> <$*> <+ $-> <$*> 227040266059SGregory Neil Shapiro $: <$(access $1@$3 $: ? $)> <$1+$2@$3> <$4> <+ $5> <$6> 227140266059SGregory Neil Shapirodnl no match, return <default> <passthru> 227240266059SGregory Neil Shapirodnl 1 2 3 4 5 227340266059SGregory Neil ShapiroR<?> <$+> <$*> <$- $-> <$*> $@ <$2> <$5> 227440266059SGregory Neil Shapiroifdef(`_ATMPF_', `dnl tempfail? 227540266059SGregory Neil Shapirodnl 2 3 4 5 227640266059SGregory Neil ShapiroR<$+ _ATMPF_> <$*> <$- $-> <$*> $@ <_ATMPF_> <$5>', `dnl') 227740266059SGregory Neil Shapirodnl match, return <match> <passthru> 227840266059SGregory Neil Shapirodnl 2 3 4 5 227940266059SGregory Neil ShapiroR<$+> <$*> <$- $-> <$*> $@ <$1> <$5> 228040266059SGregory Neil Shapiro 228140266059SGregory Neil Shapiro###################################################################### 228240266059SGregory Neil Shapiro### E: LookUpExact -- search for an entry in access database 228340266059SGregory Neil Shapiro### 228440266059SGregory Neil Shapiro### Parameters: 228540266059SGregory Neil Shapiro### <$1> -- key 228640266059SGregory Neil Shapiro### <$2> -- default (what to return if not found in db) 228740266059SGregory Neil Shapirodnl must not be empty 228840266059SGregory Neil Shapiro### <$3> -- mark (must be <(!|+) single-token>) 228940266059SGregory Neil Shapiro### ! does lookup only with tag 229040266059SGregory Neil Shapiro### + does lookup with and without tag 229140266059SGregory Neil Shapiro### <$4> -- passthru (additional data passed unchanged through) 229240266059SGregory Neil Shapirodnl returns: <default> <passthru> 229340266059SGregory Neil Shapirodnl <result> <passthru> 229440266059SGregory Neil Shapiro###################################################################### 229540266059SGregory Neil Shapiro 229640266059SGregory Neil ShapiroSE 229740266059SGregory Neil Shapirodnl 2 3 4 5 229840266059SGregory Neil ShapiroR<$*> <$*> <$- $-> <$*> $: <$(access $4`'_TAG_DELIM_`'$1 $: ? $)> <$1> <$2> <$3 $4> <$5> 229940266059SGregory Neil Shapirodnl no match, try without tag 230040266059SGregory Neil Shapirodnl 1 2 3 4 230140266059SGregory Neil ShapiroR<?> <$+> <$*> <+ $-> <$*> $: <$(access $1 $: ? $)> <$1> <$2> <+ $3> <$4> 230240266059SGregory Neil Shapirodnl no match, return default passthru 230340266059SGregory Neil Shapirodnl 1 2 3 4 5 230440266059SGregory Neil ShapiroR<?> <$+> <$*> <$- $-> <$*> $@ <$2> <$5> 230540266059SGregory Neil Shapiroifdef(`_ATMPF_', `dnl tempfail? 230640266059SGregory Neil Shapirodnl 2 3 4 5 230740266059SGregory Neil ShapiroR<$+ _ATMPF_> <$*> <$- $-> <$*> $@ <_ATMPF_> <$5>', `dnl') 230840266059SGregory Neil Shapirodnl match, return <match> <passthru> 230940266059SGregory Neil Shapirodnl 2 3 4 5 231040266059SGregory Neil ShapiroR<$+> <$*> <$- $-> <$*> $@ <$1> <$5> 231140266059SGregory Neil Shapiro 231240266059SGregory Neil Shapiro###################################################################### 231340266059SGregory Neil Shapiro### U: LookUpUser -- search for an entry in access database 231440266059SGregory Neil Shapiro### 231540266059SGregory Neil Shapiro### lookup of key (which should be a local part) and 231640266059SGregory Neil Shapiro### variations if +detail exists: +* and without +detail 231740266059SGregory Neil Shapiro### 231840266059SGregory Neil Shapiro### Parameters: 231940266059SGregory Neil Shapiro### <$1> -- key (user@) 232040266059SGregory Neil Shapiro### <$2> -- default (what to return if not found in db) 232140266059SGregory Neil Shapirodnl must not be empty 232240266059SGregory Neil Shapiro### <$3> -- mark (must be <(!|+) single-token>) 232340266059SGregory Neil Shapiro### ! does lookup only with tag 232440266059SGregory Neil Shapiro### + does lookup with and without tag 232540266059SGregory Neil Shapiro### <$4> -- passthru (additional data passed unchanged through) 232640266059SGregory Neil Shapirodnl returns: <default> <passthru> 232740266059SGregory Neil Shapirodnl <result> <passthru> 232840266059SGregory Neil Shapiro###################################################################### 232940266059SGregory Neil Shapiro 233040266059SGregory Neil ShapiroSU 233140266059SGregory Neil Shapirodnl user lookups are always with trailing @ 233240266059SGregory Neil Shapirodnl 2 3 4 5 233340266059SGregory Neil ShapiroR<$+> <$*> <$- $-> <$*> $: <$(access $4`'_TAG_DELIM_`'$1 $: ? $)> <$1> <$2> <$3 $4> <$5> 233440266059SGregory Neil Shapirodnl no match, try without tag 233540266059SGregory Neil Shapirodnl 1 2 3 4 233640266059SGregory Neil ShapiroR<?> <$+> <$*> <+ $-> <$*> $: <$(access $1 $: ? $)> <$1> <$2> <+ $3> <$4> 233740266059SGregory Neil Shapirodnl do not remove the @ from the lookup: 233840266059SGregory Neil Shapirodnl it is part of the +detail@ which is omitted for the lookup 233940266059SGregory Neil Shapirodnl no match, +detail: try +* 234040266059SGregory Neil Shapirodnl 1 2 3 4 5 6 234140266059SGregory Neil ShapiroR<?> <$+ + $* @> <$*> <$- $-> <$*> 234240266059SGregory Neil Shapiro $: <$(access $5`'_TAG_DELIM_`'$1+*@ $: ? $)> <$1+$2@> <$3> <$4 $5> <$6> 234340266059SGregory Neil Shapirodnl no match, +detail: try +* without tag 234440266059SGregory Neil Shapirodnl 1 2 3 4 5 234540266059SGregory Neil ShapiroR<?> <$+ + $* @> <$*> <+ $-> <$*> 234640266059SGregory Neil Shapiro $: <$(access $1+*@ $: ? $)> <$1+$2@> <$3> <+ $4> <$5> 234740266059SGregory Neil Shapirodnl no match, +detail: try without +detail 234840266059SGregory Neil Shapirodnl 1 2 3 4 5 6 234940266059SGregory Neil ShapiroR<?> <$+ + $* @> <$*> <$- $-> <$*> 235040266059SGregory Neil Shapiro $: <$(access $5`'_TAG_DELIM_`'$1@ $: ? $)> <$1+$2@> <$3> <$4 $5> <$6> 235140266059SGregory Neil Shapirodnl no match, +detail: try without +detail and without tag 235240266059SGregory Neil Shapirodnl 1 2 3 4 5 235340266059SGregory Neil ShapiroR<?> <$+ + $* @> <$*> <+ $-> <$*> 235440266059SGregory Neil Shapiro $: <$(access $1@ $: ? $)> <$1+$2@> <$3> <+ $4> <$5> 235540266059SGregory Neil Shapirodnl no match, return <default> <passthru> 235640266059SGregory Neil Shapirodnl 1 2 3 4 5 235740266059SGregory Neil ShapiroR<?> <$+> <$*> <$- $-> <$*> $@ <$2> <$5> 235840266059SGregory Neil Shapiroifdef(`_ATMPF_', `dnl tempfail? 235940266059SGregory Neil Shapirodnl 2 3 4 5 236040266059SGregory Neil ShapiroR<$+ _ATMPF_> <$*> <$- $-> <$*> $@ <_ATMPF_> <$5>', `dnl') 236140266059SGregory Neil Shapirodnl match, return <match> <passthru> 236240266059SGregory Neil Shapirodnl 2 3 4 5 236340266059SGregory Neil ShapiroR<$+> <$*> <$- $-> <$*> $@ <$1> <$5> 236440266059SGregory Neil Shapiro 236506f25ae9SGregory Neil Shapiro###################################################################### 236606f25ae9SGregory Neil Shapiro### SearchList: search a list of items in the access map 236706f25ae9SGregory Neil Shapiro### Parameters: 236806f25ae9SGregory Neil Shapiro### <exact tag> $| <mark:address> <mark:address> ... <> 236906f25ae9SGregory Neil Shapirodnl maybe we should have a @ (again) in front of the mark to 237006f25ae9SGregory Neil Shapirodnl avoid errorneous matches (with error messages?) 237106f25ae9SGregory Neil Shapirodnl if we can make sure that tag is always a single token 237206f25ae9SGregory Neil Shapirodnl then we can omit the delimiter $|, otherwise we need it 237340266059SGregory Neil Shapirodnl to avoid errorneous matchs (first rule: D: if there 237406f25ae9SGregory Neil Shapirodnl is that mark somewhere in the list, it will be taken). 237506f25ae9SGregory Neil Shapirodnl moreover, we can do some tricks to enforce lookup with 237606f25ae9SGregory Neil Shapirodnl the tag only, e.g.: 237706f25ae9SGregory Neil Shapiro### where "exact" is either "+" or "!": 237806f25ae9SGregory Neil Shapiro### <+ TAG> lookup with and w/o tag 237906f25ae9SGregory Neil Shapiro### <! TAG> lookup with tag 238006f25ae9SGregory Neil Shapirodnl Warning: + and ! should be in OperatorChars (otherwise there must be 238106f25ae9SGregory Neil Shapirodnl a blank between them and the tag. 238206f25ae9SGregory Neil Shapiro### possible values for "mark" are: 238340266059SGregory Neil Shapiro### D: recursive host lookup (LookUpDomain) 238406f25ae9SGregory Neil Shapirodnl A: recursive address lookup (LookUpAddress) [not yet required] 238506f25ae9SGregory Neil Shapiro### E: exact lookup, no modifications 238606f25ae9SGregory Neil Shapiro### F: full lookup, try user+ext@domain and user@domain 238706f25ae9SGregory Neil Shapiro### U: user lookup, try user+ext and user (input must have trailing @) 238806f25ae9SGregory Neil Shapiro### return: <RHS of lookup> or <?> (not found) 238906f25ae9SGregory Neil Shapiro###################################################################### 239006f25ae9SGregory Neil Shapiro 239106f25ae9SGregory Neil Shapiro# class with valid marks for SearchList 239206f25ae9SGregory Neil Shapirodnl if A is activated: add it 239340266059SGregory Neil ShapiroC{src}E F D U ifdef(`_FFR_SRCHLIST_A', `A') 239406f25ae9SGregory Neil ShapiroSSearchList 239540266059SGregory Neil Shapiro# just call the ruleset with the name of the tag... nice trick... 239640266059SGregory Neil Shapirodnl 2 3 4 239740266059SGregory Neil ShapiroR<$+> $| <$={src}:$*> <$*> $: <$1> $| <$4> $| $>$2 <$3> <?> <$1> <> 239840266059SGregory Neil Shapirodnl workspace: <o tag> $| <rest> $| <result of lookup> <> 239940266059SGregory Neil Shapirodnl no match and nothing left: return 240040266059SGregory Neil ShapiroR<$+> $| <> $| <?> <> $@ <?> 240140266059SGregory Neil Shapirodnl no match but something left: continue 240240266059SGregory Neil ShapiroR<$+> $| <$+> $| <?> <> $@ $>SearchList <$1> $| <$2> 240340266059SGregory Neil Shapirodnl match: return 240440266059SGregory Neil ShapiroR<$+> $| <$*> $| <$+> <> $@ <$3> 240506f25ae9SGregory Neil Shapirodnl return result from recursive invocation 240640266059SGregory Neil ShapiroR<$+> $| <$+> $@ <$2> 240740266059SGregory Neil Shapirodnl endif _ACCESS_TABLE_ 240840266059SGregory Neil Shapirodivert(0) 240906f25ae9SGregory Neil Shapiro 241040266059SGregory Neil Shapiro###################################################################### 241140266059SGregory Neil Shapiro### trust_auth: is user trusted to authenticate as someone else? 241240266059SGregory Neil Shapiro### 241340266059SGregory Neil Shapiro### Parameters: 241440266059SGregory Neil Shapiro### $1: AUTH= parameter from MAIL command 241540266059SGregory Neil Shapiro###################################################################### 241640266059SGregory Neil Shapiro 241740266059SGregory Neil Shapirodnl empty ruleset definition so it can be called 241840266059SGregory Neil ShapiroSLocal_trust_auth 241906f25ae9SGregory Neil ShapiroStrust_auth 242006f25ae9SGregory Neil ShapiroR$* $: $&{auth_type} $| $1 242106f25ae9SGregory Neil Shapiro# required by RFC 2554 section 4. 242206f25ae9SGregory Neil ShapiroR$@ $| $* $#error $@ 5.7.1 $: "550 not authenticated" 242306f25ae9SGregory Neil Shapirodnl seems to be useful... 242406f25ae9SGregory Neil ShapiroR$* $| $&{auth_authen} $@ identical 242506f25ae9SGregory Neil ShapiroR$* $| <$&{auth_authen}> $@ identical 242606f25ae9SGregory Neil Shapirodnl call user supplied code 242706f25ae9SGregory Neil ShapiroR$* $| $* $: $1 $| $>"Local_trust_auth" $1 242806f25ae9SGregory Neil ShapiroR$* $| $#$* $#$2 242906f25ae9SGregory Neil Shapirodnl default: error 243006f25ae9SGregory Neil ShapiroR$* $#error $@ 5.7.1 $: "550 " $&{auth_authen} " not allowed to act as " $&{auth_author} 243106f25ae9SGregory Neil Shapiro 243240266059SGregory Neil Shapiro###################################################################### 243340266059SGregory Neil Shapiro### Relay_Auth: allow relaying based on authentication? 243440266059SGregory Neil Shapiro### 243540266059SGregory Neil Shapiro### Parameters: 243640266059SGregory Neil Shapiro### $1: ${auth_type} 243740266059SGregory Neil Shapiro###################################################################### 243840266059SGregory Neil ShapiroSLocal_Relay_Auth 243906f25ae9SGregory Neil Shapiro 244040266059SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 244140266059SGregory Neil Shapiro###################################################################### 244240266059SGregory Neil Shapiro### srv_features: which features to offer to a client? 244340266059SGregory Neil Shapiro### (done in server) 244440266059SGregory Neil Shapiro###################################################################### 244540266059SGregory Neil ShapiroSsrv_features 244640266059SGregory Neil Shapiroifdef(`_LOCAL_SRV_FEATURES_', `dnl 244740266059SGregory Neil ShapiroR$* $: $1 $| $>"Local_srv_features" $1 244840266059SGregory Neil ShapiroR$* $| $#$* $#$2 244940266059SGregory Neil ShapiroR$* $| $* $: $1', `dnl') 245040266059SGregory Neil ShapiroR$* $: $>D <$&{client_name}> <?> <! SRV_FEAT_TAG> <> 245140266059SGregory Neil ShapiroR<?>$* $: $>A <$&{client_addr}> <?> <! SRV_FEAT_TAG> <> 245240266059SGregory Neil ShapiroR<?>$* $: <$(access SRV_FEAT_TAG`'_TAG_DELIM_ $: ? $)> 245306f25ae9SGregory Neil ShapiroR<?>$* $@ OK 245440266059SGregory Neil Shapiroifdef(`_ATMPF_', `dnl tempfail? 245540266059SGregory Neil ShapiroR<$* _ATMPF_>$* $#temp', `dnl') 245640266059SGregory Neil ShapiroR<$+>$* $# $1 245706f25ae9SGregory Neil Shapiro 245840266059SGregory Neil Shapiro###################################################################### 245940266059SGregory Neil Shapiro### try_tls: try to use STARTTLS? 246040266059SGregory Neil Shapiro### (done in client) 246140266059SGregory Neil Shapiro###################################################################### 246206f25ae9SGregory Neil ShapiroStry_tls 246340266059SGregory Neil Shapiroifdef(`_LOCAL_TRY_TLS_', `dnl 246440266059SGregory Neil ShapiroR$* $: $1 $| $>"Local_try_tls" $1 246540266059SGregory Neil ShapiroR$* $| $#$* $#$2 246640266059SGregory Neil ShapiroR$* $| $* $: $1', `dnl') 246740266059SGregory Neil ShapiroR$* $: $>D <$&{server_name}> <?> <! TLS_TRY_TAG> <> 246840266059SGregory Neil ShapiroR<?>$* $: $>A <$&{server_addr}> <?> <! TLS_TRY_TAG> <> 246940266059SGregory Neil ShapiroR<?>$* $: <$(access TLS_TRY_TAG`'_TAG_DELIM_ $: ? $)> 247006f25ae9SGregory Neil ShapiroR<?>$* $@ OK 247140266059SGregory Neil Shapiroifdef(`_ATMPF_', `dnl tempfail? 247240266059SGregory Neil ShapiroR<$* _ATMPF_>$* $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 2473193538b7SGregory Neil ShapiroR<NO>$* $#error $@ 5.7.1 $: "550 do not try TLS with " $&{server_name} " ["$&{server_addr}"]" 247406f25ae9SGregory Neil Shapiro 247540266059SGregory Neil Shapiro###################################################################### 247640266059SGregory Neil Shapiro### tls_rcpt: is connection with server "good" enough? 247740266059SGregory Neil Shapiro### (done in client, per recipient) 247840266059SGregory Neil Shapirodnl called from deliver() before RCPT command 247940266059SGregory Neil Shapiro### 248040266059SGregory Neil Shapiro### Parameters: 248140266059SGregory Neil Shapiro### $1: recipient 248240266059SGregory Neil Shapiro###################################################################### 248340266059SGregory Neil ShapiroStls_rcpt 248440266059SGregory Neil Shapiroifdef(`_LOCAL_TLS_RCPT_', `dnl 248540266059SGregory Neil ShapiroR$* $: $1 $| $>"Local_tls_rcpt" $1 248640266059SGregory Neil ShapiroR$* $| $#$* $#$2 248740266059SGregory Neil ShapiroR$* $| $* $: $1', `dnl') 248840266059SGregory Neil Shapirodnl store name of other side 248940266059SGregory Neil ShapiroR$* $: $(macro {TLS_Name} $@ $&{server_name} $) $1 249040266059SGregory Neil Shapirodnl canonify recipient address 249140266059SGregory Neil ShapiroR$+ $: <?> $>CanonAddr $1 249240266059SGregory Neil Shapirodnl strip trailing dots 249340266059SGregory Neil ShapiroR<?> $+ < @ $+ . > <?> $1 <@ $2 > 249440266059SGregory Neil Shapirodnl full address? 249540266059SGregory Neil ShapiroR<?> $+ < @ $+ > $: $1 <@ $2 > $| <F:$1@$2> <U:$1@> <D:$2> <E:> 249640266059SGregory Neil Shapirodnl only localpart? 249740266059SGregory Neil ShapiroR<?> $+ $: $1 $| <U:$1@> <E:> 249840266059SGregory Neil Shapirodnl look it up 249940266059SGregory Neil Shapirodnl also look up a default value via E: 250040266059SGregory Neil ShapiroR$* $| $+ $: $1 $| $>SearchList <! TLS_RCPT_TAG> $| $2 <> 250140266059SGregory Neil Shapirodnl found nothing: stop here 250240266059SGregory Neil ShapiroR$* $| <?> $@ OK 250340266059SGregory Neil Shapiroifdef(`_ATMPF_', `dnl tempfail? 250440266059SGregory Neil ShapiroR$* $| <$* _ATMPF_> $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 250540266059SGregory Neil Shapirodnl use the generic routine (for now) 250640266059SGregory Neil ShapiroR$* $| <$+> $@ $>"TLS_connection" $&{verify} $| <$2>') 250740266059SGregory Neil Shapiro 250840266059SGregory Neil Shapiro###################################################################### 250940266059SGregory Neil Shapiro### tls_client: is connection with client "good" enough? 251040266059SGregory Neil Shapiro### (done in server) 251140266059SGregory Neil Shapiro### 251240266059SGregory Neil Shapiro### Parameters: 251340266059SGregory Neil Shapiro### ${verify} $| (MAIL|STARTTLS) 251440266059SGregory Neil Shapiro###################################################################### 251506f25ae9SGregory Neil Shapirodnl MAIL: called from check_mail 251606f25ae9SGregory Neil Shapirodnl STARTTLS: called from smtp() after STARTTLS has been accepted 251706f25ae9SGregory Neil ShapiroStls_client 251840266059SGregory Neil Shapiroifdef(`_LOCAL_TLS_CLIENT_', `dnl 251940266059SGregory Neil ShapiroR$* $: $1 $| $>"Local_tls_client" $1 252040266059SGregory Neil ShapiroR$* $| $#$* $#$2 252140266059SGregory Neil ShapiroR$* $| $* $: $1', `dnl') 252206f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 252340266059SGregory Neil Shapirodnl store name of other side 252440266059SGregory Neil ShapiroR$* $: $(macro {TLS_Name} $@ $&{server_name} $) $1 252506f25ae9SGregory Neil Shapirodnl ignore second arg for now 252606f25ae9SGregory Neil Shapirodnl maybe use it to distinguish permanent/temporary error? 252706f25ae9SGregory Neil Shapirodnl if MAIL: permanent (STARTTLS has not been offered) 252806f25ae9SGregory Neil Shapirodnl if STARTTLS: temporary (offered but maybe failed) 252940266059SGregory Neil ShapiroR$* $| $* $: $1 $| $>D <$&{client_name}> <?> <! TLS_CLT_TAG> <> 253040266059SGregory Neil ShapiroR$* $| <?>$* $: $1 $| $>A <$&{client_addr}> <?> <! TLS_CLT_TAG> <> 253106f25ae9SGregory Neil Shapirodnl do a default lookup: just TLS_CLT_TAG 253206f25ae9SGregory Neil ShapiroR$* $| <?>$* $: $1 $| <$(access TLS_CLT_TAG`'_TAG_DELIM_ $: ? $)> 253340266059SGregory Neil Shapiroifdef(`_ATMPF_', `dnl tempfail? 253440266059SGregory Neil ShapiroR$* $| <$* _ATMPF_> $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 253540266059SGregory Neil ShapiroR$* $@ $>"TLS_connection" $1', `dnl 253640266059SGregory Neil ShapiroR$* $| $* $@ $>"TLS_connection" $1') 253706f25ae9SGregory Neil Shapiro 253840266059SGregory Neil Shapiro###################################################################### 253940266059SGregory Neil Shapiro### tls_server: is connection with server "good" enough? 254040266059SGregory Neil Shapiro### (done in client) 254140266059SGregory Neil Shapiro### 254240266059SGregory Neil Shapiro### Parameter: 254340266059SGregory Neil Shapiro### ${verify} 254440266059SGregory Neil Shapiro###################################################################### 254506f25ae9SGregory Neil Shapirodnl i.e. has the server been authenticated and is encryption active? 254606f25ae9SGregory Neil Shapirodnl called from deliver() after STARTTLS command 254706f25ae9SGregory Neil ShapiroStls_server 254840266059SGregory Neil Shapiroifdef(`_LOCAL_TLS_SERVER_', `dnl 254940266059SGregory Neil ShapiroR$* $: $1 $| $>"Local_tls_server" $1 255040266059SGregory Neil ShapiroR$* $| $#$* $#$2 255140266059SGregory Neil ShapiroR$* $| $* $: $1', `dnl') 255206f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 255340266059SGregory Neil Shapirodnl store name of other side 255440266059SGregory Neil ShapiroR$* $: $(macro {TLS_Name} $@ $&{server_name} $) $1 255540266059SGregory Neil ShapiroR$* $: $1 $| $>D <$&{server_name}> <?> <! TLS_SRV_TAG> <> 255640266059SGregory Neil ShapiroR$* $| <?>$* $: $1 $| $>A <$&{server_addr}> <?> <! TLS_SRV_TAG> <> 255706f25ae9SGregory Neil Shapirodnl do a default lookup: just TLS_SRV_TAG 255806f25ae9SGregory Neil ShapiroR$* $| <?>$* $: $1 $| <$(access TLS_SRV_TAG`'_TAG_DELIM_ $: ? $)> 255940266059SGregory Neil Shapiroifdef(`_ATMPF_', `dnl tempfail? 256040266059SGregory Neil ShapiroR$* $| <$* _ATMPF_> $#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl') 256140266059SGregory Neil ShapiroR$* $@ $>"TLS_connection" $1', `dnl 256240266059SGregory Neil ShapiroR$* $@ $>"TLS_connection" $1') 256306f25ae9SGregory Neil Shapiro 256440266059SGregory Neil Shapiro###################################################################### 256540266059SGregory Neil Shapiro### TLS_connection: is TLS connection "good" enough? 256640266059SGregory Neil Shapiro### 256740266059SGregory Neil Shapiro### Parameters: 256806f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 256940266059SGregory Neil Shapiro### ${verify} $| <Requirement> [<>]', `dnl 257040266059SGregory Neil Shapiro### ${verify}') 257140266059SGregory Neil Shapiro### Requirement: RHS from access map, may be ? for none. 257240266059SGregory Neil Shapirodnl syntax for Requirement: 257340266059SGregory Neil Shapirodnl [(PERM|TEMP)+] (VERIFY[:bits]|ENCR:bits) [+extensions] 257440266059SGregory Neil Shapirodnl extensions: could be a list of further requirements 257540266059SGregory Neil Shapirodnl for now: CN:string {cn_subject} == string 257640266059SGregory Neil Shapiro###################################################################### 257740266059SGregory Neil ShapiroSTLS_connection 257840266059SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl', `dnl use default error 257940266059SGregory Neil Shapirodnl deal with TLS handshake failures: abort 258040266059SGregory Neil ShapiroRSOFTWARE $#error $@ ifdef(`TLS_PERM_ERR', `5.7.0', `4.7.0') $: "ifdef(`TLS_PERM_ERR', `503', `403') TLS handshake." 258140266059SGregory Neil Shapirodivert(-1)') 258206f25ae9SGregory Neil Shapirodnl common ruleset for tls_{client|server} 258340266059SGregory Neil Shapirodnl input: ${verify} $| <ResultOfLookup> [<>] 258406f25ae9SGregory Neil Shapirodnl remove optional <> 258506f25ae9SGregory Neil ShapiroR$* $| <$*>$* $: $1 $| <$2> 258640266059SGregory Neil Shapirodnl workspace: ${verify} $| <ResultOfLookup> 258740266059SGregory Neil Shapiro# create the appropriate error codes 258806f25ae9SGregory Neil Shapirodnl permanent or temporary error? 258906f25ae9SGregory Neil ShapiroR$* $| <PERM + $={tls} $*> $: $1 $| <503:5.7.0> <$2 $3> 259006f25ae9SGregory Neil ShapiroR$* $| <TEMP + $={tls} $*> $: $1 $| <403:4.7.0> <$2 $3> 259106f25ae9SGregory Neil Shapirodnl default case depends on TLS_PERM_ERR 259206f25ae9SGregory Neil ShapiroR$* $| <$={tls} $*> $: $1 $| <ifdef(`TLS_PERM_ERR', `503:5.7.0', `403:4.7.0')> <$2 $3> 259340266059SGregory Neil Shapirodnl workspace: ${verify} $| [<SMTP:ESC>] <ResultOfLookup> 259440266059SGregory Neil Shapiro# deal with TLS handshake failures: abort 259506f25ae9SGregory Neil ShapiroRSOFTWARE $| <$-:$+> $* $#error $@ $2 $: $1 " TLS handshake failed." 259606f25ae9SGregory Neil Shapirodnl no <reply:dns> i.e. not requirements in the access map 259706f25ae9SGregory Neil Shapirodnl use default error 259806f25ae9SGregory Neil ShapiroRSOFTWARE $| $* $#error $@ ifdef(`TLS_PERM_ERR', `5.7.0', `4.7.0') $: "ifdef(`TLS_PERM_ERR', `503', `403') TLS handshake failed." 259940266059SGregory Neil ShapiroR$* $| <$*> <VERIFY> $: <$2> <VERIFY> <> $1 260040266059SGregory Neil Shapirodnl separate optional requirements 260140266059SGregory Neil ShapiroR$* $| <$*> <VERIFY + $+> $: <$2> <VERIFY> <$3> $1 260240266059SGregory Neil ShapiroR$* $| <$*> <$={tls}:$->$* $: <$2> <$3:$4> <> $1 260340266059SGregory Neil Shapirodnl separate optional requirements 260440266059SGregory Neil ShapiroR$* $| <$*> <$={tls}:$- + $+>$* $: <$2> <$3:$4> <$5> $1 260506f25ae9SGregory Neil Shapirodnl some other value in access map: accept 260606f25ae9SGregory Neil Shapirodnl this also allows to override the default case (if used) 260706f25ae9SGregory Neil ShapiroR$* $| $* $@ OK 260806f25ae9SGregory Neil Shapiro# authentication required: give appropriate error 260906f25ae9SGregory Neil Shapiro# other side did authenticate (via STARTTLS) 261040266059SGregory Neil Shapirodnl workspace: <SMTP:ESC> <{VERIFY,ENCR}[:BITS]> <[extensions]> ${verify} 261106f25ae9SGregory Neil Shapirodnl only verification required and it succeeded 261240266059SGregory Neil ShapiroR<$*><VERIFY> <> OK $@ OK 261340266059SGregory Neil Shapirodnl verification required and it succeeded but extensions are given 261440266059SGregory Neil Shapirodnl change it to <SMTP:ESC> <REQ:0> <extensions> 261540266059SGregory Neil ShapiroR<$*><VERIFY> <$+> OK $: <$1> <REQ:0> <$2> 261606f25ae9SGregory Neil Shapirodnl verification required + some level of encryption 261740266059SGregory Neil ShapiroR<$*><VERIFY:$-> <$*> OK $: <$1> <REQ:$2> <$3> 261806f25ae9SGregory Neil Shapirodnl just some level of encryption required 261940266059SGregory Neil ShapiroR<$*><ENCR:$-> <$*> $* $: <$1> <REQ:$2> <$3> 262040266059SGregory Neil Shapirodnl workspace: 262140266059SGregory Neil Shapirodnl 1. <SMTP:ESC> <VERIFY [:bits]> <[extensions]> {verify} (!= OK) 262240266059SGregory Neil Shapirodnl 2. <SMTP:ESC> <REQ:bits> <[extensions]> 262340266059SGregory Neil Shapirodnl verification required but ${verify} is not set (case 1.) 262440266059SGregory Neil ShapiroR<$-:$+><VERIFY $*> <$*> $#error $@ $2 $: $1 " authentication required" 262540266059SGregory Neil ShapiroR<$-:$+><VERIFY $*> <$*> FAIL $#error $@ $2 $: $1 " authentication failed" 262640266059SGregory Neil ShapiroR<$-:$+><VERIFY $*> <$*> NO $#error $@ $2 $: $1 " not authenticated" 262740266059SGregory Neil ShapiroR<$-:$+><VERIFY $*> <$*> NOT $#error $@ $2 $: $1 " no authentication requested" 262840266059SGregory Neil ShapiroR<$-:$+><VERIFY $*> <$*> NONE $#error $@ $2 $: $1 " other side does not support STARTTLS" 262906f25ae9SGregory Neil Shapirodnl some other value for ${verify} 263040266059SGregory Neil ShapiroR<$-:$+><VERIFY $*> <$*> $+ $#error $@ $2 $: $1 " authentication failure " $4 263140266059SGregory Neil Shapirodnl some level of encryption required: get the maximum level (case 2.) 263240266059SGregory Neil ShapiroR<$*><REQ:$-> <$*> $: <$1> <REQ:$2> <$3> $>max $&{cipher_bits} : $&{auth_ssf} 263306f25ae9SGregory Neil Shapirodnl compare required bits with actual bits 263440266059SGregory Neil ShapiroR<$*><REQ:$-> <$*> $- $: <$1> <$2:$4> <$3> $(arith l $@ $4 $@ $2 $) 263540266059SGregory Neil ShapiroR<$-:$+><$-:$-> <$*> TRUE $#error $@ $2 $: $1 " encryption too weak " $4 " less than " $3 263640266059SGregory Neil Shapirodnl strength requirements fulfilled 263740266059SGregory Neil Shapirodnl TLS Additional Requirements Separator 263840266059SGregory Neil Shapirodnl this should be something which does not appear in the extensions itself 263940266059SGregory Neil Shapirodnl @ could be part of a CN, DN, etc... 264040266059SGregory Neil Shapirodnl use < > ? those are encoded in CN, DN, ... 264140266059SGregory Neil Shapirodefine(`_TLS_ARS_', `++')dnl 264240266059SGregory Neil Shapirodnl workspace: 264340266059SGregory Neil Shapirodnl <SMTP:ESC> <REQ:bits> <extensions> result-of-compare 264440266059SGregory Neil ShapiroR<$-:$+><$-:$-> <$*> $* $: <$1:$2 _TLS_ARS_ $5> 264540266059SGregory Neil Shapirodnl workspace: <SMTP:ESC _TLS_ARS_ extensions> 264640266059SGregory Neil Shapirodnl continue: check extensions 264740266059SGregory Neil ShapiroR<$-:$+ _TLS_ARS_ > $@ OK 264840266059SGregory Neil Shapirodnl split extensions into own list 264940266059SGregory Neil ShapiroR<$-:$+ _TLS_ARS_ $+ > $: <$1:$2> <$3> 265040266059SGregory Neil ShapiroR<$-:$+> < $+ _TLS_ARS_ $+ > <$1:$2> <$3> <$4> 265140266059SGregory Neil ShapiroR<$-:$+> $+ $@ $>"TLS_req" $3 $| <$1:$2> 265206f25ae9SGregory Neil Shapiro 265340266059SGregory Neil Shapiro###################################################################### 265440266059SGregory Neil Shapiro### TLS_req: check additional TLS requirements 265540266059SGregory Neil Shapiro### 265640266059SGregory Neil Shapiro### Parameters: [<list> <of> <req>] $| <$-:$+> 265740266059SGregory Neil Shapiro### $-: SMTP reply code 265840266059SGregory Neil Shapiro### $+: Enhanced Status Code 265940266059SGregory Neil Shapirodnl further requirements for this ruleset: 266040266059SGregory Neil Shapirodnl name of "other side" is stored is {TLS_name} (client/server_name) 266140266059SGregory Neil Shapirodnl 266240266059SGregory Neil Shapirodnl currently only CN[:common_name] is implemented 266340266059SGregory Neil Shapirodnl right now this is only a logical AND 266440266059SGregory Neil Shapirodnl i.e. all requirements must be true 266540266059SGregory Neil Shapirodnl how about an OR? CN must be X or CN must be Y or .. 266640266059SGregory Neil Shapirodnl use a macro to compute this as a trivial sequential 266740266059SGregory Neil Shapirodnl operations (no precedences etc)? 266840266059SGregory Neil Shapiro###################################################################### 266940266059SGregory Neil ShapiroSTLS_req 267040266059SGregory Neil Shapirodnl no additional requirements: ok 267140266059SGregory Neil ShapiroR $| $+ $@ OK 267240266059SGregory Neil Shapirodnl require CN: but no CN specified: use name of other side 267340266059SGregory Neil ShapiroR<CN> $* $| <$+> $: <CN:$&{TLS_Name}> $1 $| <$2> 267440266059SGregory Neil Shapirodnl match, check rest 267540266059SGregory Neil ShapiroR<CN:$&{cn_subject}> $* $| <$+> $@ $>"TLS_req" $1 $| <$2> 267640266059SGregory Neil Shapirodnl CN does not match 267740266059SGregory Neil Shapirodnl 1 2 3 4 267840266059SGregory Neil ShapiroR<CN:$+> $* $| <$-:$+> $#error $@ $4 $: $3 " CN " $&{cn_subject} " does not match " $1 267940266059SGregory Neil Shapirodnl cert subject 268040266059SGregory Neil ShapiroR<CS:$&{cert_subject}> $* $| <$+> $@ $>"TLS_req" $1 $| <$2> 268140266059SGregory Neil Shapirodnl CS does not match 268240266059SGregory Neil Shapirodnl 1 2 3 4 268340266059SGregory Neil ShapiroR<CS:$+> $* $| <$-:$+> $#error $@ $4 $: $3 " CERT Subject " $&{cert_subject} " does not match " $1 268440266059SGregory Neil Shapirodnl match, check rest 268540266059SGregory Neil ShapiroR<CI:$&{cert_issuer}> $* $| <$+> $@ $>"TLS_req" $1 $| <$2> 268640266059SGregory Neil Shapirodnl CI does not match 268740266059SGregory Neil Shapirodnl 1 2 3 4 268840266059SGregory Neil ShapiroR<CI:$+> $* $| <$-:$+> $#error $@ $4 $: $3 " CERT Issuer " $&{cert_issuer} " does not match " $1 268940266059SGregory Neil Shapirodnl return from recursive call 269040266059SGregory Neil ShapiroROK $@ OK 269140266059SGregory Neil Shapiro 269240266059SGregory Neil Shapiro###################################################################### 269340266059SGregory Neil Shapiro### max: return the maximum of two values separated by : 269440266059SGregory Neil Shapiro### 269540266059SGregory Neil Shapiro### Parameters: [$-]:[$-] 269640266059SGregory Neil Shapiro###################################################################### 269706f25ae9SGregory Neil ShapiroSmax 269806f25ae9SGregory Neil ShapiroR: $: 0 269906f25ae9SGregory Neil ShapiroR:$- $: $1 270006f25ae9SGregory Neil ShapiroR$-: $: $1 270106f25ae9SGregory Neil ShapiroR$-:$- $: $(arith l $@ $1 $@ $2 $) : $1 : $2 270206f25ae9SGregory Neil ShapiroRTRUE:$-:$- $: $2 270340266059SGregory Neil ShapiroR$-:$-:$- $: $2 270440266059SGregory Neil Shapirodnl endif _ACCESS_TABLE_ 270540266059SGregory Neil Shapirodivert(0) 270606f25ae9SGregory Neil Shapiro 270740266059SGregory Neil Shapiro###################################################################### 270840266059SGregory Neil Shapiro### RelayTLS: allow relaying based on TLS authentication 270940266059SGregory Neil Shapiro### 271040266059SGregory Neil Shapiro### Parameters: 271140266059SGregory Neil Shapiro### none 271240266059SGregory Neil Shapiro###################################################################### 271340266059SGregory Neil ShapiroSRelayTLS 271406f25ae9SGregory Neil Shapiro# authenticated? 271506f25ae9SGregory Neil Shapirodnl we do not allow relaying for anyone who can present a cert 271606f25ae9SGregory Neil Shapirodnl signed by a "trusted" CA. For example, even if we put verisigns 271706f25ae9SGregory Neil Shapirodnl CA in CERTPath so we can authenticate users, we do not allow 271806f25ae9SGregory Neil Shapirodnl them to abuse our server (they might be easier to get hold of, 271906f25ae9SGregory Neil Shapirodnl but anyway). 272006f25ae9SGregory Neil Shapirodnl so here is the trick: if the verification succeeded 272106f25ae9SGregory Neil Shapirodnl we look up the cert issuer in the access map 272206f25ae9SGregory Neil Shapirodnl (maybe after extracting a part with a regular expression) 272306f25ae9SGregory Neil Shapirodnl if this returns RELAY we relay without further questions 272406f25ae9SGregory Neil Shapirodnl if it returns SUBJECT we perform a similar check on the 272506f25ae9SGregory Neil Shapirodnl cert subject. 272606f25ae9SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 272740266059SGregory Neil ShapiroR$* $: <?> $&{verify} 272840266059SGregory Neil ShapiroR<?> OK $: OK authenticated: continue 272940266059SGregory Neil ShapiroR<?> $* $@ NO not authenticated 273006f25ae9SGregory Neil Shapiroifdef(`_CERT_REGEX_ISSUER_', `dnl 273140266059SGregory Neil ShapiroR$* $: $(CERTIssuer $&{cert_issuer} $)', 273240266059SGregory Neil Shapiro`R$* $: $&{cert_issuer}') 273340266059SGregory Neil ShapiroR$+ $: $(access CERTISSUER`'_TAG_DELIM_`'$1 $) 273406f25ae9SGregory Neil Shapirodnl use $# to stop further checks (delay_check) 273540266059SGregory Neil ShapiroRRELAY $# RELAY 273606f25ae9SGregory Neil Shapiroifdef(`_CERT_REGEX_SUBJECT_', `dnl 273740266059SGregory Neil ShapiroRSUBJECT $: <@> $(CERTSubject $&{cert_subject} $)', 273840266059SGregory Neil Shapiro`RSUBJECT $: <@> $&{cert_subject}') 273940266059SGregory Neil ShapiroR<@> $+ $: <@> $(access CERTSUBJECT`'_TAG_DELIM_`'$1 $) 274040266059SGregory Neil ShapiroR<@> RELAY $# RELAY 274140266059SGregory Neil ShapiroR$* $: NO', `dnl') 274240266059SGregory Neil Shapiro 274340266059SGregory Neil Shapiro###################################################################### 274440266059SGregory Neil Shapiro### authinfo: lookup authinfo in the access map 274540266059SGregory Neil Shapiro### 274640266059SGregory Neil Shapiro### Parameters: 274740266059SGregory Neil Shapiro### $1: {server_name} 274840266059SGregory Neil Shapiro### $2: {server_addr} 274940266059SGregory Neil Shapirodnl both are currently ignored 275040266059SGregory Neil Shapirodnl if it should be done via another map, we either need to restrict 275140266059SGregory Neil Shapirodnl functionality (it calls D and A) or copy those rulesets (or add another 275240266059SGregory Neil Shapirodnl parameter which I want to avoid, it's quite complex already) 275340266059SGregory Neil Shapiro###################################################################### 275440266059SGregory Neil Shapirodnl omit this ruleset if neither is defined? 275540266059SGregory Neil Shapirodnl it causes DefaultAuthInfo to be ignored 275640266059SGregory Neil Shapirodnl (which may be considered a good thing). 275740266059SGregory Neil ShapiroSauthinfo 275840266059SGregory Neil Shapiroifdef(`_AUTHINFO_TABLE_', `dnl 275940266059SGregory Neil ShapiroR$* $: <$(authinfo AuthInfo:$&{server_name} $: ? $)> 276040266059SGregory Neil ShapiroR<?> $: <$(authinfo AuthInfo:$&{server_addr} $: ? $)> 276140266059SGregory Neil ShapiroR<?> $: <$(authinfo AuthInfo: $: ? $)> 276240266059SGregory Neil ShapiroR<?> $@ no no authinfo available 276340266059SGregory Neil ShapiroR<$*> $# $1 276440266059SGregory Neil Shapirodnl', `dnl 276540266059SGregory Neil Shapiroifdef(`_ACCESS_TABLE_', `dnl 276640266059SGregory Neil ShapiroR$* $: $1 $| $>D <$&{server_name}> <?> <! AuthInfo> <> 276740266059SGregory Neil ShapiroR$* $| <?>$* $: $1 $| $>A <$&{server_addr}> <?> <! AuthInfo> <> 276840266059SGregory Neil ShapiroR$* $| <?>$* $: $1 $| <$(access AuthInfo`'_TAG_DELIM_ $: ? $)> <> 276940266059SGregory Neil ShapiroR$* $| <?>$* $@ no no authinfo available 277040266059SGregory Neil ShapiroR$* $| <$*> <> $# $2 277140266059SGregory Neil Shapirodnl', `dnl')') 277206f25ae9SGregory Neil Shapiro 277306f25ae9SGregory Neil Shapiroundivert(9)dnl LOCAL_RULESETS 277406f25ae9SGregory Neil Shapiro# 277506f25ae9SGregory Neil Shapiro###################################################################### 277606f25ae9SGregory Neil Shapiro###################################################################### 277706f25ae9SGregory Neil Shapiro##### 277806f25ae9SGregory Neil Shapiro`##### MAIL FILTER DEFINITIONS' 277906f25ae9SGregory Neil Shapiro##### 278006f25ae9SGregory Neil Shapiro###################################################################### 278106f25ae9SGregory Neil Shapiro###################################################################### 278240266059SGregory Neil Shapiro_MAIL_FILTERS_ 2783c2aa98e2SPeter Wemm# 2784c2aa98e2SPeter Wemm###################################################################### 2785c2aa98e2SPeter Wemm###################################################################### 2786c2aa98e2SPeter Wemm##### 2787c2aa98e2SPeter Wemm`##### MAILER DEFINITIONS' 2788c2aa98e2SPeter Wemm##### 2789c2aa98e2SPeter Wemm###################################################################### 2790c2aa98e2SPeter Wemm###################################################################### 279106f25ae9SGregory Neil Shapiroundivert(7)dnl MAILER_DEFINITIONS 279242e5d165SGregory Neil Shapiro 2793