Exim Policy Daemon
The primary purpose of this daemon is to allow Exim to call out to check a user's quota so Exim can reject at SMTP time, as opposed to accepting the email and trying to generate a bounce (to the usually spoofed sender address).
-
Put the exim-policyd.sysconfig file in /etc/sysconfig, renaming it to /etc/sysconfig/exim-policyd. Adjust contents to suit your requirements.
-
Put the exim-policyd.init file in /etc/init.d, renaming it to /etc/init.d/exim-policyd.
-
Put the exim-policyd script in /usr/local/bin.
-
Enable the service to start at boot:
chkconfig --add exim-policyd
-
Create log and pid directories:
mkdir /var/log/helper /var/run/helper
-
Change ownership of the directories to the user the daemon is configured to run as (default "vmail"):
chown vmail: /var/log/helper /var/run/helper
-
Start it with:
service exim-policyd start
-
Test like this with a valid user and domain:
$ telnet localhost 8049
SHOW_QUOTA todd example.com
using=1804761 limit=1073741824 available=1071937063
QUIT
- Define this macro in the global section of your exim.conf:
OVERQUOTA_CHECK = ${readsocket{inet:localhost:8049}{CHECK_QUOTA $local_part $domain}}
- Put this in the RCPT acl, somewhere before your normal accept:
defer domains = +local_domains
verify = recipient
condition = ${if eq{OVERQUOTA_CHECK}{1} {yes}{no}}
message = The mailbox for $local_part@$domain is full, deferring.
log_message = Recipient mailbox is full, deferring.
You will see a log line that looks like this (line breaks added by me):
2014-08-31 17:56:31 H=(remote.bilboesgold.co.zw) [197.221.231.110] X=TLSv1:AES128-SHA:128
F=<[email protected]> temporarily rejected RCPT <[email protected]>:
Recipient mailbox is full, deferring.