Re: a simplified, home-made txRep?

2019-11-19 Thread Martin Gregorie
On Tue, 2019-11-19 at 20:32 +0200, Henrik K wrote:
> If you want to strictly test for both remote_email@remotedomain and
> mail@mydomain, I'm afraid you need a custom plugin for it.
> 
Sounds like a job for a relational database and a custom SAplugin to
interface to it: by using a single table to store the addresses a single
SQL query would give a clear yes/no answer.

I do something similar: my SA plugin runs the SQL query against a view
of my mail archive, which is in a PostgreSQL database.

Martin




Re: a simplified, home-made txRep?

2019-11-19 Thread Henrik K
On Tue, Nov 19, 2019 at 07:08:29PM +0100, hg user wrote:
> Thank you to both for your answers.
> 
> Yes, I meant TxRep.
> 
> My text file is in this format:
> mail@mydomain,remote_email@remotedomain
> 
> My goal is to lower the score of messages coming from 
> remote_email@remotedomain
> and addressed to mail@mydomain. Of course, each user can have a different list
> of addresses and as I said, there are about 610.000 lines in the file.
> 
> There are 360.000 unique remote_emails in the file...

If you want to strictly test for both remote_email@remotedomain and
mail@mydomain, I'm afraid you need a custom plugin for it.



Re: a simplified, home-made txRep?

2019-11-19 Thread hg user
Thank you to both for your answers.

Yes, I meant TxRep.

My text file is in this format:
mail@mydomain,remote_email@remotedomain

My goal is to lower the score of messages coming from
remote_email@remotedomain and addressed to mail@mydomain. Of course, each
user can have a different list of addresses and as I said, there are about
610.000 lines in the file.

There are 360.000 unique remote_emails in the file...


Re: a simplified, home-made txRep?

2019-11-19 Thread RW
On Tue, 19 Nov 2019 13:56:53 +0200
Henrik K wrote:

> On Tue, Nov 19, 2019 at 12:23:50PM +0100, hg user wrote:
> > In a 28mb, 610K lines text file, I have a list of all my users and
> > the email addresses they sent a mail at least once.
> > I'd like to use the info to add a -1 point when a mail is received
> > from one of these addresses.
> > 
> > Unfortunately, at the moment, outgoing mail is not processed by
> > spamassassin so txRep is not good...

Did you actually mean TxRep? IIRC there's another plugin that learns
addresses from outgoing mail, but TxRep doesn't require it.



> You can dump them in enlist_addrlist format to .cf file
> 
> enlist_addrlist (KNOWN_FROM) f...@bar.net
> enlist_addrlist (KNOWN_FROM) b...@another.com
> ...
> header KNOWN_FROM eval:check_from_in_list('KNOWN_FROM')
> score KNOWN_FROM -1
> 
> If you have thousands of entries, it might slow down things
> marginally (the list is fully iterated for finding matches, but
> shouldn't be a problem unless you have million).
> 
> Of course From header could be forged etc, currently there's no
> function to check only envelope sender which might be safer.


The envelope is not much safer, but you can do this:

meta KNOWN_FROM_AUTH   KNOWN_FROM  && (DKIM_VALID_AU || (SPF_PASS || 
__RP_MATCHES_RCVD) && !HEADER_FROM_DIFFERENT_DOMAINS)




Re: a simplified, home-made txRep?

2019-11-19 Thread Henrik K
On Tue, Nov 19, 2019 at 12:23:50PM +0100, hg user wrote:
> In a 28mb, 610K lines text file, I have a list of all my users and the email
> addresses they sent a mail at least once.
> I'd like to use the info to add a -1 point when a mail is received from one of
> these addresses.
> 
> Unfortunately, at the moment, outgoing mail is not processed by spamassassin 
> so
> txRep is not good...
> 
> any idea?
> 
> Thank you
> Francesco

You can dump them in enlist_addrlist format to .cf file

enlist_addrlist (KNOWN_FROM) f...@bar.net
enlist_addrlist (KNOWN_FROM) b...@another.com
...
header KNOWN_FROM eval:check_from_in_list('KNOWN_FROM')
score KNOWN_FROM -1

If you have thousands of entries, it might slow down things marginally (the
list is fully iterated for finding matches, but shouldn't be a problem
unless you have million).

Of course From header could be forged etc, currently there's no function to
check only envelope sender which might be safer.

If you have Postfix, I wrote similar daemon to do this dynamically:
https://mailfud.org/postpals/



a simplified, home-made txRep?

2019-11-19 Thread hg user
In a 28mb, 610K lines text file, I have a list of all my users and the
email addresses they *sent* a mail at least once.
I'd like to use the info to add a -1 point when a mail is received from one
of these addresses.

Unfortunately, at the moment, outgoing mail is not processed by
spamassassin so txRep is not good...

any idea?

Thank you
Francesco