A rule to match any address

From Messaging Server Technical Reference Wiki
Jump to: navigation, search


The special pattern "." (a single period) will match any host/domain specification if no other rule matches and the host/domain specification cannot be found anywhere in the channel table. In other words, the "." rule is used as a last resort when address rewriting would fail otherwise.

In times past, with a slower changing set of Top Level Domains, the "." rewrite rule was less commonly used. Instead, in the past, use of an internet.rules file of rewrite rules for matching the (seldom changing) known top-level Internet Domains permitted immediate feedback on addresses with clearly invalid Top Level Domains -- immediate feedback on obvious mispellings of TLDs. With that approach, "known" Internet TLDs could be routed by the rewrite rules in internet.rules, but "bogus" TLDs, not matching any rewrite rule, would be detected during rewriting, and rejected. As such, in the past, the special "." rule tended to be used only when the MTA did not have complete routing information available and had to defer judgment of address validity to another system or systems. In those cases, the "." pattern was used to simplify the MTA configuration at the expense of allowing propagation of possibly bogus addresses.

However, nowadays "." is routinely used in an important rewrite rule making a comparison against a (frequently updated) tlds.txt list of Top Level Domains to achieve routing of Internet addresses with apparently valid TLDs, while not propagating addresses with invalid TLDs. Nowadays, the internet.rules file, instead of containing distinct rewrite rules for each Top Level Domain, merely contains the one special rewrite rule:


.    $U%$H$,$H@TCP-DAEMON

Here the "." pattern causes all domain names not matched by other, more specific rewrite rules to get matched. However, the $, compares the top-level portion of the domain substituted by $H (in the case of this rewrite rule with a "." match, the $H substitutes back the entire domain in the address) against the list in tlds.txt and the rewrite rule will only succeed if a match is found: this rewrite rule will only succeed if the top-level portion of the domain of the address being rewritten can be found in tlds.txt.

Note: When the match-all rule matches and its template is expanded, $H expands to the full host name and $D expands to a single dot ".". Thus, $D is of limited use in a match-all rule template!


See also: