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

    Make kopano-spamd more flexible (configurable spam header)

    Kopano Groupware Core
    kopano-spamd spamd
    6
    12
    1419
    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.
    • fbartels
      fbartels Kopano @Zonk last edited by

      Hi @zonk ,

      if you are willing to work on this you can find contributing information at https://stash.kopano.io/projects/KC/repos/kopanocore/browse/CONTRIBUTING.md.

      Regards Felix

      Resources:
      https://kopano.com/blog/how-to-get-kopano/
      https://documentation.kopano.io/
      https://kb.kopano.io/

      Support overview:
      https://kopano.com/support/

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

        i will try it. sadly i’m not a dev.

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

          Just ran into this same issue. Sent a patch contribution which implements this flexibilty.

          fbartels 1 Reply Last reply Reply Quote 0
          • fbartels
            fbartels Kopano @tph2018 last edited by

            Hi @tph2018 ,

            thanks for your patch. I’ve asked one of our developers to take a look at you patch files and then open a pr internally.

            Ticket for status updates is https://jira.kopano.io/browse/KC-1120.

            Regards Felix

            Resources:
            https://kopano.com/blog/how-to-get-kopano/
            https://documentation.kopano.io/
            https://kb.kopano.io/

            Support overview:
            https://kopano.com/support/

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

              Hi there

              i have a question about this.
              I installed rspamd too and it works but i think kopano-spamd not comunicating with rspamd. Especially move to junk

              is this the only thing that must be do for working ?

              change the setting in python for SPAM Flag
              (note! if do a update you lost it)

              /usr/lib/python2.7/dist-packages/kopano_spamd/__init__.py
              /usr/lib/python3/dist-packages/kopano_spamd/__init__.py

              change booth files from:
              'header_tag': Config.string(default="x-spam-flag")
              to:
              'header_tag': Config.string(default="x-spam")

              and
              (not header or header.upper() != 'YES')):
              to:
              (not header or header.upper() != 'Yes')):

              1 Reply Last reply Reply Quote 0
              • robing
                robing Kopano (Inactive) last edited by

                @noise Actually kopano-spamd is not communicating to whatever spam daemon you are using.

                Kopano-spamd just create eml files of the items that are put in the junk-folder (default location : /var/lib/kopano/spamd/spam)
                You need to create something for you spam daemon (e.g. https://github.com/bkram/inotify-spamlearn)

                You do not need to change the init.py file as header_tag is an config option at the moment just add/change it in /etc/kopano/spamd.cfg
                The last change will never work as the header is all in uppercase so it will never match your change

                If really needed the old spamd is still accessible here https://stash.kopano.io/projects/KSC/repos/kopano-spamd/browse but this was just created as an prove of concept and is not supported.
                But the benefit can be that you the command added on learncmd in the cfg is just used to learn the spam to any spam daemon you are using without creating a separate script

                Regards Robin,

                Need support?
                Have a look at https://kopano.com/support/ for options.

                Helpful resources:
                https://kopano.com/blog/how-to-get-kopano/
                https://documentation.kopano.io/
                https://kb.kopano.io/

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

                  @robing said in Make kopano-spamd more flexible (configurable spam header):

                  learncmd in the cfg

                  do you mean spamcmd

                  i try it and set:

                  [spam]
                  spamcmd = rspamc learn_spam spam/
                  hamcmd = rspamc learn_ham ham/
                  

                  bu t i hangs with python can’t find the modules:
                  os
                  subprocess
                  threading

                  the other modules i install with:
                  apt install python-pip
                  pip install logging configparser inotify

                  ModuleNotFoundError: No module named 'inotify'
                  

                  but notify is installed

                  BMWfan 1 Reply Last reply Reply Quote 0
                  • BMWfan
                    BMWfan @noise last edited by BMWfan

                    @noise i had the same issue as you that it could not find the module.
                    The reason as well the solution are described here: define-ham-and-spam-for-spamassassin

                    noise 1 Reply Last reply Reply Quote 0
                    • noise
                      noise @BMWfan last edited by

                      @BMWfan thanks

                      I installed now on my ubuntu 18.04:

                      apt-get install python3-setuptools
                      apt install python3-pip
                      pip3 install inotify
                      

                      inotify-spamlearn.service is running now but i got more errors:

                      ==> /var/log/syslog <==
                      Jan 16 09:08:49 smtp inotify-spamlearn.py[15363]: cannot stat file spam/
                      Jan 16 09:08:49 smtp inotify-spamlearn.py[15363]: INFO Processing [Inotify] /var/lib/kopano/spamd/spam/0ACAA615C3524AD992F105A5E8B571EE.eml:
                      Jan 16 09:08:49 smtp inotify-spamlearn.py[15363]: INFO Removing file: /var/lib/kopano/spamd/spam/0ACAA615C3524AD992F105A5E8B571EE.eml
                      
                      ==> /var/log/kopano/spamd.log <==
                      2019-01-16 09:08:49,381 - spamd - ERROR - Traceback (most recent call last):
                        File "/usr/lib/python3/dist-packages/kopano/log.py", line 103, in log_exc
                          try: yield
                        File "/usr/lib/python3/dist-packages/kopano_spamd/__init__.py", line 83, in update
                          self.learn(item, searchkey, True)
                        File "/usr/lib/python3/dist-packages/kopano_spamd/__init__.py", line 105, in learn
                          gid = grp.getgrnam(self.sagroup).gr_gid
                      KeyError: 'getgrnam(): name not found: amavis'
                      

                      is amavis needed !? and comes these errors because it is not installed ?

                      BMWfan 1 Reply Last reply Reply Quote 0
                      • BMWfan
                        BMWfan @noise last edited by BMWfan

                        @noise i would like to say it depends on your infrastructure. Is amavis in use in yours?
                        Which sa_group is defined in your /etc/kopano/spamd.cfg?

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

                          @BMWfan no amavis is not in use and sa_group is uncommented in spamd.cfg. only rspamd is installed

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