Hello,
And when I blocked smtp from localhost (via iptables), just like you wrote, webmail stop working. So, even if I succeeded in forcing auth smtp in exim, I lost webmail capability.
I didn't indicate to block SMTP from localhost to my knowledge, since blocking SMTP (port 25, I would imagine you mean here) in iptables from localhost will prevent sending emails. SMTP is the sending mechanism for accounts locally. On the other hand, I did mention to remove sendmail (not SMTP) from being used. Also, I mentioned that removing localhost from allowing it to relay would possibly break webmail as well.
What you are probably really trying to do is to prevent spoofing, since that's the issue here rather than sending after authenticating via localhost (any script that is on an account is authenticated after all). There's a difference between spoofing and relaying (localhost has authenticated whether by logging into an account or being a script on an authorized account).
You can prevent spoofing on webmail itself by using the following type of rule:
Code:
acl_check_data:
deny
authenticated = *
condition = ${if or {{ !eqi{$authenticated_id} {$sender_address} }\
{ !eqi{$authenticated_id} {${address:$header_From:}} }\
}\
}
message = Your FROM must be as the account you have authenticated with, your email is not delivered.
This would go into the box where it has
begin acl directly about it (the second box in the Advanced Editor) and should prevent spoofing via webmail. If you want to prevent not authenticating for scripts and force SMTP authentication for those scripts, you would need to revoke sendmail as I already stated earlier.
If you do not want to remove sendmail, you can instead try adding additional logging and preventative measures such as these options:
1. WHM > Tweak Settings:
Prevent “nobody” from sending mail [?]
Prevent the user “nobody” from sending out mail to remote addresses
(PHP and CGI scripts generally run as “nobody” if you are using mod_php or have Suexec disabled.)
If you are using DSO for the PHP handler, this option is not advised. You can see in WHM > Apache Configuration > PHP and SuExec Configuration area which PHP handler is being used on the machine.
2. WHM > Exim Configuration
Set the Sender: Header when the mail sender changes the sender (-f flag passed to sendmail).
3. WHM > Exim Configuration > Advanced Editor
Add the following in the topmost box:
This adds extra logging to /var/log/exim_mainlog file such as subject and command path.
4. WHM > EasyApache (Apache Update)
Step 6, Exhaustive Options List in the PHP section (PHP 4 and/or PHP 5) > MailHeaders
For information on this option, please see
CHOON.NET : Resources : Scripts & Patches : PHP Mail Header Patch
Thanks.