[exim] How to enforce valid From: header on local mail?

Top Page
Delete this message
Reply to this message
Author: m. allan noah
Date:  
To: exim-users
Subject: [exim] How to enforce valid From: header on local mail?
Hello- have a question about header rewriting in Exim, which I have
spent a couple days trying to solve.

I need to make sure that all locally generated email (from
/usr/sbin/sendmail or from localhost via smtp) has a proper From:
header. Basically trying to prevent outgoing spoofs from our
(relatively untrusted) users. I would prefer to use perl, since some
of the checks for validity (aliases, etc) are kinda complicated.

So, I have tried adding headers_rewrite to a transport, or setting up
a rule in the global rewrite section of exim.conf. Something like:

*@* ${perl{foo}{$1}{$2}{$sender_host_address}} f

Where my function foo() returns a 'corrected' address for local hosts.
I think I can cover all the corner cases to make that work reasonably.
Unfortunately, it does not seem to work if there is no From header in
the mail.

So, my question is this: How can I detect that no From header has been
sent, and add one? Or, is it possible to have a perl function receive
all the headers at once, and make this determination?

Thanks for any help you can provide.

allan
--
"The truth is an offense, but not a sin"