To whitelist an IP address in Exim, you can modify its configuration to allow connections from a specific IP address without restrictions.

Exim is a powerful and flexible mail transfer agent (MTA) used on Unix-like operating systems. It’s highly configurable and widely used for sending, receiving, and routing emails.

Here’s how you can do it:

whitelist an IP address in Exim

Step 1: Edit Exim Configuration

  1. Locate the Exim configuration file, usually found at:
    • /etc/exim/exim.conf
    • /etc/exim4/exim4.conf.template (Debian-based systems)
    • /etc/exim.conf (older installations)
  2. Open the configuration file for editing with a text editor:
sudo nano /etc/exim/exim.conf

Step 2: Add the Whitelisted IP

You can whitelist an IP address in Exim using an ACL (Access Control List).

Locate the ACL section, which typically starts with:

begin acl

Look for the acl_check_rcpt section, which processes recipient restrictions.

Add a condition at the top of acl_check_rcpt to accept the whitelisted IP. Example:

accept hosts = <IP_ADDRESS>

Replace <IP_ADDRESS> with the IP you want to whitelist. For example:

accept hosts = 192.168.1.100

Step 3: Restart Exim

After saving the changes, restart Exim to apply the new configuration:

sudo systemctl restart exim

Optional: Use a File for IP Whitelisting

If you have multiple IPs to whitelist, it’s easier to manage them in a separate file.

1.Create a whitelist file:

sudo nano /etc/exim/whitelist_ips

2.Add the IP addresses (one per line):

192.168.1.100
203.0.113.25

3.Modify the Exim configuration to reference this file:

accept hosts = +whitelist_ips

4.Add the whitelist to the hosts configuration:

hostlist whitelist_ips = /etc/exim/whitelist_ips

Save and restart Exim:

sudo systemctl restart exim

Testing the Configuration

Send a test email or attempt a connection from the whitelisted IP to confirm it’s allowed.

Troubleshooting

  • Check Exim logs for errors:
sudo tail -f /var/log/exim/mainlog
  • Ensure the IP you added is correctly formatted.
  • Verify no conflicting rules override the whitelist.

I hope above article clarifies how to whitelist an IP address in Exim configuration.

Let me know if you need further assistance!

To know how to allow IP’s using host access control in WHM click here.