Bug 1992749

Summary: spampd is woefully out of date
Product: [Fedora] Fedora Reporter: Trever Adams <trever>
Component: spampdAssignee: Bojan Smojver <bojan>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 34CC: bojan, i
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spampd-2.61-3.fc34 spampd-2.61-3.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-08-27 18:52:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Trever Adams 2021-08-11 17:17:56 UTC
Description of problem:
spampd is currently a version from 2005. https://github.com/mpaperno/spampd/blob/master/changelog.txt has a version listed from about a week ago at 2.61

If possible, please consider updating. There are important fixes.

Version-Release number of selected component (if applicable):
spampd-2.30-34.fc34.noarch (From 2005!?!?!)

Comment 1 Bojan Smojver 2021-08-12 13:14:38 UTC
A scratch build for F36 is here:

https://koji.fedoraproject.org/koji/taskinfo?taskID=73725171

Give it a quick look, just for sanity and if you cannot see anything overly broken, I can build properly and push to bodhi.

Comment 2 Fedora Update System 2021-08-14 06:29:01 UTC
FEDORA-2021-93cf007a83 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-93cf007a83

Comment 3 Fedora Update System 2021-08-14 06:29:02 UTC
FEDORA-2021-b9ca679007 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-b9ca679007

Comment 4 Fedora Update System 2021-08-15 01:16:46 UTC
FEDORA-2021-93cf007a83 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-93cf007a83`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-93cf007a83

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2021-08-15 02:01:23 UTC
FEDORA-2021-b9ca679007 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-b9ca679007`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-b9ca679007

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Trever Adams 2021-08-17 23:28:52 UTC
The old package had issues reading /var/lib/spamassassin and /etc/mail/spamassassin. Some of this still exists. This also is a problem with amavisd if it uses spamassassin.

Aug 11 08:43:13 HOST systemd[1]: Started spampd daemon.
Aug 11 08:43:14 HOST spampd[3277306]: config: cannot opendir /var/lib/spamassassin/3.004006: Permission denied
Aug 11 08:43:14 HOST spampd[3277306]: readdir() attempted on invalid dirhandle SA_CF_DIR at /usr/share/perl5/vendor_perl/Mail/SpamAssassin.pm line 2101.
Aug 11 08:43:14 HOST spampd[3277306]: closedir() attempted on invalid dirhandle SA_CF_DIR at /usr/share/perl5/vendor_perl/Mail/SpamAssassin.pm line 2103.
Aug 11 08:43:14 HOST spampd[3277306]: config: cannot opendir /var/lib/spamassassin/3.004006: Permission denied
Aug 11 08:43:14 HOST spampd[3277306]: readdir() attempted on invalid dirhandle SA_CF_DIR at /usr/share/perl5/vendor_perl/Mail/SpamAssassin.pm line 2101.
Aug 11 08:43:14 HOST spampd[3277306]: closedir() attempted on invalid dirhandle SA_CF_DIR at /usr/share/perl5/vendor_perl/Mail/SpamAssassin.pm line 2103.
Aug 11 08:43:14 HOST spampd[3277306]: config: path "/var/lib/spamassassin/3.004006/languages" is inaccessible: Permission denied
Aug 11 08:43:14 HOST spampd[3277306]: config: registryboundaries: no tlds defined, need to run sa-update
Aug 11 08:43:14 HOST spampd[3277306]: config: path "/var/lib/spamassassin/3.004006/triplets.txt" is inaccessible: Permission denied
Aug 11 08:43:14 HOST spampd[3277306]: 2021/08/11-08:43:14 SpamPD (type Net::Server::PreForkSimple) starting! pid(3277306)
Aug 11 08:43:14 HOST spampd[3277306]: Binding to TCP port 10026 on host 127.0.0.1 with IPv4
Aug 11 09:17:24 HOST spampd[3277306]: 2021/08/11-09:17:24 Server closing!

The above probably still persists, but my manual file permission changes probably hides it.

Aug 17 17:23:59 HOST spampd[1458729]: config: path "/var/lib/spamassassin/3.004006/languages" is inaccessible: Permission denied
Aug 17 17:24:00 HOST spampd[1458729]: config: registryboundaries: no tlds defined, need to run sa-update
Aug 17 17:24:00 HOST spampd[1458729]: config: path "/var/lib/spamassassin/3.004006/triplets.txt" is inaccessible: Permission denied
Aug 17 17:24:00 HOST spampd[1458729]: SpamPD v2.61 [Perl 5.32.1, Net::Server::PreForkSimple 2.009, SA 3.4.6, rules v(unknown)] starting with: --nodetach --u=spampd --g=spampd --a --L -->
Aug 17 17:24:00 HOST spampd[1458729]: 2021/08/17-17:24:00 Couldn't open pid file "/var/run/spampd.pid" [Permission denied].
Aug 17 17:24:00 HOST spampd[1458729]: 
Aug 17 17:24:00 HOST spampd[1458729]:  at line 177 in file /usr/share/perl5/vendor_perl/Net/Server.pm
Aug 17 17:24:00 HOST spampd[1458729]: 2021/08/17-17:24:00 Server closing!
Aug 17 17:24:00 HOST systemd[1]: spampd.service: Main process exited, code=exited, status=1/FAILURE
Aug 17 17:24:00 HOST systemd[1]: spampd.service: Failed with result 'exit-code'.

It appears that this is caused by no world write to /run. That and it must be running as another user.

Comment 7 Bojan Smojver 2021-08-18 03:39:45 UTC
I am guessing many of these are SELinux related. If yes, I think a bug should be opened to selinux-policy package to fix this. The easiest is to put SELinux into permissive mode and then determine what's required.

If these are pure permissions issues, I have have a look whether anything can be improved there.

I am surprised to see /var/run/spampd.pid on the list, to be honest. When service is started by systemd, there should be no PID file created.

Comment 8 Bojan Smojver 2021-08-18 04:29:12 UTC
Just installed spampd from updates-testing on F34 and started it with systemctl. Didn't get any permission problems.

Comment 9 Trever Adams 2021-08-18 09:30:20 UTC
Bojan, thank you. The F34 package works. Strange. However, I think the /var/lib/spamassassin problem persists.

drwxr-xr-x.  3 root         spampd       22 Aug 11 08:20 spamassassin

This originally was root:root. I do not know where any bayes files trained reside, but I believe it is in /var/lib/spamassassin. So, I think the solution may be to have a group spamassassin that has rw on /var/lib/spamassassin and full read on /etc/mail/spamassassin. I guess this should be filed as a spamassassin bug?

Comment 10 Trever Adams 2021-08-18 09:32:27 UTC
sa-update does this in /var/lib/spamassassin
drwx------. 3 root root 73 Aug 18 03:29 3.004006

So, that solution may not work.

Comment 11 Bojan Smojver 2021-08-18 09:41:29 UTC
I think those directories are 755 on my machine. I also have sa-update running. I don't remember customising anything, but I could be wrong. These things have been there for a long time.

I'll have to fire up a clean VM and double check.

Comment 12 Trever Adams 2021-08-18 09:43:24 UTC
For me these are fresh installs. The hard drive hosting several VMs died about three weeks ago. I had been keeping dspam working for various reasons, but no more. So, these are as packaged unless something funny is going on.

Comment 13 Trever Adams 2021-08-18 09:45:54 UTC
This is strange...

Aug 18 03:44:00 HOST spampd[251823]: config: path "/var/lib/spamassassin/3.004006/languages" is inaccessible: Permission denied
Aug 18 03:44:00 HOST spampd[251823]: config: registryboundaries: no tlds defined, need to run sa-update
Aug 18 03:44:00 HOST spampd[251823]: config: path "/var/lib/spamassassin/3.004006/triplets.txt" is inaccessible: Permission denied

languages but not triplets is found one level deeper in updates_spamassassin_org

Comment 14 Trever Adams 2021-08-18 09:48:16 UTC
Aug 18 03:38:56 HOST spampd[126867]: plugin: eval failed: bayes: (in learn) locker: safe_lock: cannot create tmp lockfile /var/spool/spamassassin/spampd/bayes.lock.HOST.126867 for /var/spool/spamassassin/spampd/bayes.lock: No such file or directory

Yes, /var/spool/spamassassin wasn't created by spamassassin rpm.

Comment 15 Bojan Smojver 2021-08-18 11:57:23 UTC
I just tried this on a fresh VM. The /var/lib/spamassassin and directories underneath were created with 755 permissions, so I did not see above errors. But, I only started spampd - didn't actually use it for anything. I guess the errors related to the lock file are probably the result of trying to learn spam.

The sa-update script does need SELinux policy like this, however:
-----
require {
                type admin_home_t;
                type systemd_unit_file_t;
                type spamd_update_t;
                type init_t;
                class dir write;
                class service start;
                class file getattr;
                class system status;
}
 
#============= spamd_update_t ==============
allow spamd_update_t admin_home_t:dir write;
allow spamd_update_t init_t:system status;
allow spamd_update_t systemd_unit_file_t:file getattr;
allow spamd_update_t systemd_unit_file_t:service start;
-----

So, that is something that will need to be fixed in spamassassin, I guess.

What I did notice is that perl(Net::Server) did not get pulled in as a dependency for spampd. So, I will have to add this and rebuild.

Comment 16 Trever Adams 2021-08-18 12:04:28 UTC
Yes, /var/lib/spamassassin is correct. However, please look below that, especially after sa-update. Those are 700.

Comment 17 Bojan Smojver 2021-08-18 12:10:36 UTC
On my VM, these were also 755 after sa-update.service ran.

Comment 18 Trever Adams 2021-08-18 12:24:16 UTC
I stand utterly corrected. The problem is if you run sa-update directly all permissions are wrong. If you use the service file, things are ok.

Comment 19 Trever Adams 2021-08-18 12:28:45 UTC
I am still seeing this.

plugin: eval failed: bayes: (in learn) locker: safe_lock: cannot create tmp lockfile /var/spool/spamassassin/spampd/bayes.lock.*

Comment 20 Bojan Smojver 2021-08-18 12:39:20 UTC
I look into that as well. Maybe lock file in the wrong place or something like that.

Thank you for testing!

Comment 21 Bojan Smojver 2021-08-18 14:19:00 UTC
Looks like this may have something to do with --homedir option, which is new in 2.40. I'll have to dig into the code to find out what happens exactly, but I would not be surprised to see that lock file created there.

Comment 22 Fedora Update System 2021-08-18 14:20:34 UTC
FEDORA-2021-b9ca679007 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-b9ca679007

Comment 23 Fedora Update System 2021-08-18 14:21:09 UTC
FEDORA-2021-93cf007a83 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-93cf007a83

Comment 24 Fedora Update System 2021-08-19 01:42:11 UTC
FEDORA-2021-b9ca679007 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-b9ca679007`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-b9ca679007

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 25 Fedora Update System 2021-08-19 01:51:53 UTC
FEDORA-2021-93cf007a83 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-93cf007a83`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-93cf007a83

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 26 Bojan Smojver 2021-08-19 04:11:32 UTC
I do not have /var/spool/spamassassin on my brand new VM at all, so I am not getting these lock errors. I tried sending some mail through Postfix with spampd checking for spam and I see SpamAssassin headers added. Strace is showing spampd processed doing things. Not quite sure how to replicate this.

Comment 27 Trever Adams 2021-08-19 13:08:46 UTC
I do not have that directory either. As stated, this system is rebuilt recently (fresh install). I am testing the update.

Comment 28 Bojan Smojver 2021-08-19 13:12:27 UTC
The lock file errors - are they just debugging messages? Or do you get spamassassin failures?

Comment 29 Trever Adams 2021-08-19 13:14:52 UTC
I haven't yet tried relearning anything (bayes), due to the fact I am just changing over from dspam.. But a locking error there will lead to corruption. Did the homedir setting end up changing anything?

Comment 30 Bojan Smojver 2021-08-19 14:03:46 UTC
I haven't tried that option, but I would think that you should create those directories where lock files should go, with appropriate ownership and permissions first. If that is indeed what the leaning code wants to use.

Comment 31 Trever Adams 2021-08-19 14:11:52 UTC
      userstate_dir        =>
        '/var/spool/spamassassin/spampd',         # home directory for SA files and plugins (--homedir option)

Since this is not in package (/var/spool/spamassassin) and we do have /var/spool/spampd, can /etc/sysconfig/spampd be updated to use --homedir"?

Comment 32 Trever Adams 2021-08-19 14:12:07 UTC
I mean in package.

Comment 33 Bojan Smojver 2021-08-19 14:46:17 UTC
Yeah, probably. When I'm online tomorrow, I'll build -3 with that and you can give it a try. If you override locally now, you should be able to test without a new package as well.

Comment 34 Trever Adams 2021-08-19 15:49:39 UTC
The change to /etc/sysconfig/spampd described above solves the issue. Thank you.

Comment 35 Fedora Update System 2021-08-19 20:29:24 UTC
FEDORA-2021-b9ca679007 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-b9ca679007

Comment 36 Fedora Update System 2021-08-19 20:29:59 UTC
FEDORA-2021-93cf007a83 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-93cf007a83

Comment 37 Fedora Update System 2021-08-20 01:26:01 UTC
FEDORA-2021-b9ca679007 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-b9ca679007`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-b9ca679007

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 38 Trever Adams 2021-08-20 01:30:43 UTC
This solves it. Thank you.

Comment 39 Fedora Update System 2021-08-20 01:57:25 UTC
FEDORA-2021-93cf007a83 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-93cf007a83`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-93cf007a83

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 40 Fedora Update System 2021-08-27 18:52:02 UTC
FEDORA-2021-b9ca679007 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 41 Fedora Update System 2021-08-27 18:55:28 UTC
FEDORA-2021-93cf007a83 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.