Rewrite From: header to match actual sender for 1 domain?

Benjamin D.

Well-Known Member
Jan 28, 2016
133
19
68
Canada
cPanel Access Level
Root Administrator
I've been using WHM > Exim Configuration Manager > "EXPERIMENTAL: Rewrite From: header to match actual sender" for years. It works quite good in disabling most of the inbound to outbound spoofing done by malicious scripts (and users?!)

I'm now trying to accommodate a new client that has an Exchange Server and that thing smells like sh** from a mile away. It basically cannot send emails with anything else than a single username, effectively rendering that thing dependent on a semi-open email relaying host, which I'm not. What I mean is Exchange relies on the fact that a single username, say [email protected] is supposed to be able to relay emails as [email protected], [email protected], [email protected] all with the same account.

The "Rewrite From: header" functionality breaks this retarded Exchange technology, so what we are now looking for a way to make that rule specific to some domains or selectively ignoring some domains as a way to accommodate this client... or I'll lose him and lose the money that goes with it.

Anybody can help? Thx
 

Benjamin D.

Well-Known Member
Jan 28, 2016
133
19
68
Canada
cPanel Access Level
Root Administrator
Anybody? I'm looking maybe for a generic exim config rewrite rule to put after the "begin rewrite" line.

REWRITE RULE CONDITIONS I NEED:

1) PHP scripts cannot forge FROM headers as an account's domain the script does not originate from. This is already achieved by cPanel's "Rewrite From Header" tweak.

2) External SMTP users can only forge FROM headers as the account's domain they authenticated with, meaning they could send FROM [email protected]. This is against cPanel's "Rewrite From Header" tweak.

So I need a combination/adaptation of cPanel's tweak to allow for the 2 conditions at once.

ANY HELP IS APPRECIATED and could be beneficial to potentially thousands of other web server owners who are looking for the same solution.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Ended up writing my own Perl script and annexing it to WHM's "Rewrite From: header" tweak. Problem solved.
Hello,

I'm glad to see you were able to find a suitable solution. Feel free to share the Perl script here if you'd like, as it may help other users facing the same situation.

Thanks!
 

Benjamin D.

Well-Known Member
Jan 28, 2016
133
19
68
Canada
cPanel Access Level
Root Administrator
I'll think about it. I'm not very impressed with the license fees I'm continually paying and yet having to actually learn how to code Perl and spend 2 hours to develop what looks like, to me, quite mandatory functionality lacking in WHM.