Automatic Spam Clearing

Having a problem with Automatic Spam Clearing not working. It was working on this server, but stopped a few months ago.

I found this info from 2008 (https://www.virtualmin.com/node/8208) in the support forum, however I don't think the part about a cron job applies anymore, since I have another Virtualmin server where Spam Clearing is functioning and it has no cron job either.

As the forum post suggested, I tried running /etc/webmin/virtual-server/spamclear.pl from the Command Shell in Virtualmin and using Putty this is the message:

Error: Failed to open /home/pdqpdq/Maildir/.spam/cur : Permission denied

The permissions on the .spam/cur folder are 0700 - same as my functioning server.

Are there any logs or setting I should be checking?

Status: 
Closed (fixed)

Comments

Are you fully updated to the latest version of Webmin (1.780)? Because it fixes exactly this issue..

In Software Package Updates this server shows:

webmin web-based administration interface for Unix systems Running latest 1.760 Virtualmin

Refreshing shows "No packages available to be updated were found." Virtualmin Package Updates doesn't show any updates. Maybe I should wait a couple of days and update when it displays.

What does the command dpkg --list webmin output on your system? That should tell you the Webmin version.

I'm having this issue too. No 1.780 yet, still waiting for it to show up for Centos.

dpkg --list webmin shows

1.760

Software Package Updates shows "No packages available to be updated were found." but when I refresh it displays " found 3 possible updates".

aptitude shows three however non of them is for webmin

Ok - can you check if the directory /home/pdqpdq/Maildir/.spam/cur from the error message is actually owned by the expected user pdqpdq ?

In my case, yes.

Error: Failed to open /home/domain/homes/mfrogner/Maildir/.spam/cur : Permission denied

drwx------ 2 mfrogner.domain domain 77824 Aug 24 19:00 cur

/home/pdqpdq/Maildir/.spam$ ls -l total 48

drwx------ 2 pdqpdq pdqpdq 8192 Jun 11 00:58 cur

-rw------- 1 pdqpdq pdqpdq 17408 Mar 2 2014 dovecot.index.cache

-rw------- 1 pdqpdq pdqpdq 3900 Jun 9 2014 dovecot.index.log

-rw------- 1 pdqpdq pdqpdq 150 Jun 9 2014 dovecot-uidlist

drwx------ 2 pdqpdq pdqpdq 8192 Aug 27 12:23 new

drwx------ 2 pdqpdq pdqpdq 4096 Aug 27 12:23 tmp

Can you verify that if you actually login as the pdqpdq user that you can list the /home/pdqpdq/Maildir/.spam/cur directory?

using the pdqpdq user:

$ cd /home/pdqpdq/Maildir/.spam/cur

$ ls -l

total 44

-rw------- 1 pdqpdq pdqpdq 34707 May 4 06:59 1430747949.11868_0.pdqpdq

-rw------- 1 pdqpdq pdqpdq 7673 Jun 10 01:49 1433926155.27108_0.pdqpdq

$

That's very odd - all those permissions look correct.

If you go to the Edit Users page in Virtualmin, click on this user, click the link to view his mail file, select the spam folder and delete a message, do you get the same error?

I was able to delete them using the pdqpdq user or root.

That is odd - the code in both cases should be the same.

Does the spam cleanup fail 100% of the time ... even if you first delete it manually?

Yes it's not working on new spam. I deleted all the spam for a few users on August 12 and now there are several each day afterward. I have the cleanup set at 3 days.

My answers have been pretty much the same as virtualminhab. However here is something interesting I've noticed.

I'll start with running this: find /home//homes//Maildir/.spam/cur/ -type f -mtime +5 -exec rm {} \;, The command appears to run with no error, although is finished instantly and has no effect on excess spam.

Then I'll check a particular user who gets lots of spam by logging into their Usermin CP and see they still have way in excess of the 5 days of spam (only view spam folder, I leave everything there). Now if I go back and run that same command and then refresh the Usermin view for that same user the excess spam has been removed, but not for any other user.

I can repeat this for any user and get the same results. If I go back a week later there will be 7 days of spam instead of 5 and I can repeat the process with the same results. Meanwhile any user I don't do the routine with continues to accumulate spam unchecked.

So in short the command line to rm spam older than 5 days only works right after I view a given users spam folder in Usermin, however with no lasting effect. Hope this was clear.

Still struggling with this. Any work around available?

Error

Failed to open /home/domain/homes/mfrogner/Maildir/.spam/cur : Permission denied

If anyone who is seeing this could allow me to login to your system to debug what's going wrong internally, please send me an email at jcameron@virtualmin.com

Sorry I didn't reply sooner. It appears doing a yum reinstall spamassassin fixed the issue in my case.

cd /usr/share/webmin/virtual-server ; WEBMIN_CONFIG=/etc/webmin strace -fe trace=process,file `pwd`/spamclear.pl

stat("/home/sweetadelines/homes/finance/Maildir/.spam/cur", {st_mode=S_IFDIR|0700, st_size=65536, ...}) = 0
stat("/home/sweetadelines/homes/finance/Maildir/.spam/new", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
stat("/etc/webmin/mailboxes/maildircache", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0
stat("/etc/webmin/mailboxes/maildircache/_home_sweetadelines_homes_finance_Maildir_.spam", {st_mode=S_IFREG|0644, st_size=2500, ...}) = 0
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 5
open("/etc/shadow", O_RDONLY|O_CLOEXEC) = 5
open("/etc/group", O_RDONLY|O_CLOEXEC)  = 5
open("/home/sweetadelines/homes/finance/Maildir/.spam/cur", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 EACCES (Permission denied)
Error: Failed to open /home/sweetadelines/homes/finance/Maildir/.spam/cur : Permission denied

# namei -mo /home/sweetadelines/homes/finance/Maildir/.spam/cur
f: /home/sweetadelines/homes/finance/Maildir/.spam/cur
drwxr-xr-x root                  root          /
drwxr-xr-x root                  root          home
drwxr-x--- sweetadelines         sweetadelines sweetadelines
drwxr-xr-x sweetadelines         sweetadelines homes
drwx------ finance.sweetadelines sweetadelines finance
drwx------ finance.sweetadelines sweetadelines Maildir
drwx------ finance.sweetadelines sweetadelines .spam
drwx------ finance.sweetadelines sweetadelines cur

su - finance.sweetadelines
Cannot execute /dev/null: Permission denied

upgraded to webmin 1.1770 on squeeze and reran the script above. No errors. strace of it showed it unlink spam files.

Ok, it looks like Webmin 1.770 fixes this then. This version will be rolled out to all virtualmin uses soon.

Automatically closed -- issue fixed for 2 weeks with no activity.