[Exim] director conditional on sender being in local domain …

Top Page
Delete this message
Reply to this message
Author: Simeon
Date:  
To: exim-users
Subject: [Exim] director conditional on sender being in local domain or recipient being in a list
Hi,

We are using Exim 3.35 (Debian) on a machine which is
a mail hub for our school. It relays mail for the
servers on our LAN.

We are using directors to direct mail for particular
user accounts to the correct servers.

Our directors look like this:

staff_director:
driver = smartuser
local_parts = lsearch; /root/email/staff
domains = ourdomain.org
transport = staff_transport

pupils1_director:
driver = smartuser
local_parts = lsearch; /root/email/pupils1
domains = ourdomain.org
transport = pupils1_transport


The files /root/mail/pupils1 and /root/mail/staff
contain lists of users on each host.


The transports look like:

staff_transport:
driver = smtp
hosts = staff.ourdomain.org
hosts_override = true
gethostbyname

pupils1_transport:
driver = smtp
hosts = pupils1.ourdomain.org
hosts_override = true
gethostbyname




This works fine and we do it for all 7 of our servers.
Mail is correctly directed to the correct
servers/hosts.

Now the problem:

I need to change the set up so that pupils can only
receive mail from ourdomain.com (not the whole
internet). Some pupils will need to be given the
privilige of being able to receive email from the
Internet.    So I want the mail hub to only relay mail
to pupils1.ourdomain.org if the sender is from
ourdomain.org or the (pupil)recipient's user account
name  is in a list.



Basically, I think that the director pupils1_director
should only direct mail to the pupils1.ourdomain.org
host:

 if ((recipient account name is in /root/email/pupils1
list) AND (sender = *.ourdomain.org))    OR
((recipient account name is in /root/email/pupils1
list) AND (recipient account name/address is in
/root/email/allowed_to_receive_non_school_email))



Assuming that the local_parts = lsearch;
/root/email/pupils1 doesn't need to be changed then I
guess the condition can be reduced to:

hub should relay to pupils1
if (sender=*.ourdomain.org) OR (recipient account
name/address is in
/root/email/allowed_to_receive_non_school_email)


Don't have any idea how to write this as a regular
expression for exim.
Can anyone help me with this?
I think it may be just (?!!!) a case of writing my
condition above as a regular expression and putting it
in the director as a condition line?

Many thanks for any help.



**Stopping the non-authorised pupils sending email to
the internet was  easy following the info in the Exim
FAQ
lookuphost:
  driver = lookuphost
  transport = remote_smtp
  senders = :^[^@]+@(?!${rxquote:ourdomain.org}\$):\
    lsearch;/root/email/allowed_external


________________________________________________________________________
Want to chat instantly with your online friends? Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/