You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by Giovanni Bechis <gi...@paclan.it> on 2020/04/29 07:02:26 UTC

"checkTag" plugin

Hi,
I would like to write a simple plugin to be able to check every TAG for an expression,
I was thinking about a rule like:
tag EMAILCOUNT eval:check_tag("_TXREPEMAILCOUNT_", "0.0")
tag BAYES_90 eval:exist_tag("BAYES_90")
This plugin will make all tags publicly accessible and it could need a new keyword (it doesn't evaluate the email but it only postprocess the tag).
Comments ? Ideas ?

 Giovanni

Re: "checkTag" plugin

Posted by Giovanni Bechis <gi...@paclan.it>.
On Wed, Apr 29, 2020 at 02:06:29PM -0700, John Hardin wrote:
> On Wed, 29 Apr 2020, Giovanni Bechis wrote:
> 
> > What I would like to have is an easy way to create rules like:
> 
> > meta B ( BAYES_50 && URIBL_BLACK )
> 
> You don't need anything new to do that one, just meta the two existing 
> named rules. Or will that not work for some reason?
> 
you are right, that works without additional changes

 Giovanni

> 
> > I can add eval function when needed or have a generic tool if it's worth to have it.
> >  Giovanni
> >
> > On 4/29/20 12:48 PM, Henrik K wrote:
> >>
> >> To me an idea should have a need an an application.  Because adding a new
> >> tag always requires changing code, I don't see what a "tag" rule would offer
> >> beside complicating things.
> >>
> >> On Wed, Apr 29, 2020 at 12:41:47PM +0200, Giovanni Bechis wrote:
> >>> No problem in adding few eval functions where needed, if tag hits late pds@ plugin will take care of it.
> >>> I just wanted to talk about the idea, I am not sure if it could be a good one or not.
> >>>
> >>>  Giovanni
> >>>
> >>> On 4/29/20 12:34 PM, Henrik K wrote:
> >>>>
> >>>> What would you realisticly use it for, such obscure TXREP tag could be
> >>>> simply made as eval function in TxRep plugin, if it was really useful?
> >>>> Seems like a terrible way to complicate the rule logic even more - if they
> >>>> are rules, then they should be supported by meta rules, what about if tag
> >>>> never hits or hits late etc.  Seems like a dependency mightmare.
> >>>>
> >>>> On Wed, Apr 29, 2020 at 09:02:26AM +0200, Giovanni Bechis wrote:
> >>>>> Hi,
> >>>>> I would like to write a simple plugin to be able to check every TAG for an expression,
> >>>>> I was thinking about a rule like:
> >>>>> tag EMAILCOUNT eval:check_tag("_TXREPEMAILCOUNT_", "0.0")
> >>>>> tag BAYES_90 eval:exist_tag("BAYES_90")
> >>>>> This plugin will make all tags publicly accessible and it could need a new keyword (it doesn't evaluate the email but it only postprocess the tag).
> >>>>> Comments ? Ideas ?
> >>>>>
> >>>>>  Giovanni
> >
> 
> -- 
>   John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
>   jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
>   key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
> -----------------------------------------------------------------------
>    At what point then is the approach of danger to be expected?
>    I answer, if it ever reach us, it must spring up amongst us.
>    It cannot come from abroad. If destruction be our lot, we must
>    ourselves be its author and finisher. As a nation of freemen, we
>    must live through all time, or die by suicide.   -- Abraham Lincoln
>    ...popularly summarized as:
>    "America will never be destroyed from the outside. If we falter
>    and lose our freedoms, it will be because we destroyed ourselves."
> -----------------------------------------------------------------------
>   2 days until May Day - Remember 110 million people murdered by Communism

Re: "checkTag" plugin

Posted by John Hardin <jh...@impsec.org>.
On Wed, 29 Apr 2020, Giovanni Bechis wrote:

> What I would like to have is an easy way to create rules like:

> meta B ( BAYES_50 && URIBL_BLACK )

You don't need anything new to do that one, just meta the two existing 
named rules. Or will that not work for some reason?


> I can add eval function when needed or have a generic tool if it's worth to have it.
>  Giovanni
>
> On 4/29/20 12:48 PM, Henrik K wrote:
>>
>> To me an idea should have a need an an application.  Because adding a new
>> tag always requires changing code, I don't see what a "tag" rule would offer
>> beside complicating things.
>>
>> On Wed, Apr 29, 2020 at 12:41:47PM +0200, Giovanni Bechis wrote:
>>> No problem in adding few eval functions where needed, if tag hits late pds@ plugin will take care of it.
>>> I just wanted to talk about the idea, I am not sure if it could be a good one or not.
>>>
>>>  Giovanni
>>>
>>> On 4/29/20 12:34 PM, Henrik K wrote:
>>>>
>>>> What would you realisticly use it for, such obscure TXREP tag could be
>>>> simply made as eval function in TxRep plugin, if it was really useful?
>>>> Seems like a terrible way to complicate the rule logic even more - if they
>>>> are rules, then they should be supported by meta rules, what about if tag
>>>> never hits or hits late etc.  Seems like a dependency mightmare.
>>>>
>>>> On Wed, Apr 29, 2020 at 09:02:26AM +0200, Giovanni Bechis wrote:
>>>>> Hi,
>>>>> I would like to write a simple plugin to be able to check every TAG for an expression,
>>>>> I was thinking about a rule like:
>>>>> tag EMAILCOUNT eval:check_tag("_TXREPEMAILCOUNT_", "0.0")
>>>>> tag BAYES_90 eval:exist_tag("BAYES_90")
>>>>> This plugin will make all tags publicly accessible and it could need a new keyword (it doesn't evaluate the email but it only postprocess the tag).
>>>>> Comments ? Ideas ?
>>>>>
>>>>>  Giovanni
>

-- 
  John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
  jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
  key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
   At what point then is the approach of danger to be expected?
   I answer, if it ever reach us, it must spring up amongst us.
   It cannot come from abroad. If destruction be our lot, we must
   ourselves be its author and finisher. As a nation of freemen, we
   must live through all time, or die by suicide.   -- Abraham Lincoln
   ...popularly summarized as:
   "America will never be destroyed from the outside. If we falter
   and lose our freedoms, it will be because we destroyed ourselves."
-----------------------------------------------------------------------
  2 days until May Day - Remember 110 million people murdered by Communism

Re: "checkTag" plugin

Posted by Henrik K <he...@hege.li>.
Meta rules already have a rules_matching() operator, might be most logical
do to tag value matching similarly:

meta A  tag_value(_TXREPEMAILCOUNT_) == 0

Though it might be hard or impossible to handle late tags, only priority A
1001 would handle it in a crude way.


On Wed, Apr 29, 2020 at 03:43:52PM +0200, Giovanni Bechis wrote:
> What I would like to have is an easy way to create rules like:
> meta A ( TXREPEMAILCOUNT = 0 )
> meta B ( BAYES_50 && URIBL_BLACK )
> 
> I can add eval function when needed or have a generic tool if it's worth to have it.
>   Giovanni
> 
> On 4/29/20 12:48 PM, Henrik K wrote:
> > 
> > To me an idea should have a need an an application.  Because adding a new
> > tag always requires changing code, I don't see what a "tag" rule would offer
> > beside complicating things.
> > 
> > On Wed, Apr 29, 2020 at 12:41:47PM +0200, Giovanni Bechis wrote:
> >> No problem in adding few eval functions where needed, if tag hits late pds@ plugin will take care of it.
> >> I just wanted to talk about the idea, I am not sure if it could be a good one or not.
> >>
> >>  Giovanni
> >>
> >> On 4/29/20 12:34 PM, Henrik K wrote:
> >>>
> >>> What would you realisticly use it for, such obscure TXREP tag could be
> >>> simply made as eval function in TxRep plugin, if it was really useful? 
> >>> Seems like a terrible way to complicate the rule logic even more - if they
> >>> are rules, then they should be supported by meta rules, what about if tag
> >>> never hits or hits late etc.  Seems like a dependency mightmare.
> >>>
> >>> On Wed, Apr 29, 2020 at 09:02:26AM +0200, Giovanni Bechis wrote:
> >>>> Hi,
> >>>> I would like to write a simple plugin to be able to check every TAG for an expression,
> >>>> I was thinking about a rule like:
> >>>> tag EMAILCOUNT eval:check_tag("_TXREPEMAILCOUNT_", "0.0")
> >>>> tag BAYES_90 eval:exist_tag("BAYES_90")
> >>>> This plugin will make all tags publicly accessible and it could need a new keyword (it doesn't evaluate the email but it only postprocess the tag).
> >>>> Comments ? Ideas ?
> >>>>
> >>>>  Giovanni

Re: "checkTag" plugin

Posted by Giovanni Bechis <gi...@paclan.it>.
What I would like to have is an easy way to create rules like:
meta A ( TXREPEMAILCOUNT = 0 )
meta B ( BAYES_50 && URIBL_BLACK )

I can add eval function when needed or have a generic tool if it's worth to have it.
  Giovanni

On 4/29/20 12:48 PM, Henrik K wrote:
> 
> To me an idea should have a need an an application.  Because adding a new
> tag always requires changing code, I don't see what a "tag" rule would offer
> beside complicating things.
> 
> On Wed, Apr 29, 2020 at 12:41:47PM +0200, Giovanni Bechis wrote:
>> No problem in adding few eval functions where needed, if tag hits late pds@ plugin will take care of it.
>> I just wanted to talk about the idea, I am not sure if it could be a good one or not.
>>
>>  Giovanni
>>
>> On 4/29/20 12:34 PM, Henrik K wrote:
>>>
>>> What would you realisticly use it for, such obscure TXREP tag could be
>>> simply made as eval function in TxRep plugin, if it was really useful? 
>>> Seems like a terrible way to complicate the rule logic even more - if they
>>> are rules, then they should be supported by meta rules, what about if tag
>>> never hits or hits late etc.  Seems like a dependency mightmare.
>>>
>>> On Wed, Apr 29, 2020 at 09:02:26AM +0200, Giovanni Bechis wrote:
>>>> Hi,
>>>> I would like to write a simple plugin to be able to check every TAG for an expression,
>>>> I was thinking about a rule like:
>>>> tag EMAILCOUNT eval:check_tag("_TXREPEMAILCOUNT_", "0.0")
>>>> tag BAYES_90 eval:exist_tag("BAYES_90")
>>>> This plugin will make all tags publicly accessible and it could need a new keyword (it doesn't evaluate the email but it only postprocess the tag).
>>>> Comments ? Ideas ?
>>>>
>>>>  Giovanni


Re: "checkTag" plugin

Posted by Henrik K <he...@hege.li>.
To me an idea should have a need an an application.  Because adding a new
tag always requires changing code, I don't see what a "tag" rule would offer
beside complicating things.

On Wed, Apr 29, 2020 at 12:41:47PM +0200, Giovanni Bechis wrote:
> No problem in adding few eval functions where needed, if tag hits late pds@ plugin will take care of it.
> I just wanted to talk about the idea, I am not sure if it could be a good one or not.
> 
>  Giovanni
> 
> On 4/29/20 12:34 PM, Henrik K wrote:
> > 
> > What would you realisticly use it for, such obscure TXREP tag could be
> > simply made as eval function in TxRep plugin, if it was really useful? 
> > Seems like a terrible way to complicate the rule logic even more - if they
> > are rules, then they should be supported by meta rules, what about if tag
> > never hits or hits late etc.  Seems like a dependency mightmare.
> > 
> > On Wed, Apr 29, 2020 at 09:02:26AM +0200, Giovanni Bechis wrote:
> >> Hi,
> >> I would like to write a simple plugin to be able to check every TAG for an expression,
> >> I was thinking about a rule like:
> >> tag EMAILCOUNT eval:check_tag("_TXREPEMAILCOUNT_", "0.0")
> >> tag BAYES_90 eval:exist_tag("BAYES_90")
> >> This plugin will make all tags publicly accessible and it could need a new keyword (it doesn't evaluate the email but it only postprocess the tag).
> >> Comments ? Ideas ?
> >>
> >>  Giovanni

Re: "checkTag" plugin

Posted by Giovanni Bechis <gi...@paclan.it>.
No problem in adding few eval functions where needed, if tag hits late pds@ plugin will take care of it.
I just wanted to talk about the idea, I am not sure if it could be a good one or not.

 Giovanni

On 4/29/20 12:34 PM, Henrik K wrote:
> 
> What would you realisticly use it for, such obscure TXREP tag could be
> simply made as eval function in TxRep plugin, if it was really useful? 
> Seems like a terrible way to complicate the rule logic even more - if they
> are rules, then they should be supported by meta rules, what about if tag
> never hits or hits late etc.  Seems like a dependency mightmare.
> 
> On Wed, Apr 29, 2020 at 09:02:26AM +0200, Giovanni Bechis wrote:
>> Hi,
>> I would like to write a simple plugin to be able to check every TAG for an expression,
>> I was thinking about a rule like:
>> tag EMAILCOUNT eval:check_tag("_TXREPEMAILCOUNT_", "0.0")
>> tag BAYES_90 eval:exist_tag("BAYES_90")
>> This plugin will make all tags publicly accessible and it could need a new keyword (it doesn't evaluate the email but it only postprocess the tag).
>> Comments ? Ideas ?
>>
>>  Giovanni


Re: "checkTag" plugin

Posted by Henrik K <he...@hege.li>.
What would you realisticly use it for, such obscure TXREP tag could be
simply made as eval function in TxRep plugin, if it was really useful? 
Seems like a terrible way to complicate the rule logic even more - if they
are rules, then they should be supported by meta rules, what about if tag
never hits or hits late etc.  Seems like a dependency mightmare.

On Wed, Apr 29, 2020 at 09:02:26AM +0200, Giovanni Bechis wrote:
> Hi,
> I would like to write a simple plugin to be able to check every TAG for an expression,
> I was thinking about a rule like:
> tag EMAILCOUNT eval:check_tag("_TXREPEMAILCOUNT_", "0.0")
> tag BAYES_90 eval:exist_tag("BAYES_90")
> This plugin will make all tags publicly accessible and it could need a new keyword (it doesn't evaluate the email but it only postprocess the tag).
> Comments ? Ideas ?
> 
>  Giovanni