mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
13.99k stars 1.44k forks source link

spampd cannot open bayes databases #534

Closed 0xFelix closed 8 years ago

0xFelix commented 9 years ago

I get these errors from time to time. I did not change any permissions on the /home/user-data directory.

Aug 27 09:41:49 mail spampd[1516]: processing message (unknown) for <user@mydomain.tld>
Aug 27 09:41:49 mail spampd[1516]: bayes: cannot open bayes databases /home/user-data/mail/spamassassin/bayes_* R/O: tie failed: Permission denied#012
Aug 27 09:41:50 mail spampd[1516]: clean message (unknown) (0.55/5.00) from <> for <user@mydomain.tld> in 0.22s, 6630 bytes.

Is this a bug?

Futurama56 commented 9 years ago

+1 fixed with cd /home/user-data/mail/spamassassin/ chown spampd:spampd bayes_toks service spampd restart

0xFelix commented 9 years ago

That did the trick! But according to the setup/spamassassin.sh script it should have already been owned by spampd. Weird...

nomandera commented 9 years ago

I suggest this is re-opened as on my default install it is owned by the mail user

ls -al /home/user-data/mail/spamassassin
drwxrwx--- 2 spampd spampd 4096 Sep 4 10:24 . drwxrwxr-x 7 root www-data 4096 Apr 9 12:44 .. -rw-rw---- 1 spampd spampd 647168 Aug 25 19:57 bayes_seen -rw------- 1 mail mail 4317184 Aug 25 19:57 bayes_toks

nomandera commented 9 years ago

I just upgraded to 13b and it has changed

ls -al /home/user-data/mail/spamassassin total 4604 drwxrwx--- 2 spampd spampd 4096 Sep 4 16:41 . drwxrwxr-x 7 root www-data 4096 Sep 4 15:54 .. -rw-rw---- 1 spampd spampd 647168 Sep 4 16:41 bayes_seen -rw-rw---- 1 spampd spampd 4317184 Sep 4 16:41 bayes_toks

JoshData commented 9 years ago

This is a long-standing problem that I haven't been able to track down. I think the permissions get reset when the antispam plugin spawns spamassassin when moving mail in/out of the Spam folder.

yodax commented 8 years ago

@JoshData Did you already try setting bayes_file_mode=0660 in /etc/spamassassin/local.cf ? I am giving that a go.

yodax commented 8 years ago

I have created a branch with the setting above and haven't seen the problem in 3 days. I have a cronjob monitoring this.

Examining the logs showed it came back after a reinstall every few days. So I will test it for a few more days.

mariusv commented 8 years ago

Heya,

This still occurs.

root@box:~# ls -al /home/user-data/mail/spamassassin
total 5176
drwxrwx--- 2 spampd spampd      4096 Aug  1 15:14 .
drwxrwxr-x 7 root   www-data    4096 Jul 30 21:00 ..
-rw-rw---- 1 spampd spampd   2625536 Jul 29 13:03 bayes_seen
-rw-rw---- 1 mail   mail     4825088 Jul 29 13:03 bayes_toks
yodax commented 8 years ago

Do you also see the log messages?

mariusv commented 8 years ago

Yep:

Aug  1 15:14:35 box spampd[1630]: bayes: cannot open bayes databases /home/user-data/mail/spamassassin/bayes_* R/O: tie failed: Permission denied#012
Aug  1 15:14:37 box spampd[1630]: bayes: cannot open bayes databases /home/user-data/mail/spamassassin/bayes_* R/W: tie failed: Permission denied#012
yodax commented 8 years ago

I checked; on my box it happened on the 18th for the last time.

The file does have group permissions now, but that doesn't solve it. I'll try and have a look.

Would there be a risk in making them world writeable? So go with 666.

yodax commented 8 years ago

I'm running a test on my box with 666 as the file mode.

yodax commented 8 years ago

Since I changed the setup script to configure spamassasin file mode to 666 the file has changed ownership again to the mail user but with 666 rights. No errors occur in the log file. So it seems to be working.

I see a lot of post recommending to make the database world writeable.