[exim] Quota disciplne, need some help with rules

Top Page
Delete this message
Reply to this message
Author: Tomasz
Date:  
To: exim-users
Subject: [exim] Quota disciplne, need some help with rules
Hello.

I'm using Exim for virtual domains mail with system accounts.

I have a cron script that checks quota usage every minute and
creates a current list of system users that went X MB over
softquota limit for more then Y days. This is a simple file
with each username in new line:

cat /etc/mail/blocked_because_mailboxisfull
jsmith
jsmith2

What I'd like to do is to motivate these users to clean up their
mailbox (and also prevent disk usage to grow up to hardquota limit) by:

a) disabling sending new mail by that users
b) bouncing incoming mail for that users (ie for: john.smith@???, etc)

That should be quite easy but it turned out my rules
don't work as expected so I need some help with that.


Ad. a) - disable send
---------------------

I've added additional rule to acl_smtp_rcpt chain that will
deny SMTP for authenticating users, who are in the "blacklist":

  deny    message   = Sending prohibited, your mailbox is full
          condition = ${if \
                       ${lookup{$authenticated_id} \
                       lsearch{/etc/mail/blocked_because_mailboxisfull}}{1}{0}}
          authenticated = *


But it doesn't work. It logs a failed to expand ACL string, condition name
expected (?).

Q1: How should the condition look like to be correct?
Q2: Is such a rule and a place for that rule (acl_smtp_rcpt, quite high,
before many other checks) optimal for per-user SMTP prohibition?


Ad. b) - bounce incoming mail
-----------------------------

I'm not sure where this sould be checked.

Q3: If possible during RCPT? That would be perfect, but do I have
e-mail address to system username relation then?

If not, it's OK for me to accept the message and bounce it
before local delivery. I'm not good at writing routers, but
I've tried adding such:

useroverquota:
driver = redirect
local_parts = lsearch;/etc/mail/blocked_because_mailboxisfull
data = :fail: User mailbox is full
allow_fail

just before:

localuser:
driver = accept
transport = local_delivery
[...]

And this doesn't work either.

Q4: How this should be done to work as expected?


Thanks in advance for any help.
Best regards,

Tom