[exim] Reject messages to users with low UID

Top Page
Delete this message
Reply to this message
Author: Marc Haber
Date:  
To: exim-users
Subject: [exim] Reject messages to users with low UID
Hi,

I would like to make it easily configurable in the Debian packages to
reject messages to local accounts with UID below a certain border. I
also would like to have the possibility to define exceptions for this
rule.

This is what I built:

|FIRST_USER_UID = 500
|
|lowuid_aliases:
|  debug_print = "R: lowuid_aliases for $local_part@$domain (UID $local_user_uid)"
|  check_local_user
|  driver = redirect
|  allow_fail
|  domains = +local_domains
|  condition = "${if <{$local_user_uid}{FIRST_USER_UID}\
|                       {1}{0}}"
|  data = "${if exists{/etc/exim4/lowuid-aliases}\
|             {${lookup{$local_part}lsearch{/etc/exim4/lowuid-aliases}}}\
|             fail}"
|  redirect_router = lowuid_target

|
|lowuid_reject:
|  debug_print = "R: lowuid_reject for $local_part@$domain (UID $local_user_uid)"
|  check_local_user
|  driver = redirect
|  allow_fail
|  domains = +local_domains
|  condition = "${if <{$local_user_uid}{FIRST_USER_UID}\
|                       {1}{0}}"
|  data = ":fail: no mail to system accounts"

|
|lowuid_target:
| condition = 0
| driver = redirect
| data = ":fail:"


I don't particularly like that it took me three routers to accomplish
this. The first router handles a special alias file as exception rule,
and, if an exception is found, continues processing with the target
router which is configured to always decline. If no exception is
configured, the lowuid_reject router issues the reject.

Can this be done a little more elegant and a little less clumsy?

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber         |   " Questions are the         | Mailadresse im Header
Mannheim, Germany  |     Beginning of Wisdom "     | http://www.zugschlus.de/
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834