To run exim with mailscanner you need 2 configuration files one for the daemon that will listen on port 25 and accept incoming mail and another for the exim process that will deliver the clean mail that has been scanned by mailscanner. You also require 2 queues one for incoming and the other for clean mail that has been scanned.
I will not dwell on all the configuration options that exim provides i expect that you will be able to get detailed info else where on how to configure an normal running exim system so i will only focus on those areas that are specific to this setup.
#> cp /etc/exim/exim.conf /etc/exim/exim.conf.orig #> cp /etc/exim/exim.conf /etc/exim/exim_out.conf
This is the configuration for the exim daemon that listens on port 25 and accepts the messages and queues them for mailscanner to process. The configuration file is /etc/exim/exim.conf
av_scanner = clamd:/var/run/clamav/clamd.sock
# example /etc/exim/relay_domains example.com
domainlist relay_to_domains = lsearch;/etc/exim/relay_domains
#example /etc/exim/mail-routes example.com: xxx.xxx.xxx.xxx:xxx.xxx.xxx.xxx #this domain is on a CGP cluster of 2 front end nodes somedomain.com: xxx.xxx.xxx.xxx # this delivers to one CGP machine
deliver_clean:
driver = manualroute
domains = +relay_to_domains
transport = remote_smtp
route_data = ${lookup{$domain}lsearch{/etc/exim/mail-routes}}
spool_directory = /var/spool/exim.in process_log_path = /var/spool/exim/exim-process.info queue_only = true queue_only_override = false
# mkdir /var/spool/exim.in # chown exim.exim /var/spool/exim.in
drop message = REJECTED because $sender_host_address is in a black list spamhaus.org
dnslists = zen.spamhaus.org
drop message = REJECTED because $sender_host_address is in a black list at $dnslist_domain\n$dnslist_text
dnslists = bl.spamcop.net
drop message = REJECTED because $sender_host_address is in a black list at $dnslist_domain\n$dnslist_text
dnslists = dnsbl.sorbs.net
drop message = REJECTED - We don't accept messages from hosts without reverse DNS
log_message = No reverse DNS
domains = ! lsearch;/etc/exim/checks_exempt_hosts
!verify = reverse_host_lookup
!verify = sender/callout=2m,defer_ok
!condition = ${if eq{$sender_verify_failure}{}}
drop message = REFUSED - no HELO/EHLO greeting
log_message = remote host did not present greeting
condition = ${if def:sender_helo_name {false}{true}}
deny ratelimit = 250 / 15m / strict
message = You can only send $sender_rate per $sender_rate_period
log_message = RATE: $sender_rate/$sender_rate_period (max $sender_rate_limit)
accept
smtp_accept_max_nonmail = 30 smtp_max_unknown_commands = 1
pipelining_advertise_hosts = 127.0.0.1
This users the router check_backend to communicate with your communigate pro system via ldap to ensure that an address exists before accepting mail for that address.
ldap_default_servers = xxx.xxx.xxx.xxx
# example /etc/exim/catchall_domains somedomain.com
domainlist domains_with_catchall = lsearch;/etc/exim/catchall_domains
#example /etc/exim/ldap-domains example.com: example.com example.co.za: example.com
check_backend:
driver = redirect
domains = ! +domains_with_catchall : +relay_to_domains
allow_fail
allow_defer
forbid_file
forbid_pipe
data = ${lookup ldap{ldap:///uid=${local_part},cn=${lookup{$domain}lsearch{/etc/exim/ldap-domains}}?mail}{$value}{:fail: Unknown user}}
#version 5.x use this instead
data = ${lookup ldap{ldap:///cn=${lookup{$domain}lsearch{/etc/exim/ldap-domains}}?uid?sub?(uid=$local_part)}{$local_part@$domain}{:fail: User Unknown}}
This is the configuration that is used to deliver the clean mail that mailscanner has already scanned. The configuration file is /etc/exim/exim_out.conf. For this you can use the default configuration with all the checks and acls taken out.
You need to add this router to deliver the cleaned mail to the actual CGP servers. If you are running a cluster, this router is capable of spreading the deliveries across the servers that you have configured in /etc/exim/mail-routes making it fully redundant.
deliver_clean:
driver = manualroute
domains = +relay_to_domains
transport = remote_smtp
hosts_randomize = true
route_data = ${lookup{$domain}lsearch{/etc/exim/mail-routes}}