------------------------------------------------------------------------------ The following are various bits and peices that can be added to a sendmail master config (mc) file. to perform various techniques. General Notes, and discoveries. * The "LOCAL_RELAY" is handles now by Rule 5 which is a new built in rule handled AFTER alias processing of a local address. This allows local alias and ".forward" files to re-forwrd mail elsewhere before the relay forces local mail to be send to the relay host. * The same config file with a "SMART_HOST" definition can be used on BOTH the client machines and the smart host itself. The smart host is defined on that machine, but is then removed by the v8.12.2 "MailerToTriple" config ruleset as destination is the local host. * Smarthost will cause all mail between machine to be sent via the "smart host" regardless of ------------------------------------------------------------------------------- # --- Sendmail Config Location --- # # Specify where we store all the sendmail data files # other than the default sendmail.cf config this produces # define(`MAIL_SETTINGS_DIR', `/etc/mail_v8/')dnl ------------------------------------------------------------------------------- Local Relay Table Look up this hosts relay from a table (especially for NFS mounted/distributed sendmail CF files. divert(-1)dnl # --- Local Relay Table --- # # Relay: Where to send mail that would deliver locally (after alias handling) # Note: in current sendmail this is handled by build call to RuleSet 5 # # We have a group of machines within the department which is NEVER to # recieve local mail, but must be able to handle mail as normal otherwise. # A MX record takes care of mail going to the machine but not local mail # sent on these machines. I could use a HUB or RELAY but that would mean a # different config for these machine compared to others. MailTable is # ignored for local deliveries on unlisted machines. # # These rules looks up the machine FQDN name in a table and forwards any # mail which would have been delivered locally on this host, on to the # machine returned by that table. # # First define the relay host macro as a database lookup using machines FQDN define(`LOCAL_RELAY', `$(localrelay $j $: $)') # ASIDE: the above use to be added with a post-m4 edit of the generated cf file # EG: sed 's/\$R/$(localrelay $j $: $)/' generated.cf > final.cf # # Add the database definition in the sendmail configuration area PUSHDIVERT(-1)dnl LOCAL_CONFIG # Forward Local Mail Table (CIT Hack -- anthony) # relay local from machines in this table to the destination given Klocalrelay dbm -o MAIL_SETTINGS_DIR`'localrelay POPDIVERT # ASIDE: the entries in the localrelay text source file is also used # to set extra "local-host-names" (Class w) so the destination sendmail # hosts will also accept the mail as local. NOTE: this aspect is now # generally handled by the "bestmx" feature. # ------------------------------------------------------------------------------- Smarter Smart Hosting (for mail firewalls) # --- Smarthost to Mail Firewall --- # # Smarthost: host to sent to for relay/forwarding for ALL non-local mail. # # This hack modifies this do only mail not in given domains are forwarded # to the smart host. EG: forward mail to firewall, only if destination is for # external machines # # A standard "smart host" define, will do the job, but then ALL mail between # hosts in the local domain gets relayed via the smart host, creating a # network bottleneck and single point of failure. It also slows delivery. # # In other words this is NOT what is wanted. What is wanted is a smarter # use of SMARTHOST, that only is sent mail destined outside our domain. # # This hack handles any mail being send within the defined smarthost domain, # sending it directly to their normal non-smarthost destination, before # falling through to the normal smart hosting rules. # # NOTE: IP addresses (eg: @[xxx.xxx.xxx.xxx]) will continue to be smart # hosted, as normal, even before the "bestmx" feature is applied. # # NOTE: smarthost feature is automatically disabled on the smarthost itself # as such the same sendmail config can be used on both the smarthost AND # the non-smarthost client machines. # # WARNING: This must be defined after the BestMX feature, or any other feature # that may use "LOCAL NET CONFIG" technique. otherwise unpredictable results # may develop. # define(`SMART_HOST', `beholder.cit.gu.edu.au') dnl Normal smart hosting define(`SMART_CLASS_NOT', `gu.edu.au') dnl dont smart these domains PUSHDIVERT(-1)dnl LOCAL_CONFIG ifelse(defn(`SMART_CLASS_NOT'), `', `dnl', ` # Define the domains of machines for which mail is NOT to be relayed via the # smarthost. That is mail being sent to a host NOT outside these domains is # forwarded to the smarthost, while mail to hosts in these domains will # deliver directly to that host. # # This can be used to deliver mail outside the current domain via the # firewall host for relay to the rest of the world at large. # CS`'SMART_CLASS_NOT') POPDIVERT PUSHDIVERT(-1)dnl LOCAL_NET_CONFIG ifelse(defn(`SMART_CLASS_NOT'), `', `dnl', ` # Limit what mail is to be relayed via the smarthost (macro 'S') rule next, # to only mail NOT part of the local domain list (class 'S'). R$* < @ $* $=S . > $* $#esmtp $@ $2 $3 $: $1 . < @ $2 $3 > $4 dont smarthost dnl')dnl POPDIVERT # ASIDE: A mailer table colud have be used to perform this job, and is the # common method I discovered after a network search. For example # .local.domain esmtp:%1%0:[smarthost.local.domain] # local.domain esmtp:%0 # . esmtp:[firewall.local.domain] # However this overrides all added features, including "bestmx" which is # vital for correct handling of the multitude of PC's in our doamin. -------------------------------------------------------------------------------