Hi,
We are currently migrating to cPanel and consequently Exim. We use Postini for mail filtering services, and only want to allow incoming mail from Postini. We could have firewalled off port 25 when we turned on Postini, but this would have caused a large headache for our users who are still using port 25 for SMTP authentication.
Our solution is to have Exim check the following criteria at time of the RCPT command:If the host does not meet any of the above criteria, the RCPT command is rejected with the following message: "relay not permitted, authentication required."
- Is the IP in relay_hosts?
- Is the IP in our new custom table, postini_hosts?
- Is this host/user authenticated?
Here's how to accomplish this through WHM.
Go to WHM -> Service Configuration -> Exim Configuration Editor -> Advanced Editor.
Paste in the below changes and click Save.
Note: I open these kinds of files in an external editor, so it's easiest for me to post my changes to the default exim.conf in universal diff format so there's no room for error/confusion.
That's it. Please let me know if you have any questions.Code:--- exim.conf.local.orig 2009-07-31 16:00:24.000000000 -0400 +++ exim.conf.local 2009-07-31 16:39:11.000000000 -0400 @@ -9,6 +9,7 @@ # DO NOT ALTER THIS BLOCK ######################################################################################## + acl_mail: # ignore authenticated hosts @@ -35,6 +36,9 @@ [% ACL_NOTQUIT_BLOCK %] +# lookup table for postini hosts +postini_hosts = lsearch;/etc/postini_hosts + #!!# ACL that is used after the RCPT command check_recipient: # Exim 3 had no checking on -bs messages, so for compatibility @@ -78,9 +82,17 @@ deny hosts = ! +senderverifybypass_hosts ! verify = sender/callout=60s - accept hosts = * + #accept hosts = * + # authenticated = * + +# to restrict port 25 to Postini and authenticated users only + accept hosts = +auth_relay_hosts : +relay_hosts : +postini_hosts + condition = ${if eq {$interface_port}{25} {yes}{no}} + endpass + message = relay not permitted, authentication required authenticated = * + #if they poped before smtp we just accept accept condition = ${if match_ip{$sender_host_address}{iplsearch;/etc/relayhosts}{1}{${if eq{$sender_host_address}{127.0.0.1}{1}{0}}}} add_header = ${if exists{/etc/eximpopbeforesmtpwarning}{${perl{popbeforesmtpwarn}{$sender_host_address}}{}}



LinkBack URL
About LinkBacks
Reply With Quote








