In certain situations, one client can cause problems for others if the accounts are not sufficiently isolated from one another on a server. Such a case is when a client's account is compromised with a malware that sends SPAM, which ultimately leads to the blacklisting of the IP through which the emails are sent.
The best approach is to immediately do whatever it takes to avoid spam emails, to clear the Exim queue of all spam emails waiting to be sent, locate all malicious code within the account, secure the account and then protect the account properly so that no more attacks occur.
In order to prevent the damage of the uncompromised accounts, the possibility of placing the domains on separate email IPs can be considered.
Or, you can consider separating clients according to mailing lists uses, type of packages used and email limits/restrictions.
This may require some configuration, regardless of the situation. Below we will show you the necessary steps for configuring this with a DirectAdmin server.
For this reason DirectAdmin uses the following files:
/etc/virtual/domainips
/etc/virtual/helo_data
You can handle this either manually, or you can allow DirectAdmin to handle it based on what IP domains are allocated.
Manage configuration of outgoing IPs manually
You can edit these files manually, then restart Exim to apply the changes. You will set the following settings for manual outgoing mail Network management in the DirectAdmin configuration (these are the same settings as when you use the default configuration of sending email from the IP of the main server)):
add_domain_to_domainips=0
domainips_default_ip=
For example, let's say 1.2.3.4 is your secondary IP and from now on you plan to use your secondary IP as outgoing mail Address.
The domainips file currently does not exist because domainips_default_ip= is empty in the directadmin.conf file and add_domain_to_domainips is set to 0.
We will create the domainips file as follows:
*:1.2.3.4
Restart Exim. And now you can send email from the secondary IP IP 1.2.3.4.
For more complex configuration with a fallback IP, a /etc/virtual/domainips file will contain the following:
*:1.2.3.4
domeniu1.com:1.2.3.5
domeniu2.com:1.2.3.5
where domain1.com and domain2.com will use 1.2.3.5 and all other domains will use 1.2.3.4.
The helo SMTP command can be configured in a similar way so that Exim headers are different depending on the connected IP.
Based on the example, the helo_data file would be:
1.2.3.4:mail.domain1.com
1.2.3.5:mail.domain2.com
The IPs on the left must be unique, except that the add_domain_to_domainips is set to 2 in directadmin.conf
Always restart Exim for changes to apply!
Enable DirectAdmin to handle these files
Also, there is the possibility to allow DirectAdmin to manage these files, but this requires that each domain sends from its assigned IP (for any domain created with an IP that is not the server IP). Helo_data will only receive IPs already allocated. This configuration requires the following modification in the directadmin.conf file:
add_domain_to_domainips=1
You can set an IP to fallback, too.If you want to specify a different fallback IP address than your server's primary IP, you can set the variable in directadmin.conf:
domainips_default_ip=1.2.3.4
Run the following commands to configure this. Replace 1.2.3.4 with the fallback IP you'd like to use:
/usr/local/directadmin/directadmin set add_domain_to_domainips 1
/usr/local/directadmin/directadmin set domainips_default_ip 1.2.3.4 restart
DirectAdmin will rewrite these Exim configuration files, since it will be managing them for you:
echo "action=rewrite&value=domainips" >> /usr/local/directadmin/data/task.queue
echo "action=rewrite&value=helo_data" >> /usr/local/directadmin/data/task.queue
Finally, confirm that data has been written to these files (these files do not exist by default) and restart Exim.
service exim restart
\\
Important!
Reconfigure your SPF and PTR records to ensure that they are set to use the correct IP(s)!
If you encounter any problems in applying the above instructions please contact us. HostX offers the fastest VPS KVM servers and can offer you specialized assistance in DirectAdmin administration.
