Navigation

    Kopano
    • Register
    • Login
    • Search
    • Categories
    • Get Official Kopano Support
    • Recent
    Statement regarding the closure of the Kopano community forum and the end of the community edition

    kopano-spamd won't learn any spam

    Kopano Groupware Core
    4
    6
    3083
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Gerrit507
      Gerrit507 last edited by

      Hello Guys,

      I’ve setup kopano-spamd on Ubuntu 16.04. I had it already working properly but I think after moving my installation to another disk with rsync my spam-db was lost or something else went wrong.

      If I drag a spam mail to the spam folder, I always get:

      2017-03-21 15:44:06,079 - spamd - INFO - [gerrit] sa-learn: Learned tokens from                                                                                                                                                              0 message(s) (1 message(s) examined)
      

      in the spamd.log

      spamassasin debug log shows:
      http://pastebin.com/si6MDe6i

      For debugging I’ve set the permissions of /home/gerrit/.spamassasin to 777 and still it won’t learn anything. The example spam-mail even shows a score above 5, it was an old mail I found in my inbox. I don’t see any reason why it doesn’t work anymore.

      Any help is appreciated :)

      1 Reply Last reply Reply Quote 0
      • Gerrit507
        Gerrit507 last edited by

        Ok, I’ve found the reason. The script creates a folder in /tmp on start called tmp(something) with rwx permissions only for the user kopano , but sa-learn is called with the user amavis. After running the script from commandline I got the following output:

         suconfig: path "/tmp/tmpgQePIs/.spamassassin" is inaccessible: Permission denied
        config: path "/tmp/tmpgQePIs/.spamassassin/user_prefs" is inaccessible: Permission denied
        do config: path "/tmp/tmpgQePIs/.spamassassin" is inaccessible: Permission denied
        config: path "/tmp/tmpgQePIs/.spamassassin" is inaccessible: Permission denied
        bayes: expire_old_tokens: locker: safe_lock: cannot create lockfile /tmp/tmpgQePIs/.spamassassin/bayes.mutex: Permission denied
        plugin: eval failed: bayes: (in learn) locker: safe_lock: cannot create lockfile /tmp/tmpgQePIs/.spamassassin/bayes.mutex: Permission denied
        ERROR: the Bayes learn function returned an error, please re-run with -D for more information at /usr/bin/sa-learn line 501.
        

        If I do a chmod 777 on that folder everything works fine. Does anybody have an idea how to change that permissions the script sets? If anybody is wondering, I’m talking about this script https://kb.kopano.io/display/WIKI/Kopano-spamd

        Thanks

        externa1 1 Reply Last reply Reply Quote 0
        • externa1
          externa1 @Gerrit507 last edited by externa1

          @Gerrit507

          I followed this
          0_1490821532838_upload-2d7f39d9-d52f-4de0-a568-3ddd779a33c6
          as described here
          https://kb.kopano.io/display/WIKI/Kopano-spamd

          and that works for me

          rg

          Christian

          Gerrit507 1 Reply Last reply Reply Quote 0
          • Gerrit507
            Gerrit507 @externa1 last edited by

            @externa1 I have this line, too. The issue is still that the user kopano creates a folder which the user amavis can not access. Do you use mysql or files for spamassassin? This user also reports that it only works with mysql. I think it could be the same issue.

            https://forum.kopano.io/topic/134/kopano-spamd-won-t-learn-any-spam

            1 Reply Last reply Reply Quote 0
            • burgessja
              burgessja last edited by

              Sorry to bump an old thread, but I didn’t see a solution to this anywhere, and wanted to add mine in case anyone else comes across this problem. When using amavisd-new, you can force sa-learn to use the correct Bayes Database by specifying:

              bayes_path /var/lib/amavis/.spamassassin/bayes
              

              in /etc/mail/spamassassin/local.cf

              1 Reply Last reply Reply Quote 0
              • thctlo
                thctlo last edited by

                Hai,

                I use this setup on debian stretch with spamassassin and this works great.
                Small side note, i use Spamassassin and Bayes in MariaDB (mysql).
                setup found here:
                https://p5r.uk/blog/2017/spamassassin-with-mariadb.html

                my steps:
                get the source of kopano-spamd and put them in /usr/local/bin
                imo, should be in sbin, but lets ignore that for now.

                create the systemd file : /etc/systemd/system/kopano-spamd.service

                [Unit]
                Description=Kopano Core Spamd (Community)
                After=kopano-server.service kopano-gateway.service mariadb.service mysql.service
                Wants=kopano-server.service kopano-gateway.service mariadb.service mysql.service
                
                [Service]
                Type=simple
                Environment=LC_ALL=C LANG=C
                ExecStart=/usr/local/bin/kopano-spamd.py -F
                ExecReload=/bin/kill -HUP $MAINPID
                
                [Install]
                WantedBy=multi-user.target
                

                In /usr/local/bin/kopano-spamd.py.
                change the first line to :
                #!/usr/bin/env python2

                change the “learncmd” in the CONFIG= part.
                I changed the user/group to kopano and spamassassin to debian-spamd.

                CONFIG = {
                    'run_as_user': Config.string(default="kopano"),
                    'run_as_group': Config.string(default="kopano"),
                    'learncmd': Config.string(default="/usr/bin/sudo -u debian-spamd /usr/bin/sa-learn --spam")
                }
                

                I used spamassassing with clamav so change that to amavis.
                Dont forget to allow the amavis user in your spamassassin folders,
                This is not needed when you run in SQL setup with spamassassin/amavis.

                i did also notice a few python dependecies that i was missing.
                that one or more of these fixed my issue.
                python-configobj python-linecache2 python-traceback2 python-tracer

                Greetz,
                Louis

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post