|
|
A.11. Adding Envelope Sender SignaturesHere we implement Envelope Sender Signature in our outgoing mail, and check for these signatures before accepting incoming "bounces" (i.e. mail with no envelope sender). The envelope sender address of outgoing mails from your host will be modified as follows:
However, because this scheme may produce unintended consequences (e.g. in the case of mailing list servers), we make it optional for your users. We sign the envelope sender address of outgoing mail only if we find a file named ".return-path-sign" in the sender's home directory, and only if the domain we are sending to is matched in that file. If the file exists, but is empty, all domains match. Similarly, we only require the recipient address to be signed in incoming "bounce" messages (i.e. messages with no envelope sender) if the same file exists in recipient's home directory. Users can exempt specific hosts from this check via their user specific whitelist, as described in Exempting Forwarded Mail. Also, because this scheme involves tweaking with routers and transports in addition to ACLs, we do not include it in the Final ACLs to follow. If you are able to follow the instructions pertaining to those sections, you should also be able to add the ACL section as described here. A.11.1. Create a Transport to Sign the Sender AddressFirst we create an Exim transport that will be used to sign the envelope sender for remote deliveries:
The "local part" of the sender address now consists of the following components, separated by equal signs ("="):
If you need authentication for deliveries to "smarthosts", add an appropriate hosts_try_auth line here as well. (Take it from your existing smarthost transport). A.11.2. Create a New Router for Remote DeliveriesAdd a new router prior to the existing router(s) that currently handles your outgoing mail. This router will use the transport above for remote deliveries, but only if the file ".return-path-sign" exists in the sender's home directory, and if the recipient's domain is matched in that file. For instance, if you send mail directly over the internet to the final destination:
Or if you use a smarthost:
Add other options as you see fit (e.g. same_domain_copy_routing = yes), perhaps modelled after your existing routers. Note that we do not use this router for mails with no envelope sender address - we wouldn't want to tamper with those! [2] A.11.3. Create New Redirect Router for Local DeliveriesNext, you need to tell Exim that incoming recipient addresses that match the format above should be delivered to the mailbox identified by the portion before the first equal ("=") sign. For this purpose, you want to insert a redirect router early in the routers section of your configuration file - before any other routers pertaining to local deliveries (such as a system alias router):
Recipient addresses that contain a equal sign are rewritten such that the portion of the local part that follows the equal sign are stripped off. Then all routers are processed again. A.11.4. ACL Signature CheckThe final part of this scheme is to tell Exim that mails delivered to valid recipient addresses with this signature should always be accepted, and that other messages with a NULL envelope sender should be rejected if the recipient has opted in to this scheme. No greylisting should be done in either case. The following snippet should be placed in acl_rcpt_to, prior to any SPF checks, greylisting, and/or the final accept statement:
You will have an issue when sending mail to hosts that perform callout verification on addresses in the message header, such as the one provided in the From: field of your outgoing mail. The deny statement here will effectively give a negative response to such a verification attempt. For that reason, you may want to convert the last deny statement into a warn statement, store the rejection message in $acl_m0, and perform the actual rejection after the DATA command, in a fashion similar to previously described:
Also, even if the recipient has chosen to use envelope sender signatures in their outgoing mail, they may want to exempt specific hosts from having to provide this signature in incoming mail, even if the mail has no envelope sender address. This may be required for specific mailing list servers, see the discussion on Envelope Sender Signature for details. Notes
|