From: mouss (no email)
Date: Sat Oct 01 2005 - 04:02:08 EDT
email builder a écrit :
>Yes, simply put, thank you. However, the point of my question was not how to
>build a restriction class, but how to use something like a mysql lookup or
>$mydestination so that I do not have to manually maintain what is in your
>example "/etc/postfix/reject_mydomains" with a list of our domains. No, it's
>not the end of the world if that is the only choice, but if postfix already
>has the domain list in $mydestination or the ability to look them up via
>mysql, then we'd love it if we didn't have to manage our domain list in more
>than one place. Wietse made it sound like it's not really worth it, but
>mouss suggested that it is possible to do with a mysql lookup, although it's
>been a while since I looked at the finer intricacies of the mysql lookup
>mechanism, so I'll go read some docs and try to figure out what mouss was
>suggesting....
>
>
>
>
>
assuming 2 tables:
1- "Domains" with columns:
domain #domain name
class # set to "local", "virtual", "relay", "alias", "foreign", ...
...
2- "Users" with columns:
lhs # set to "postmaster", "foo", ...
access # set to "outbound_only" or whatever
...
then: (just you only need a join)
query = SELECT 'REJECT' FROM Users, Domains where
Domains.domain = '%d' AND
Domains.class = 'local' AND
Users.localpart = '%u' AND
Users.access='outbound_only'
limit 1
will return REJECT for foo at example, whenever 'foo' is set to
'outbound_only' in Users and 'example' is set to 'local' in Domains.
Otherwise, the table returns nothing.
you could of course use
querey = SELECT Users.access FROM Users, Domains where
Domains.domain = '%d' AND
Domains.class = 'local' AND
Users.localpart = '%u'
limit 1
and use the column "access" to return whatever restriction class you
want. Just make sure to not return OK if the check is before relay control.
|
|
|