[exim] Multiple lookups - ldap and mysql for different domai…

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Matiss
Data:  
Para: exim-users
Asunto: [exim] Multiple lookups - ldap and mysql for different domains
Hello all. :)
My question is - can exim do multiple user authentication lookups?
What I mean, is that I have Active Directory deployment in my company,
and it holds users for main domain. But also, I need to host some
smaller domains for other sub-companies, and I don't want to add
usernames/passwords to our AD for them.

So, those I would like to lookup in mysql.

Is it possible to make exim to: 1) if domain name is maindomain.com,
look up user in LDAP
2) if domain name is everything else, look it up in mysql.

or I would be perfectly fine configuring that on per-domain basis.

Thank you,
Matiss 
 From exim-users@??? Thu Oct 02 09:10:18 2008
Envelope-to: exim-users@???
Received: from smtp.spodhuis.org ([2001:980:fff:31::a]:53094
    heloH.spodhuis.org) by tahini.csx.cam.ac.uk with esmtp (Exim 4.69)
    (envelope-from <exim-users@???>) id 1KlJGK-0006TI-Qv
    for exim-users@???; Thu, 02 Oct 2008 09:10:18 +0100
Received: by smtp.spodhuis.org with local
    id 1KlJGK-0006Ha-JR; Thu, 02 Oct 2008 08:10:16 +0000
Date: Thu, 2 Oct 2008 01:10:16 -0700
From: Phil Pennock <exim-users@???>
To: rejo@???
Message-ID: <20081002081016.GA4581@???>
Mail-Followup-To: rejo@???, exim-users@???
References: <20081002074058.GC4085@???>
MIME-Version: 1.0
Content-Type: text/plain; charsetÃ-ascii
Content-Disposition: inline
In-Reply-To: <20081002074058.GC4085@???>
X-Spam-Score: -2.4 (--)
X-Spam-Status: No, scoreÒ.4 required~0 tests÷L.146, BAYES_00Ñ.5,
    EXIM_EXP_VARÑ, NO_RELAYSÐ.001 autolearnŠm version^1.8
Cc: exim-users@???
Subject: Re: [exim] nested condition
X-BeenThere: exim-users@???
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: exim-users@???
List-Id: A user list for the exim MTA <exim-users.exim.org>
List-Unsubscribe: <http://lists.exim.org/mailman/listinfo/exim-users>,
    <mailto:exim-users-request@exim.org?subject¾subscribe>
List-Archive: <http://lists.exim.org/lurker/list/exim-users.html>
List-Post: <mailto:exim-users@exim.org>
List-Help: <mailto:exim-users-request@exim.org?subjectŽlp>
List-Subscribe: <http://lists.exim.org/mailman/listinfo/exim-users>,
    <mailto:exim-users-request@exim.org?subject¥bscribe>
X-List-Received-Date: Thu, 02 Oct 2008 08:10:18 -0000


On 2008-10-02 at 09:40 +0200, Rejo Zenger wrote:
> I am trying to create a nested condition for a router and I seem to be
> unable to get it working. I have now:
>
>     ${if and { \
>         { or { \
>             {def:h_List-Id:} \
>             {eq {$sender_address}{}} \
>             {match{$h_X-Spam-Flag:}{(?i)YES}}


You're missing a backslash at the end of that line.

>             } {false}{true} } \


This is the problem, I suspect. The {false}{true} here is what you'd
use in ${if CONDITION {TRUE-CASE}{FALSE-CASE}} after CONDITION. The
or{{C1}{C2}{C3}} together forms a condition. The and{{C4}{C5}} forms a
condition. C1...C5 are conditions. So the and{} takes conditions, not
strings.

What you're writing is:
 ${if and{
          {or { {...}{...}{...} } EXTRA-BITS}
      ....}}


and the EXTRA-BITS is leading to a parse error, with a less than ideal
error message.

Instead, you could use and{{!or{.....}}{second-and-case}} using ! to
negate the condition.

>         { or { \
>             {match{$h_To:}{$local_part}} \
>             {match{$h_Cc:}{$local_part}} \
>             } {true}{false} } \
>         } {true}{false} \
>     }


> Background: I am trying to set the condition that will match messages
> that do not have a List-Id header, that do not have a X-Spam-Flag header
> set to "yes", that do not have a empty sender address (e.g. message is a
> bounce) and which has the local user's username in either the To or Cc
> field.


So expressing that directly and assuming that the username is, by this
point, the $local_part being routed:

 ${if and{\
          {!def:h_List-Id:}\
      {!eqi{$h_X-Spam-Flag:}{yes}}\
      {!eq {$sender_address}{}}\
      {forany{${addresses:$h_To:}:${addresses:$h_Cc:}}\
             {eqi{$local_part}{${local_part:$item}}}}\
      }}


Regards,
-Phil