[Exim] Building a MySQL-based selective relay -- problems/de…

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Erik Jacobs
Data:  
Para: exim-users
CC: ralvarez
Assunto: [Exim] Building a MySQL-based selective relay -- problems/decisions/terrified
Greetings ladies and gents,

I'm trying to build a selective relay with Exim for a project I'm doing, but
it's a little strange, maybe.

Here is the overview:
Each user has a "whitelist" of acceptable other users to get mail from.
For example: Fred can receive mail from Sue and John. Sue can receive mail
from Fred. John can receive mail from Sue... and so on and so forth.

This information is stored in a mysql database. The allowed users are
stored in a single text field and concatenated by commas.

Essentially, I want nothing to be stored on the exim server. Mail comes in,
gets checked against the whitelist, and goes out. If it doesn't match on
the whitelist, the mail just dies (no bounce required).

Here is my problem:
I can't seem to figure out how to write the routers I want. I haven't even
gotten up to the transport part yet. Basically, I think I need very few
routers.

Here are my questions:
1) Inside a router, can you assign a new variable name randomly? It seems
that every time you try and talk to SQL or perform an action, the result is
stored in $value, and I don't want to keep over writing it.
2) I need to effectively perform two manipulations. The first is pulling
the allow_emails data from the mysql database according to the recipient.
The second is checking the allow_emails data against the sender. Here are
the queries/manipulations I think I need to do:

MYSQL_Q_ALLOWEDEMAILS = select allow_list from user_table where
userid='${quote_mysql:$local_part}'
in the router I would then use the 'lookup mysql' call. This is where I run
into the problem where the result is placed in $value. $value, I presume,
would contain the concatenated sql result of the query, something like
"john,sue".

${extract {$sender_address_local_part} {results of that mysql query} }
this would try to extract "john" from the result string. Based on if it
finds something or not, I want to relay or destroy the mail.

As you can see, I have a lot of the parts, I just cant put them all
together.

Please help.
Sincerely,
Erik Jacobs