1

Topic: spamassassin in iredmail

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? Installer
- Linux/BSD distribution name and version:  Ubuntu 18.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
====

Hello!
I have a question how manually to train spamassassin in iredmail. More precisely from whose name to do it?
I did training on behalf of root.

sudo sa-learn --ham /mnt/data/vmail/vmail1/mydomain.com/cgfv/Maildir/cur/
sudo sa-learn --spam /mnt/data/vmail/vmail1/mydomain.com/cgfv/Maildir/.Junk/cur/

but spamassassin passes spam.

When I check dump the created root:

sudo sa-learn --dump magic
0.000          0          3          0  non-token data: bayes db version
0.000          0        367          0  non-token data: nspam
0.000          0        267          0  non-token data: nham
0.000          0      67821          0  non-token data: ntokens
0.000          0 1551340818          0  non-token data: oldest atime
0.000          0 1555407937          0  non-token data: newest atime
0.000          0          0          0  non-token data: last journal sync atime
0.000          0          0          0  non-token data: last expiry atime
0.000          0          0          0  non-token data: last expire atime delta
0.000          0          0          0  non-token data: last expire reduction count

I read that training needs to be provided from amavis. I once again watch dump from amavis

su amavis -c "sa-learn --dump magic"
0.000          0          3          0  non-token data: bayes db version
0.000          0          4          0  non-token data: nspam
0.000          0        117          0  non-token data: nham
0.000          0      48662          0  non-token data: ntokens
0.000          0 1551101810          0  non-token data: oldest atime
0.000          0 1555475276          0  non-token data: newest atime
0.000          0          0          0  non-token data: last journal sync atime
0.000          0 1555453446          0  non-token data: last expiry atime
0.000          0          0          0  non-token data: last expire atime delta
0.000          0          0          0  non-token data: last expire reduction count

The different quantity of spam/ham is analyzed from root and from amavis
I try to provide training from amavis

su amavis -c "sa-learn --ham /mnt/data/vmail/vmail1/mydomain.com/cgfv/Maildir/cur/"
archive-iterator: no access to /mnt/data/vmail/vmail1/mydomain.com/cgfv/Maildir/cur/: Permission denied at /usr/share/perl5/Mail/SpamAssassin/ArchiveIterator.pm line 586.
archive-iterator: no access to /mnt/data/vmail/vmail1/mydomain.com/cgfv/Maildir/cur/: Permission denied at /usr/share/perl5/Mail/SpamAssassin/ArchiveIterator.pm line 828.
archive-iterator: unable to open /mnt/data/vmail/vmail1/mydomain.com/cgfv/Maildir/cur/: Permission denied
Learned tokens from 0 message(s) (0 message(s) examined)

It is clear. Directories of mail belong to the user of vmail

Tell me please from whose name and what command it is correct to provide training of spamassassin?

Thanks in advance also I apologize for my bad English!!!

2

Re: spamassassin in iredmail

Try to run sa-learn with argument "-u amavis".

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

3

Re: spamassassin in iredmail

I correctly understood that it is necessary to train spamassassin from the user of "amavis"?

I wanted to use for training of a directory of mail of users, but the right for them of 700 vmail:vmail. Amavis cannot read them.

I copied directories of spam/ham in a separate directory, assigned the owner of amavis:amavis

sa-learn -u amavis --spam /spampath
sa-learn -u amavis --ham /hampath

And then at me it turned out to train it. Spam became much less.
I can write a script which everytime will copy spam/ham from mail directories of users, to change the owner and to train spamassassin
But it seems to me that there has to be other way on the basis of the rights for amavis/vmail. How do you think?

Argument "-u amavis" is expected returns errors of access to directories of mail of users

Thank you that you help me!!!

4

Re: spamassassin in iredmail

If you store bayes in SQL database, it doesn't need the permission to access "amavis" user's home directory. FYI: https://docs.iredmail.org/store.spamass … n.sql.html

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee