rss logo

How To : Set Exim as a Relay for Exchange Online

Configuration

Intro

Here is a way to set exim as a relay for Exchange Online

Settings

Add Exchange Online user and password

cat /etc/exim4/passwd.client
# password file used when the local exim is authenticating to a remote
# host as a client.
#
# see exim4_passwd_client(5) for more documentation
#
# Example:
### target.mail.server.example:login:password
*:user@shebangthedolphins.net:Password

Set Exim configuration

dc_eximconfig_configtype='smarthost'
smarthost='shebangthedolphins.net'
dc_other_hostnames=''
dc_readhost=''
dc_relay_domains='*'
dc_minimaldns='false'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='false'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
dc_local_interfaces=''
dc_smarthost='smtp.office365.com:587'
dc_relay_net='192.168.0.59;192.168.0.221;192.168.0.48' #Normally only allow this IPs but doesn't seems to work. So use netfilter (see under).

Run

root:~# update-exim4.conf

Set netfilter rules to limit access

iptables -t filter -F
iptables -t filter -A INPUT -s 192.168.0.59 -p tcp --dport 25 -j ACCEPT
iptables -t filter -A INPUT -s 192.168.0.221 -p tcp --dport 25 -j ACCEPT
iptables -t filter -A INPUT -s 192.168.0.48 -p tcp --dport 25 -j ACCEPT
iptables -t filter -A INPUT -s 192.168.0.0/24 -p tcp --dport 25 -j REJECT
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address