1

Topic: installing Auto learn spam/ham

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.1
- Deployed with iRedMail Easy or the downloadable installer? Downloadable installer
- Linux/BSD distribution name and version: CentOS 8
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MariaDB
- Web server (Apache or Nginx): nginx/1.14.1
- Manage mail accounts with iRedAdmin-Pro? not on this server
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
So i used a tutorial from web: https://docs.iredmail.org/dovecot.imapsieve.html
Seems like everything is installed correctly, but when i get to section "Check detailed bayes learning log on command line", i got an error:

[root@mail spam]# su -s /bin/bash amavis -c "spamassassin -D bayes < /opt/sample.eml"
Aug 14 00:04:50.642 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/SpamCop.pm: lib/Mail/SpamAssassin/Plugin/SpamCop.pm: Permission denied at (eval 45) line 1.
Aug 14 00:04:50.642 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm: lib/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm: Permission denied at (eval 46) line 1.
Aug 14 00:04:50.642 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/WhiteListSubject.pm: lib/Mail/SpamAssassin/Plugin/WhiteListSubject.pm: Permission denied at (eval 47) line 1.
Aug 14 00:04:50.642 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/MIMEHeader.pm: lib/Mail/SpamAssassin/Plugin/MIMEHeader.pm: Permission denied at (eval 48) line 1.
Aug 14 00:04:50.642 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/ReplaceTags.pm: lib/Mail/SpamAssassin/Plugin/ReplaceTags.pm: Permission denied at (eval 49) line 1.
Aug 14 00:04:50.642 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/DKIM.pm: lib/Mail/SpamAssassin/Plugin/DKIM.pm: Permission denied at (eval 50) line 1.
Aug 14 00:04:50.643 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/Check.pm: lib/Mail/SpamAssassin/Plugin/Check.pm: Permission denied at (eval 51) line 1.
Aug 14 00:04:50.643 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/HTTPSMismatch.pm: lib/Mail/SpamAssassin/Plugin/HTTPSMismatch.pm: Permission denied at (eval 52) line 1.
Aug 14 00:04:50.643 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/URIDetail.pm: lib/Mail/SpamAssassin/Plugin/URIDetail.pm: Permission denied at (eval 53) line 1.
Aug 14 00:04:50.643 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/Bayes.pm: lib/Mail/SpamAssassin/Plugin/Bayes.pm: Permission denied at (eval 54) line 1.
Aug 14 00:04:50.643 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/BodyEval.pm: lib/Mail/SpamAssassin/Plugin/BodyEval.pm: Permission denied at (eval 55) line 1.
Aug 14 00:04:50.643 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/DNSEval.pm: lib/Mail/SpamAssassin/Plugin/DNSEval.pm: Permission denied at (eval 56) line 1.
Aug 14 00:04:50.643 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/HTMLEval.pm: lib/Mail/SpamAssassin/Plugin/HTMLEval.pm: Permission denied at (eval 57) line 1.
Aug 14 00:04:50.643 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/HeaderEval.pm: lib/Mail/SpamAssassin/Plugin/HeaderEval.pm: Permission denied at (eval 58) line 1.
Aug 14 00:04:50.643 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/MIMEEval.pm: lib/Mail/SpamAssassin/Plugin/MIMEEval.pm: Permission denied at (eval 59) line 1.
Aug 14 00:04:50.643 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/RelayEval.pm: lib/Mail/SpamAssassin/Plugin/RelayEval.pm: Permission denied at (eval 60) line 1.
Aug 14 00:04:50.644 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/URIEval.pm: lib/Mail/SpamAssassin/Plugin/URIEval.pm: Permission denied at (eval 61) line 1.
Aug 14 00:04:50.644 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/WLBLEval.pm: lib/Mail/SpamAssassin/Plugin/WLBLEval.pm: Permission denied at (eval 62) line 1.
Aug 14 00:04:50.644 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/VBounce.pm: lib/Mail/SpamAssassin/Plugin/VBounce.pm: Permission denied at (eval 63) line 1.
Aug 14 00:04:50.644 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/ImageInfo.pm: lib/Mail/SpamAssassin/Plugin/ImageInfo.pm: Permission denied at (eval 64) line 1.
Aug 14 00:04:50.644 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/FreeMail.pm: lib/Mail/SpamAssassin/Plugin/FreeMail.pm: Permission denied at (eval 65) line 1.
Aug 14 00:04:50.644 [30126] warn: plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/AskDNS.pm: lib/Mail/SpamAssassin/Plugin/AskDNS.pm: Permission denied at (eval 66) line 1.
Mail::SpamAssassin::Locker::Flock error: Can't locate Mail/SpamAssassin/Locker/Flock.pm:   lib/Mail/SpamAssassin/Locker/Flock.pm: Permission denied at (eval 1090) line 2.
BEGIN failed--compilation aborted at (eval 1090) line 2. at /usr/bin/spamassassin line 413.

It only works if i use command spamassassin -D bayes < /opt/sample.eml

Maybe i misconfigured somewhere and some scripts don't have permission, and autolearning is NOT working correctly?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: installing Auto learn spam/ham

Does it work if you run the `su` command with a `-` like below:

su -s /bin/bash [color=red]-[/color] amavis -c "..."

Also, You can turn on debug mode in Amavisd and SpamAssassin to check how bayes learning works: https://docs.iredmail.org/debug.amavisd.html

3

Re: installing Auto learn spam/ham

Yes, it does:

[root@mail ~]# su -s /bin/bash - amavis -c "spamassassin -D bayes < /opt/sample.eml"
Aug 16 11:24:41.568 [231670] dbg: bayes: learner_new self=Mail::SpamAssassin::Plugin::Bayes=HASH(0x55e2c5c8d628), bayes_store_module=Mail::SpamAssassin::Bayes                                Store::MySQL
Aug 16 11:24:41.583 [231670] dbg: bayes: using username: amavis
Aug 16 11:24:41.583 [231670] dbg: bayes: learner_new: got store=Mail::SpamAssassin::BayesStore::MySQL=HASH(0x55e2c75edcc0)
Aug 16 11:24:41.591 [231670] dbg: bayes: database connection established
Aug 16 11:24:41.591 [231670] dbg: bayes: found bayes db version 3
Aug 16 11:24:41.591 [231670] dbg: bayes: Using userid: 1
Aug 16 11:24:41.592 [231670] dbg: bayes: not available for scanning, only 20 spam(s) in bayes DB < 200
Aug 16 11:24:41.595 [231670] dbg: bayes: database connection established
Aug 16 11:24:41.596 [231670] dbg: bayes: found bayes db version 3
Aug 16 11:24:41.596 [231670] dbg: bayes: Using userid: 1
Aug 16 11:24:41.597 [231670] dbg: bayes: not available for scanning, only 20 spam(s) in bayes DB < 200
Aug 16 11:24:42.961 [231670] dbg: bayes: database connection established
Aug 16 11:24:42.961 [231670] dbg: bayes: found bayes db version 3
Aug 16 11:24:42.961 [231670] dbg: bayes: Using userid: 1
Aug 16 11:24:42.962 [231670] dbg: bayes: d0d3ea03a5ba5e4f21fc8b1d0f2c0d739b0b69ed@sa_generated already learnt correctly, not learning twice