Friday, August 24, 2007

Bind Exim to a different IP address

Issue : How to bind Exim to a different IP address on Linux server ?

Resolution:

# vi /etc/exim.conf

Inside both incoming and outgoing you will need to add an interface like so:

find
remote_smtp:
driver = smtp

inside:

/etc/exim_outgoing.conf
/etc/exim.conf

and add interface =

example:

=========================
remote_smtp:
driver = smtp
interface = 22.22.22.22
=========================

But you will need to make sure that the ip address should be binded on the server already.

Reminder: If there is an exim update when you upgrade your cpanel you will need to re-enter the interface again

The thing is cpanel uses SMTP auth. and POP3 before SMTP. If you receieve an email via POP it puts your IP into

# /etc/relayhosts

and you can send emails without any authentication for 30 minutes.

To make sure just empty the file /etc/relayhosts and try to send a test email with SMTP auth. turned OFF in your browser. It won't allow you to send.


Issue : How to bind Sendmail to a different IP address on Linux server ?

Resolution:


You may prevent Cpanel from overwriting your exim conf file by chattrib the config itself:
chattr +e /etc/exim.conf

To "unprotect" the file use:
chattr -e /etc/exim.conf

This way the file is protected even with permissions set to 755.
However this method may be problematic with Cpanel upgrades. If possible use Exim editor in

Service Configuration >> Exim Configuration Editor >> Switch to advanced mode. But it is true that you can not enter values for remote_smtp.

If you would like to bind listening interface to certain IP address open /etc/exim.conf and add this line at the beginning of conf file:

local_interfaces = xxx.xxx.xxx.xxx : xxx.xxx.xxx.xxx

You can add more IP address, delimit them with a ":"

If you would like to limit from which IP you are sending mail add to conf file, just under:

begin transports
remote_smtp:
driver = smtp
interface = xxx.xxx.xxx : xxx.xxx.xxx.xxx

cPanel overwrites custom modiffications so change those custom rules in

WHM >> Service Configuration >> Exim Configuration Editor

Open "Advanced Editor" and add in first edit field under

"#!!# cPanel Exim 4 Config":

local_interfaces = xxx.xxx.xxx.xxx : xxx.xxx.xxx.xxx

=======================================================================