On Tue, Oct 19, 1999 at 03:55:21PM -0700, Ted Lin wrote: > > If you wouldn't mind, I've read the man page, but I'm afraid I still don't > fully understand the purpose of the percenthack control file. Can you shed > any light on this? (Here is a more elaborate answer. This is also to be found at http://x42.com/qmail/doc/percenthack.txt about the percenthack ===================== This is a historic reminiscence from the days routed mail through serial lines and uucp-connections more often than on leased lines. It's use is to force routing of mail through one or several hosts, and to be able to put this chain of routing hosts into the mailaddress itself. You should know that this form of routed addressing is not recommended, but it is unfortunately sometimes required when the local host is acting as a gateway between two networks. The function is this: If the percenthack for a domain is enabled, then the mailhost is able to expand mailaddresses that contains %-signs. A percent hacked mail address is an address that consists of one username and one or more fully qualified domain name (FQDN) of hosts that the mail shall be routed through. Example 1: example.com shall route mail for the domain uucp.example.com according to the percent hack scheme. The only qmail configuration needed is to put uucp.example1.com in the file "controls/percenthack". Now a mail sent to [EMAIL PROTECTED] will be rewritten to "[EMAIL PROTECTED]" before any local delivery is done. Conclusion: The mail is relayed (or forced to be routed) through example.com. This relaying thing is not good if you sit on an open line, and therefore percenthack should only be enabled within closed and controlled networks. The percenthack is not limited to one percent-sign. Only the last percent is rewritten, and thus the address can include a whole chain of hosts that the mail should be routed through. Example 2: We set up this example routing environment host1.example.com host2.example.com +------------------+ +-----------------+ | | | | / |"uucp.example.com"+----+"int.example.com"+----+ internet | | | | \ +------------------+ +-----------------+ to show how a two-step percenthack routing is done. host1.example.com has the domain "uucp.example.com" in the control/percenthack-file and in rcpthosts. host2.example.com has the domain "int.example.com" in the control/percenthack-file and in rcpthosts. Now when a mail is sent to [EMAIL PROTECTED] (and the DNS for the sending party says that the MX for uucp.example.com is host1.example.com) then the host1.example.com removes the @uucp.example.com part and changes the last percent to a @, thus making the address now to read [EMAIL PROTECTED] which forces it to be routed to host2.example.com which handles the int.example.com mail. So, in step 2, the host2.example.com rewrites the address by removing @int.example.com and delivers the mail to [EMAIL PROTECTED] No part of this percenthack rewriting is written into the message headers; it merely looks like this: ------------ >From [EMAIL PROTECTED] Wed Oct 20 03:30:46 1999 Return-Path: <[EMAIL PROTECTED]> Delivered-To: [EMAIL PROTECTED] Received: (qmail 16667 invoked from network); 20 Oct 1999 03:30:46 -0000 Received: from host2.example.com (10.0.1.12) by mail.example.com with SMTP; 20 Oct 1999 03:30:46 -0000 Received: (qmail 10513 invoked from network); 20 Oct 1999 03:30:37 -0000 Received: from host1.example.com (10.0.1.11) by host2.example.com with SMTP; 20 Oct 1999 03:30:37 -0000 ------------------ Note that the percenthack rewriting is done before local delivery is handled. This is important if the righthand part of the newly expanded address is a domain that is handled by the current host. >From the qmail-send(8) man page: percenthack List of domain names where the percent hack is applied. If domain is listed in percenthack, any address of the form user%fqdn@domain is rewritten as user@fqdn. user may contain %, so the percent hack may be applied repeatedly. qmail-send handles percenthack before locals.
