Mailscanner SA Bayes Permissions

Discussion in 'Server Operation' started by klausengelmann, Mar 19, 2009.

  1. klausengelmann

    klausengelmann New Member

    Hello everybody !!!

    After a complete installation of Postfix + Mailscanner + SA + Mailwatch according to some Howtoforge Tutorials I run into this error:

    A Learn: error code 13 returned from sa-learn: bayes: cannot open bayes databases /var/spool/MailScanner/spamassassin/bayes_* R/O: tie failed: Permission denied bayes: cannot open bayes databases /var/spool/MailScanner/spamassassin/bayes_* R/W: tie failed: Permission denied bayes: cannot open bayes databases /var/spool/MailScanner/spamassassin/bayes_* R/W: tie failed: Permission denied bayes: cannot open bayes databases /var/spool/MailScanner/spamassassin/bayes_* R/W: tie failed: Permission denied ERROR: the Bayes learn function returned an error, please re-run with -D for more information Learned tokens from 0 message(s) (1 message(s) examined)
    Delete: deleted file /var/spool/MailScanner/quarantine/20090319/spam/9C5428630220.2DC3A

    My filesystem permissions regarding this problem are:

    [root@prometeu spamassassin]# pwd
    /var/spool/MailScanner/spamassassin
    [root@prometeu spamassassin]# ls -lah
    total 10M
    drwxrwsr-x 2 postfix apache 4.0K Mar 19 16:25 .
    drwxr-xr-x 5 postfix postfix 4.0K Dec 1 16:11 ..
    -rw------- 1 postfix postfix 2.5M Mar 19 16:25 auto-whitelist
    -rw------- 1 postfix apache 29K Mar 19 16:25 bayes_journal
    -rw-rw---- 1 apache apache 30 Mar 19 16:23 bayes.mutex
    -rw-rw---- 1 postfix apache 5.0M Mar 19 16:25 bayes_seen
    -rw------- 1 postfix apache 5.0M Mar 19 16:25 bayes_toks
    [root@prometeu spamassassin]#

    The worst thing is that if I change the permissions according to what it is recommended here (g+rw) after some the permissions change again.

    I also tried to edit /etc/MailScanner/spam.assassin.prefs.conf without success.

    Anyone knows how to solve this issue ?

    I like to train my SA using Bayes.

    Thanks,

    Klaus
     
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    What user is getting this error (i.e., what user is trying to access /var/spool/MailScanner/spamassassin/bayes_*)?

    Is this the Spamsnake tutorial you're using?
     
  3. klausengelmann

    klausengelmann New Member

    Thanks for your reply falko !!!

    The tutorial I was using was:

    Virtual Users And Domains With Postfix, MailScanner, Mailwatch & MySQL On CentOS 5.1

    I also took a look a the Perfect SpamSnake but I am still having the same problem. Using mailwatch there is an error pointing to bayes_* files in /var/spool/Mailscanner/spamassassin directories.

    Any thoughts about the issue ?

    Klaus Engelmann
    UFCSPA - Brazil
     
  4. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Did you disable SELinux?
     
  5. klausengelmann

    klausengelmann New Member

    Yes, indeed SElinux is disabled.

    By the way, I tried this on /etc/MailScanner/MailScanner.conf

    Run As User = postfix
    Run As Group = postfix

    Incoming Work User =
    Incoming Work Group = clamav

    Quarantine User = root
    Quarantine Group = apache

    SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin

    Quarantine Permissions = 0660
    Incoming Work Permissions = 0640

    Rebuild Bayes Every = 0
    Wait During Bayes Rebuild = no

    And this is what I done on /etc/MailScanner/spam.assassin.prefs.conf:

    bayes_path /var/spool/MailScanner/spamassassin/bayes
    bayes_file_mode 0660
    # bayes_auto_learn 0
    #bayes_auto_expire 0

    The error still continues. Because I am running out of resources I am ready to investigate the VMWARE image available.

    Any other suggestions ?

    Klaus Engelmann
     
  6. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    What happens when you use
    Code:
    bayes_path /var/spool/MailScanner/spamassassin/bayes
    bayes_file_mode 0666
    ?
     
  7. klausengelmann

    klausengelmann New Member

    falko:

    Thanks for your suggestion. But I am still having the same error.

    Look this:
    SA Learn: error code 13 returned from sa-learn:

    bayes: locker: safe_lock: cannot create lockfile /var/spool/MailScanner/spamassassin/bayes.mutex: Permission denied
    bayes: expire_old_tokens: locker: safe_lock: cannot create lockfile /var/spool/MailScanner/spamassassin/bayes.mutex: Permission denied
    bayes: locker: safe_lock: cannot create lockfile /var/spool/MailScanner/spamassassin/bayes.mutex: Permission denied Learned tokens from 0 message(s) (1 message(s) examined)

    The filesystem permissions used on my experiencies were:


    1) First

    [root@prometeu spamassassin]# ls -lah
    total 11M
    drwxrwsr-x 2 postfix apache 4.0K Mar 22 13:38 .
    drwxrwxr-x 5 postfix postfix 4.0K Dec 1 16:11 ..
    -rw-rw---- 1 postfix postfix 2.5M Mar 22 13:38 auto-whitelist
    -rw-rw-rw- 1 postfix apache 100K Mar 22 13:38 bayes_journal
    -rw-rw---- 1 postfix postfix 36 Mar 19 20:25 bayes.mutex
    -rw-rw-rw- 1 postfix apache 5.0M Mar 22 13:34 bayes_seen
    -rw-rw-rw- 1 postfix apache 5.2M Mar 22 13:34 bayes_toks

    2) Second.

    [root@prometeu spamassassin]# chown root bayes_*

    [root@prometeu spamassassin]# ls -lah
    total 11M
    drwxrwsr-x 2 postfix apache 4.0K Mar 22 13:38 .
    drwxrwxr-x 5 postfix postfix 4.0K Dec 1 16:11 ..
    -rw-rw---- 1 postfix postfix 2.5M Mar 22 13:38 auto-whitelist
    -rw-rw-rw- 1 root apache 100K Mar 22 13:38 bayes_journal
    -rw-rw---- 1 postfix postfix 36 Mar 19 20:25 bayes.mutex
    -rw-rw-rw- 1 root apache 5.0M Mar 22 13:34 bayes_seen
    -rw-rw-rw- 1 root apache 5.2M Mar 22 13:34 bayes_toks

    After all this I was wondering which user is used to run sa-bayes ? Or better than that: which user is used to run Spamassassin.

    Thanks for all you effort.

    Klaus Engelmann
     
  8. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    What's the output of
    Code:
    ps aux | grep -i spam
    ?
     
  9. klausengelmann

    klausengelmann New Member

    Falko:

    Now I am worried. Look at this output:

    [root@prometeu ~]# ps aux | grep -i spam
    root 12498 0.0 0.0 3908 716 pts/0 S+ 20:00 0:00 grep -i spam

    There is something that should be noticed here ?

    I thought that MailScanner was responsible to run Spamassassin as part of its rules and other tests, jusk like amavisd-new does.

    Here are other services related to the installation I completed following the howtoforge tutorials mentioned before.

    As soon as I complete some tests I'll post here.

    Thanks falko,

    [root@prometeu ~]# ps gauwx

    clamav 2938 0.1 2.2 223024 185464 ? Ss Mar04 28:01 clamd

    sqlgrey 3078 0.0 0.1 17144 9676 ? Ss Mar04 0:59 /usr/bin/perl -w /usr/sbin/sqlgrey -d

    apache 3780 0.2 0.6 71436 49708 ? S 11:14 1:31 /usr/sbin/httpd

    postfix 8542 0.0 0.6 78700 49924 ? S 18:39 0:02 MailScanner: waiting for messages
    postfix 8561 0.0 0.6 79480 51080 ? S 18:39 0:04 MailScanner: waiting for messages

    postfix 10819 0.0 0.0 6800 1768 ? S 19:27 0:00 anvil -l -t unix -u
    postfix 10872 0.1 0.6 78804 50384 ? S 19:28 0:02 MailScanner: waiting for messages

    postfix 11246 0.1 0.5 77744 49316 ? S 19:38 0:01 MailScanner: waiting for messages
    apache 11317 0.1 0.5 67904 45416 ? S 19:39 0:01 /usr/sbin/httpd
    postfix 11466 0.1 0.6 78588 49756 ? S 19:41 0:01 MailScanner: waiting for messages
    postfix 11478 0.0 0.2 33096 23500 ? S 19:41 0:00 MailWatch SQL
    postfix 11687 0.0 0.0 6804 1764 ? S 19:44 0:00 pickup -l -t fifo -u

    postfix 12352 0.0 0.0 6836 2076 ? S 19:58 0:00 trivial-rewrite -n rewrite -t unix -u
    postfix 12356 0.0 0.0 6796 1708 ? S 19:58 0:00 spawn -n spfpolicy -t unix user=nobody argv=/usr/bin/perl /usr/local/lib/postfix-policyd-spf-
    postfix 12358 0.0 0.0 7076 2304 ? S 19:58 0:00 cleanup -z -t unix -u
    postfix 12370 0.0 0.0 6844 1816 ? S 19:58 0:00 pipe -n dovecot -t unix flags=DRhu user=vmail vmail argv=/usr/libexec/dovecot/deliver -f ${se
    postfix 12398 0.0 0.0 7336 3464 ? S 19:59 0:00 smtpd -n smtp -t inet -u
    postfix 12400 0.0 0.0 6844 1816 ? S 19:59 0:00 pipe -n dovecot -t unix flags=DRhu user=vmail vmail argv=/usr/libexec/dovecot/deliver -f ${se
    postfix 12402 0.0 0.0 6840 1812 ? S 19:59 0:00 pipe -n dovecot -t unix flags=DRhu user=vmail vmail argv=/usr/libexec/dovecot/deliver -f ${se
    postfix 12414 0.0 0.0 6796 1712 ? S 20:00 0:00 spawn -n spfpolicy -t unix user=nobody argv=/usr/bin/perl /usr/local/lib/postfix-policyd-spf-

    nobody 12415 0.0 0.0 9828 8116 ? Ss 20:00 0:00 /usr/bin/perl /usr/local/lib/postfix-policyd-spf-perl

    postfix 12598 0.0 0.0 6892 2140 ? S 20:02 0:00 local -t unix


    postfix 12630 0.0 0.0 6968 1992 ? S 20:03 0:00 smtp -t unix -u
    postfix 12631 0.0 0.0 6968 1936 ? S 20:03 0:00 smtp -t unix -u
    postfix 12632 0.0 0.0 6972 1940 ? S 20:03 0:00 smtp -t unix -u
    postfix 12633 0.0 0.0 6972 1996 ? S 20:03 0:00 smtp -t unix -u
    postfix 12634 0.0 0.0 6840 1744 ? S 20:03 0:00 bounce -z -n defer -t unix -u
    postfix 12638 0.0 0.0 7336 3216 ? S 20:03 0:00 smtpd -n smtp -t inet -u

    postfix 17118 0.0 0.0 6980 2016 ? S 04:13 0:01 qmgr -l -t fifo -u
    postfix 17164 0.0 0.0 6804 1824 ? S 04:13 0:00 tlsmgr -l -t unix -u

    root 22194 0.0 0.0 6744 1772 ? Ss Mar22 0:05 /usr/libexec/postfix/master
    postfix 22227 0.0 0.2 26624 20268 ? Ss Mar22 0:00 MailScanner: starting child
     
  10. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Hm, I can't tell what's wrong... :(
     
  11. rayit

    rayit New Member

    Same error overhere

    -rwxrwxr-x 1 postfix www-data 2.0K Mar 17 22:54 bayes.mutex*
    -rw------- 1 postfix postfix 15K Mar 17 22:54 bayes_journal
    -rwxrwxr-x 1 postfix www-data 37M Mar 17 22:54 bayes_seen*
    -rwxrwxr-x 1 postfix www-data 10M Mar 17 22:54 bayes_toks*


    Problem is that mailscanner recreated file and changes rights back to postfix:postfix.
    693C26406A.1C49A spam SA Learn: Learned tokens from 0 message(s) (1 message(s) examined)
    DDE4F64015.3A396 spam SA Learn: bayes: bad permissions on journal, can't read: /var/spool/MailScanner/spamassassin/bayes_journal, Learned tokens from 0 message(s) (1 message(s) examined)

    Someone idea where to change this setting?

    many thanks
    Raymond
    RayIT
     
  12. klausengelmann

    klausengelmann New Member

    Bad news

    Dear Friend:

    If you follow my thread here there was no answer to this problem.

    I am sorry to tell you that after one year I didn't find a suitable solution to this problem.

    In fact you are the second one who has the exact issue.

    I follow all the instructions on the SPAM SNAKE tutorial here without success.

    Anything I can help you, just ask.

    Klaus
     
  13. Pas

    Pas New Member

    if error sent by mail, from cron deamon

    /etc/cron.daily/amavisd-new:
    bayes: cannot open bayes databases /var/spool/MailScanner/spamassassin/bayes_* R/O: tie failed: Permission denied
    bayes: locker: safe_lock: cannot create lockfile /var/spool/MailScanner/spamassassin/bayes.mutex: Permission denied

    bayes: expire_old_tokens: locker: safe_lock: cannot create lockfile /var/spool/MailScanner/spamassassin/bayes.mutex: Permission denied


    Than view
    cd /var/spool/Mailscanner
    check Permissions
    ls -alFh

    and change permissions on Spamassassin
    chmod 777 spamassassin

    and all files within de spamassassin folder.

    that helps for my :)

    Pascal Haan
     

Share This Page