How to set up smarthost for a single domain in exim mail...

How to set up smarthost for a single domain in exim mail server

by -
0 1100

How to set up smarthost for a single domain in exim mailserver.

As per one our client requirement. I had to set up smarthost for single domain in exim. I have googled and took some support from Cpanel support forum. Finally I have done in our exim server.

 

Prerequisites:

1:- client exim server IP(44.252.91.161) Should be relayed in smarthost server.

2:- Our smarthost server IP 77.86.3.242 (mail.jingleonfo.com)

 

Steps:- 1

Login client exim server.

root@ns1 [~]# vim /etc/smarthosts
mail.jingleinfo.com

root@ns1 [~]# vim /etc/staticroutes
6987.in: mail.jingleinfo.com

step:-2

First, put this in the @CONFIG@ section of /etc/exim.conf.local:

root@ns1 [~]# vim /etc/exim.conf.local
hostlist smart_hosts = lsearch;/etc/smarthosts

#Then, put this in @ROUTERSTART@ section.

root@ns1 [~]# vim /etc/exim.conf.local

smarthost_dkim:
driver = manualroute
domains = !”+local_domains +smart_hosts”
condition = “${if eq{${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}{$value}}}{}{false}{true}}”
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 43.252.91.0/24
headers_add = “${perl{mailtrapheaders}}”
require_files = “+/var/cpanel/domain_keys/private/${sender_address_domain}”
transport = remote_smtp_smart_dkim
route_list = !+local_domains “${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}}”

smarthost_regular:
driver = manualroute
domains = !”+local_domains +smart_hosts”
condition = “${if eq{${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}{$value}}}{}{false}{true}}”
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 43.252.91.0/24
headers_add = “${perl{mailtrapheaders}}”
transport = remote_smtp_smart_regular
route_list = !+local_domains “${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}}”

Step:-3

Then, this in put below line  @TRANSPORTSTART@: section.

root@ns1 [~]# vim /etc/exim.conf.local
remote_smtp_smart_dkim:
driver = smtp
hosts_require_tls = *
interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
dkim_domain = $sender_address_domain
dkim_selector = default
dkim_private_key = “/var/cpanel/domain_keys/private/${dkim_domain}”
dkim_canon = relaxed

remote_smtp_smart_regular:
driver = smtp
hosts_require_tls = *
interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}

Step:- 4

Run below command to rebuild exim.conf.

root@ns1 [~]# /scripts/buildeximconf

root@ns1 [~]#  service exim restart

root@ns1 [~]# tail -f  /var/log/exim_mainlog | grep “gopal”
2015-10-19 17:51:36 1Zo9RY-0000mH-Ho <= gopal@6987.in H=(kvit.in) [127.0.0.1]:46147 P=esmtpa A=dovecot_login:gopal@6987.in S=546 id=b73fa5407f13d30449d087add12ee066@6987.in T=”test” for linuxprabhat@gmail.com
2015-10-19 17:51:36 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1Zo9RY-0000mH-Ho
2015-10-19 17:51:38 1Zo9RY-0000mH-Ho [77.86.3.242]] SSL verify error: depth=0 error=self signed certificate cert=/CN=ns1.linuxdnhost.com/emailAddress=ssl@ns1.linuxdnhost.com
2015-10-19 17:51:38 1Zo9RY-0000mH-Ho [77.86.3.242] SSL verify error: certificate name mismatch: “/CN=ns1.linuxdnhost.com/emailAddress=ssl@ns1.linuxdnshost.com”
2015-10-19 17:51:40 1Zo9RY-0000mH-Ho => linuxprabhat@gmail.com R=smarthost_dkim T=remote_smtp_smart_dkim H=jingleinfo.com [77.86.3.242] X=TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256 CV=no C=”250 OK id=1Zo9Rb-0000IP-Bn”

Senior Linux Administrator at KV IT-Solutions Pvt Ltd || A Linux Lover || having 4 years of experience || Handling various Linux projects || Email ID : prabhat@kvit.in || cell: 9818001497

“We are born free, No gates and Windows can snatch our freedom “

Download PDF

NO COMMENTS

Leave a Reply

Required Captcha *