Problem with zmtrainsa

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
phoenix
Ambassador
Ambassador
Posts: 27278
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Problem with zmtrainsa

Post by phoenix »

I used zmtrainsa without problems in the last release of Zimbra, now it throw up errors.
If I use zmtrainsa (with a correct host/user/password/spam/folder from the zimbra account I get the following errors:
/opt/zimbra/bin/zmtrainsa: line 56: /opt/zimbra/.fetchmailrc: No such file or directory

chmod: cannot access `/opt/zimbra/.fetchmailrc': No such file or directory

Enter password for bpye@chinook:

fetchmail: lock creation failed.

config: configuration file "/opt/zimbra/conf/spamassassin/20_body_tests.cf" requires version 3.000004 of SpamAssassin, but this is code version 3.001000. Maybe you need to use the -C switch, or remove the old config files? Skipping this file at /usr/lib/perl5/site_perl/5.8.5/Mail/SpamAssassin/Conf/Parser.pm line 342.
It produces one error line for each file in the conf folder.
Has this been changed in this release, It is possible that I may have updated a cpan spamassassin module would this cause the problem?
Regards


Bill
Regards

Bill

Rspamd: A high performance spamassassin replacement

Per ardua ad astra
marcmac
Elite member
Elite member
Posts: 2091
Joined: Fri Sep 12, 2014 9:53 pm

Problem with zmtrainsa

Post by marcmac »

This is a permissions issue - when we dropped IPtables and went to an all-sudo approach, we set /opt/zimbra to root ownership for security reasons.
Fetchmail is trying to write .fetchmailrc in /opt/zimbra - you can bypass this error by touching the file (as root) and chowning it to zimbra
Another error will then show up, though - fetchmail can't create lock file. I haven't figured out how to force it to create the lock in /tmp, instead of ${HOME} - so the only workaround I've got so far is:
su - root

chown zimbra /opt/zimbra

su - zimbra

zmtrainsa ...

su - root

chown root /opt/zimbra
marcmac
Elite member
Elite member
Posts: 2091
Joined: Fri Sep 12, 2014 9:53 pm

Problem with zmtrainsa

Post by marcmac »

Ok, I've taken another look, and have a fix.
Update zmtrainsa to use a different fetchmailrc by changing these lines.
echo "server $SERVER user $USER@$SERVER password $PASS keep" > ${zimbra_home}/conf/.fetchmailrc

chmod 600 ${zimbra_home}/conf/.fetchmailrc
export HOME=${zimbra_home}/conf # Add this line
/usr/bin/fetchmail -f ${zimbra_home}/conf/.fetchmailrc -n -a -u $USER $FOLDER -m "${zimbra_home}/bin/sa-learn -p ${zimbra_home}/conf/salocal.cf --dbpath ${zimbra_home}/amavisd/.spamassassin/ --no-sync --showdots -L --${MODE}" ${SERVER}


# This line is unchanged

${zimbra_home}/bin/sa-learn -p ${zimbra_home}/conf/salocal.cf --dbpath ${zimbra_home}/amavisd/.spamassassin/ --sync


rm -f ${zimbra_home}/conf/.fetchmailrc
phoenix
Ambassador
Ambassador
Posts: 27278
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Problem with zmtrainsa

Post by phoenix »

Thanks for that, it works a treat although I still get the errors about the code version being wrong:



reading message emailaddress[at]none.com :1 of 4 (1922 header octets) . (467 body octets) .config: configuration file "/opt/zimbra/conf/spamassassin/20_body_tests.cf" requires version 3.000004 of SpamAssassin, but this is code version 3.001000. Maybe you need to use the -C switch, or remove the old config files? Skipping this file at /usr/lib/perl5/site_perl/5.8.5/Mail/SpamAssassin/Conf/Parser.pm line 342.

Is it my cpan spamassassin update causing this?
Regards
Bill
Regards

Bill

Rspamd: A high performance spamassassin replacement

Per ardua ad astra
JoshuaPrismon
Outstanding Member
Outstanding Member
Posts: 458
Joined: Fri Sep 12, 2014 9:59 pm

Problem with zmtrainsa

Post by JoshuaPrismon »

[quote user="10330phoenix"]Thanks for that, it works a treat although I still get the errors about the code version being wrong:



reading message emailaddress[at]none.com :1 of 4 (1922 header octets) . (467 body octets) .config: configuration file "/opt/zimbra/conf/spamassassin/20_body_tests.cf" requires version 3.000004 of SpamAssassin, but this is code version 3.001000. Maybe you need to use the -C switch, or remove the old config files? Skipping this file at /usr/lib/perl5/site_perl/5.8.5/Mail/SpamAssassin/Conf/Parser.pm line 342.

Is it my cpan spamassassin update causing this?
Regards
Bill[/QUOTE]
Yep. I ran into the same thing. If you upgrade your version of SpamAssassin to the newest version, some of the rules in zimbra are hardcoded with a older version requirement. I just removed the offending line and things seemed to work.
marcmac
Elite member
Elite member
Posts: 2091
Joined: Fri Sep 12, 2014 9:53 pm

Problem with zmtrainsa

Post by marcmac »

You can copy your conf files to /opt/zimbra/conf/spamassassin to get past this, most likely. (I'm not sure where CPAN puts them.)
phoenix
Ambassador
Ambassador
Posts: 27278
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Problem with zmtrainsa

Post by phoenix »

Thanks to you both for that, I'll dig around and see what the files have got in them and where the new ones are.
Regards

Bill

Rspamd: A high performance spamassassin replacement

Per ardua ad astra
johndevine
Posts: 29
Joined: Fri Sep 12, 2014 9:59 pm

Problem with zmtrainsa

Post by johndevine »

Hi Marc
Again a bit confused ....sorry for the ignorance at this stage, which conf files should i replace? :confused:
Many thanks for your time
JD
phoenix
Ambassador
Ambassador
Posts: 27278
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Problem with zmtrainsa

Post by phoenix »

Hi
A lot of the files in this directory /opt/zimbra/conf/spamassassin have this entry in them 'require_version 3.000004' (I'm afraid you'll have to check them all) - just comment it out or remove it and the problem goes away. :)
Regards

Bill

Rspamd: A high performance spamassassin replacement

Per ardua ad astra
johndevine
Posts: 29
Joined: Fri Sep 12, 2014 9:59 pm

Problem with zmtrainsa

Post by johndevine »

Many Thanks Phoenix
By the way...there does not seem to be many rules in this sa....is this normal?
JD
Post Reply