We have an anti-spam system that sometimes create false-positives. When reported, we verify and whitelist the domains or IPs that have been wrongly triggered. However, I'd like to automate this by making a script that do the following when someones from our server sends a message:
-> if the sender is hosted on our server -> grab the sender and recipient -> type the command 'spfbl superwhite add "recipient@domain.tld>sender@domain.tld" '.
Its very important that the system filters only senders hosted on our cPanel servers (so we may use the /etc/localdomains file).. but I have no idea on how to start this.
Anyone have any ideas?
Much appreciated.
UPDATE
I've managed to do that with the script provided by kondybas with some changes:
Section: PREROUTERS
whitelister:
driver = accept
domains = !+local_domains
condition = ${if match_domain{$sender_address_domain}{+local_domains}}
transport = whlist
no_more
-
Section: TRANSPORTSTART
whlist:
driver = pipe
command = /var/spool/exim/autoWH $local_part@$domain
And the /var/spool/exim/autoWH file:
#!/bin/sh
# Debug:
echo "Args recebidos: \$1 = $1" >> /var/spool/exim/log-transport.log
# Magica:
/var/spool/exim/spfbl.sh white sender $1
####
Everything in exim owned folder so I dont have permissions problems.
Oops.. problem: using those parameters, exim is not delivering the mail as its trying to make a localdelivery: local delivery failed