We are using Exim servers as a filter for a cPanel host.

It took some digging, but we finally solved a big issue: How to get list of all cPanel recipients to Exim and what to do with that list when we get it there.

1) On cPanel, we use cron to run following bash script:
#!/bin/bash
find /etc/valiases/* -type f | xargs -ifile sed -e 's/:.*//' file > /usr/src/getAllEmail.txt

ls -d /home/*/mail/*/*/ | awk 'BEGIN { ; } ; { ; tcmd = "test -d " $1 ; if(!system(tcmd)){ ; split($1,MyArray,"/") ; print MyArray[6] "@" MyArray[5] ; } ; }' >> /usr/src/getAllEmail.txt

sed -i -e 's/*.*//' /usr/src/getAllEmail.txt
sed -i '/^\s*$/d' /usr/src/getAllEmail.txt

2) getAllEmail.txt then gets moved to a secure ftp directory

3) the spam filter drops getAllEmail.txt in /etc/exim

4) Line 3 of acl_check_rcpt performs the magic
acl_check_rcpt:
  accept hosts = lsearch;/etc/exim/whitelist
  accept hosts = :
  require recipients = lsearch;/etc/exim/getAllEmail.txt
  deny local_parts = ^.*[@%!/|] : ^\\.

  deny message   = HELO Policy Restriction: HELO is not an FQDN.
     condition = ${if match{$sender_helo_name}{\N^\[\N}{no}{yes}}
     condition = ${if match{$sender_helo_name}{\N[^.]\N}{no}{yes}}

deny message = rejected because $sender_host_address is in a black list at $dnslist_domain\n$dnslist_text dnslists = zen.spamhaus.org/<;$sender_host_address;$sender_address_domain :\ bl.spameatingmonkey.net : bl.mailspike.net : dnsbl.sorbs.net : b.barracudacentral.org : bb.barracudacentral.org : psbl.surriel.com : \
       cidr.bl.mcafee.com : hostkarma.junkemailfilter.com=127.0.0.2

  accept domains = +relay_to_domains
         endpass
         message = relay not permitted at this server
         verify = recipient

  accept hosts = +relay_from_hosts

  deny message = REJECTED - Sender Verify Failed and no RDNS
       !verify = reverse_host_lookup
       !verify = sender/callout=2m,defer_ok
       !senders = +whitelist_senders
       !condition =  ${if eq{$sender_verify_failure}{}}

I hope this helps someone. 99% of above was provided by Google, I put it together.

--
John Schmerold
St Louis

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to