Background ========== genBK-2.3.sm.cf is my "second generation" monolithic sendmail configuration file. It runs only under sendmail version 8, and is incompatible with Sun Microsystems' version 8 sendmail. It uses M4 macro processing to support a couple of configuration options, but in contrast to the Berkeley- supplied configuration file, it is a single file rather than several. This is a relatively new configuration, but it has evolved from a first generation file which I have used at a number of sites for many years. This version moves a lot of the mailer resolution and other information into external files so that you don't normally have to write a lot of sendmail rules to accomplish what you want. Mailer resolution rules are quite flexible and can distinguish between the following kinds of addresses: o Numeric address specifications ([a.b.c.d]) o Addresses with unqualified (no domain) versus qualified host parts o Local addresses o Addresses with no host part o Addresses that are "via here" (eg, a%b@here) o Addresses in X.400 syntax (/key=value/...) o File addresses (/stuff...) o Addresses with embedded slashes (s_g_i_q/ou1_ou2_ou3_ou4...) o File aliases and pipes (:include:... and |...) o Users that should "stay here" (eg, root) even if others are rerouted The included mailers support: o Local and program o TCP o LAN (internal) and Internet (external) rewriting flavors o UUCP o UUCP addresses, internal domain addresses, and external domain addresses Address aliasing can be performed on non-local addresses as well as local addresses, and secondary aliasing can be applied to "external" mailers in case you want addresses to appear differently on your LAN and the Internet. Configuration ============= m4 parameters ------------- o ADDLOC If set, the short host name is added to user-only addresses in LAN mailers. o DNS If set, assume hosts are looked up using DNS. This may not be requried on all systems. o NOUNKNOWN If set, this avoids checking whether internet hosts can be resolved. o UUXHACK If set, fix UUCP-munged domain addresses (ie, chop off $=w! from addresses of the form $-2!$+@$+). o VIAPCT If set, route LAN hosts using the % hack instead of delivering directly (ie, user%host@here.dom.ain versus user@host.dom.ain). Variables --------- o Dw The primary short host name o Cw Class of interchangeable short host names (include $w) o DU The UUCP name for the host o Dm The primary domain name o Cm Class of interchangeable domain names (include $m) o Dj The primary qualified host name (usually $w.$m) o Cj Class of fully qualified host names not covered by $=w.$=m o DJ Advertised host name ($m to be the domain, $j to be in the domain) o DL The default local (ie, LAN) mailer o CL The list of local (ie, LAN, not Internet) mailers (A user is a "local user" if her address resolves to one of these mailers.) o DR The default remote (ie, Internet) mailer o CU The class of adjacent UUCP hosts (usually from a file) o CS The class of "stay here" users (eg, root, postmaster, etc.) (This is used if you want to route all but a few key local addresses somewhere else.) Built-In Rule Sets ------------------ Rule sets 15 and 17 are called before performing database look-ups for host aliasing and mailer/relay resolution, respectively. These rule sets are normally empty, but can be used if you have rewriting conditions beyond the scope of the database entry syntax. Configuration Databases ======================= User Aliasing (user_aliases, envelope_aliases, and external_aliases) ------------------------------------------------- You can alias a user with no host part (using "user@~NOH"), a user at this host by any name (using "user@~THH"), a user at a specific address (using "user@host.domain"), or any local user (using just "user"). A local user is any user reachable by a local mailer (as defined by class L). The previous forms have precedence, and an alias to "." means no change (this is more efficient than aliasing a user to herself). Thus, local user aliases may be partially eclipsed for specific addresses. On the right-hand side, %1, %2, and %3 represent the original user, the original host, and $J, respectively. The user_aliases database is applied to all inside addresses. The envelope_aliases database ia applied to all envelope addresses. The external_aliases database is only applied to addresses processed by external mailers (ie, for mail leaving the local LAN). User aliasing occurs after host aliasing. User aliasing is not performed on ~VIA addresses. The ~THH tag is appended to this host's names, but user-type tags are not included in the look-up. Host Aliasing (host_aliases) ---------------------------- Host aliasing entries have the form: hostspec new_sender[:new_receiver[:new_envelope]] Host specifications are described in the next major section. If the new_receiver value is omitted, the new_sender value is used. If the new_envelope value is omitted, the new_receiver value is used. Each component may be a new host name, a user without a host ("user@"), a user with a host ("user@host"), or a no-change indicator ("."). There is no user component in the key, so this facility can be used to fold all users in a domain into a single account. Processing overhead can be reduced by including "no-change" short-cuts for the local host, local domain, and other commonly used hosts or domains. The host aliasing process stops the first time an entry matches (aliased hosts are not re-aliased). Examples: katzung.pr.mcs.net.~THH katsun.chi.il.us Replace all occurences of host "katzung.pr.mcs.net" (here) with "katsun.chi.il.us". .~ADR.~X4.~THH x400.gate.way .~ADR.~THH katsun.chi.il.us Replace all my numeric specification addresses too, except X.400 addresses will go to x400.gate.way. katsun.chi.il.us.~THH . .chi.il.us . No-change short-cut to bypass .il.us and .us domain look-ups. loner.com loner@loner.com Replace all occurences of "any_user@loner.com" with "loner@loner.com", where any_user can be any user. solo.com .:.:solo@solo.com Replace envelope addresses for "any_user@solo.com" with "solo@solo.com". Inside addresses with not be replaced. .~HST .:.:mailer-daemon@ .~FQD .:.:mailer-daemon@ Rewrite envelope addresses for everything that hasn't been previously matched (except this host's names, which won't match because of the ".~THH" tag) to mailer-daemon. Mailer And Relay Resolution (mailer_table) ------------------------------------------ The mailer and relay resolution look-up is processed by the same method as host alias look-ups. The right hand side must be in one of the two following forms: error:message mailer:[relay]:[newhost] If the mailer is "error" (the first form), everything after the colon constitutes the error message to return. The mailer must be one of the following (unless you have added additional mailers): local Local/program delivery tcp Internal (eg, LAN) delivery via TCP SMTP xtcp External (eg, Internet) delivery via TCP SMTP uucp External delivery via UUCP (UUCP-style addresses) duucp Internal delivery via UUCP (domain-style addresses) xduucp External delivery via UUCP (domain-style addresses) The relay is the next recipient host. It is ignored and may be blank for the "local" mailer. The optional "newhost" portion provides convenient envelope host aliasing on delivery. Unlike the general host aliasing facility, "newhost" may not contain a user component. If no ".~THH" entries match an explicitly specified local host, the explicit host name is dropped and the address is reprocessed with ".~NOH". If no ".~NOH" entries apply, local delivery is attempted. If no ".~VIA" entries match an indirect address, address processing continues with the user portion of the address (ie, it is reparsed into a new user portion and a new host portion). If no entries match a fully-qualified host name, delivery is attempted directly to the host using the mailer specified in $R. Examples: .foo.com tcp:%1:%1 Deliver to host.foo.com using the tcp mailer to "host" and rewriting "host.foo.com" to "host" in the envelope. This kind of construct is handy if you have a lot of hosts that don't know their domain name. .~FQD xtcp:mail.isp.com Cause the default for fully qualified host names to be to deliver via the xtcp mailer to host "mail.isp.com". .~X4.~NOH error:There is no X.400 here Return an error for addresses in X.400 syntax for an implicit local address (and for an explicit one, if no ".~THH" rules applied). Host Specifications =================== This section describes the host specification format used for the key values (left hand sides) of the host_alias and mailer_table databases. In the lookup order tables below, ~___ represents one of the following user types: ~STA addresses that you might want to stay here (eg, root) ~INC :include: addresses ~PRC process (pipe) addresses ~LDS file addresses (leading slash but not X.400) ~EMS addresses with embedded (but not leading) slashes ~X4 X.400 addresses (/$*=$*/) ~REG all other ("regular") addresses ---------------------------------------------------------------------- For "host.domN.dom1" where host.domN.dom1 is the local host ("this host"): host.domN.dom1.~___.~THH host.domN.dom1.~THH .domN.dom1.~___.~THH %1 = host; %2 = domN.dom1.~___.~THH .domN.dom1.~THH %1 = host; %2 = domN.dom1.~THH . . . . . . .dom1.~___.~THH %1 = host.domN; %2 = dom1.~___.~THH .dom1.~THH %1 = host.domN; %2 = dom1.~THH .~___.~THH %1 = host.domN.dom1; %2 = ~___.~THH .~THH %1 = host.domN.dom1; %2 = ~THH When resolving a mailer (but not for host aliasing), the "no host" cases are also tried if none of these lookups succeed, ---------------------------------------------------------------------- For a non-local address via the local host (eg, the host portion refers to the local host, but the user portion contains a '!', '@', or '%') where the local host is host.domN.dom1: host.domN.dom1.~VIA .domN.dom1.~VIA %1 = host; %2 = domN.dom1.~VIA . . . . . . .dom1.~VIA %1 = host.domN; %2 = dom1.~VIA .~VIA %1 = host.domN.dom1; %2 = ~VIA ---------------------------------------------------------------------- For "[a.b.c.d]" where [a.b.c.d] is a domain literal for the local host: [a.b.c.d].~___.~THH [a.b.c.d].~THH .~ADR.~___.~THH %1 = [a.b.c.d]; %2 = ~___.~THH .~ADR.~THH %1 = [a.b.c.d]; %2 = ~___.~THH .~___.~THH %1 = [a.b.c.d]; %2 = ~___.~THH .~THH %1 = [a.b.c.d]; %2 = ~THH ---------------------------------------------------------------------- For "[a.b.c.d]" where [a.b.c.d] is a domain literal: [a.b.c.d] ?.~ADR %1 = [a.b.c.d]; %2 = ~ADR (if host is unknown) .~ADR %1 = [a.b.c.d]; %2 = ~ADR (known or unknown) ---------------------------------------------------------------------- For an address with no host part: ~___.~NOH .~NOH %1 = ~___; %2 = ~NOH ---------------------------------------------------------------------- For a UUCP host: host.UUCP host (host alias only) ?.UUCP %1 = host; %2 = UUCP (if host is unknown) .UUCP %1 = host; %2 = UUCP (known or unknown) ---------------------------------------------------------------------- For a fully-qualified host part: host.domN.dom1 ?.domN.dom1 %1 = host; %2 = domN.dom1 (if host is unknown) .domN.dom1 %1 = host; %2 = domN.dom1 (known or unknown) . . . . . . ?.dom1 %1 = host.domN; %2 = dom1 (if unknown) .dom1 %1 = host.domN; %2 = dom1 ?.~FQD %1 = host.domN.dom1; %2 = ~FQD (if unknown) .~FQD %1 = host.domN.dom1; %2 = ~FQD ---------------------------------------------------------------------- For an unqualified host part: host ?.~HST %1 = host; %2 = ~HST (if host is unknown) .~HST %1 = host; %2 = ~HST (known or unknown) Additional Details, If You Really Want To Know ============================================== Address Canonicalization ------------------------ The canonical format used in this configuration is user h [map[.map]:] flags [search] [mailer] where search = k [map] r mailer = [mailer][:[relay][:[new_host]]] fflag = (host known) or (host unknown) pflag = (processing enabled) or (disabled) sflag = (normal syntax) or (route syntax) Examples: katzung h This corresponds to user katzung, host katsun.chi.il.us, in normal syntax (katzung@katsun.chi.il.us). katzung h xtcp : katsun.chi.il.us This corresponds to @katsun.chi.il.us:katzung, resolved to mailer xtcp through relay katsun.chi.il.us katzung h ua : This corresponds to katzung@mcs.com with a map specifier of "ua". (The map specifiers act like function call parameters and allow additional databases to be incorporated in special configurations without having to duplicate existing types of look-ups for each database.) katzung h : >k ha r This is the address katzung@katsun.chi.il.us, a known host, ready to search the host alias database for a ".chi.il.us" domain rule (no result yet). The ':' in the key area, in this case, is the "known host" flag for the key (as opposed to the 'f' flag, which applies to the h host). (Examples have been shown without host or user-type tags for simplicity.) Rewritten canonical address forms can be recanonicalized by surrounding them with exclamation marks ("!address!"). Additional envelope address rewriting can be prevented by adding a single exclamation mark as a suffix ("address!").