Is it possible to use header checks on multiple headers

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to use header checks on multiple headers

Nick Howitt
I am receiving some not very nice spam and I was wondering if I could
use as a single filter:

To: contains mydomain
From: is the same as To: (inside < and >)
Return-Path: is not from my domain

Or am I using completely the wrong tool for this?

Thanks,
Nick




Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to use header checks on multiple headers

Andrey Repin-2
Greetings, Nick Howitt!

> I am receiving some not very nice spam and I was wondering if I could
> use as a single filter:

> To: contains mydomain
> From: is the same as To: (inside < and >)
> Return-Path: is not from my domain

> Or am I using completely the wrong tool for this?

If you search list archive, you'll find that each check made by postfix is
made in isolation, if you want some complex rules, you'd need a milter.


--
With best regards,
Andrey Repin
Saturday, April 13, 2019 11:26:06

Sorry for my terrible english...

Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to use header checks on multiple headers

Nick Howitt


On 13/04/2019 09:26, Andrey Repin wrote:

> Greetings, Nick Howitt!
>
>> I am receiving some not very nice spam and I was wondering if I could
>> use as a single filter:
>> To: contains mydomain
>> From: is the same as To: (inside < and >)
>> Return-Path: is not from my domain
>> Or am I using completely the wrong tool for this?
> If you search list archive, you'll find that each check made by postfix is
> made in isolation, if you want some complex rules, you'd need a milter.
>
>
Thanks Andrey,
I thought the checks were line by line and you've confirmed it. I've had
a quick look at writing milters and that one is beyond me for the moment.
Regards,
Nick
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to use header checks on multiple headers

Dominic Raferd


On Tue, 16 Apr 2019 at 10:25, Nick Howitt <[hidden email]> wrote:


On 13/04/2019 09:26, Andrey Repin wrote:
> Greetings, Nick Howitt!
>
>> I am receiving some not very nice spam and I was wondering if I could
>> use as a single filter:
>> To: contains mydomain
>> From: is the same as To: (inside < and >)
>> Return-Path: is not from my domain
>> Or am I using completely the wrong tool for this?
> If you search list archive, you'll find that each check made by postfix is
> made in isolation, if you want some complex rules, you'd need a milter.
>
>
Thanks Andrey,
I thought the checks were line by line and you've confirmed it. I've had
a quick look at writing milters and that one is beyond me for the moment.

Look at postfwd milter (http://postfwd.org/), where a single rule can combine tests on different headers.
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to use header checks on multiple headers

Noel Jones-2
On 4/16/2019 5:05 AM, Dominic Raferd wrote:

>
>
> On Tue, 16 Apr 2019 at 10:25, Nick Howitt <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>
>
>     On 13/04/2019 09:26, Andrey Repin wrote:
>      > Greetings, Nick Howitt!
>      >
>      >> I am receiving some not very nice spam and I was wondering
>     if I could
>      >> use as a single filter:
>      >> To: contains mydomain
>      >> From: is the same as To: (inside < and >)
>      >> Return-Path: is not from my domain
>      >> Or am I using completely the wrong tool for this?
>      > If you search list archive, you'll find that each check made
>     by postfix is
>      > made in isolation, if you want some complex rules, you'd need
>     a milter.
>      >
>      >
>     Thanks Andrey,
>     I thought the checks were line by line and you've confirmed it.
>     I've had
>     a quick look at writing milters and that one is beyond me for
>     the moment.
>
>
> Look at postfwd milter (http://postfwd.org/), where a single rule
> can combine tests on different headers.


postfwd is a policy service (not a milter), and doesn't see headers.
  It *can* combine tests on multiple envelope items, such as client,
mail from, and rcpt to.

If you need arbitrary header checks, milter-regex can do complex
regular expression matching on multiple headers or the body of the
message.  See google for examples.



   -- Noel Jones
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to use header checks on multiple headers

Ralph Seichter-2
* Noel Jones:

> If you need arbitrary header checks, milter-regex can do complex
> regular expression matching on multiple headers or the body of the
> message.

I can recommend milter-regex. It is small, effective, and easy to
configure. Also, the author added a useful feature after I asked
him for it, which made milter-regex even better for me.

-Ralph