Re: [Exim] Checking for valid accounts in a mail from relays

Pàgina inicial
Delete this message
Reply to this message
Autor: Andrey Tverdokhleb
Data:  
CC: exim-users
Assumpte: Re: [Exim] Checking for valid accounts in a mail from relays
On Fri, 30 Jul 2004 00:01:49 +0100, Peter Bowyer <peter@???> wrote:
> So you're actually trying to drop mails addressed to a defined list of To:
> headers? I thought it was the other way round. My misunderstanding.


No. I'm trying to drop undefined addresses :)

> >> you
> >> could probably knock up a data acl which looks in To: and cc: for
> >> stuff.
>
> A data acl or a system filter could probably do this. It wouldn't
> necessarily be pretty. If you put the valid addresses in a file, something
> like
>
> drop condition = ${lookup{$header_to:}lsearch {/path/to/file}{1}{0}}
>
> Not sure what this will do with multiple headers, multi-value headers, etc.
> But it's somewhere to start.


"drop" is not very good idea, since it bounces message back. "discard"
is good. Also I found that my relay is using qmail and it adds field
Delivered-To: which contains envelope To from original message, so
everything is much simpler now.

This is what I have now for "after DATA" ACL:

check_message:
  require verify = header_syntax
  require verify = header_sender
  discard condition = ${if def:header_delivered-to: \
                             {${lookup{$header_delivered-to:}
wildlsearch {/etc/exim4/allowed_rec} {no}{yes}}}\
                             {no}\
                       }
          logwrite = Delivered-To: user $header_delivered-to: is not allowed.
  accept


Works perfectly, exactly as I wanted. Only problem was with logging -
I wanted to use log_message, but for some reason it didn't write this
message to my log. logwrite works though.

So, thanks for idea :)

Andery