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 error - PermissionError: [Errno 1] Operation not permitted

    Kopano Groupware Core
    9
    53
    5785
    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.
    • cblaha
      cblaha last edited by

      I’ve installed kopano-spamd. When i replace a mail to my spam folder spamd.log shows the following:

      2018-12-31 15:29:47,517 - spamd - INFO - Learning message as SPAM, entryid: 00000000F83B1B5FC8F84509B0B0AE1E455E5161010000000500000050D56204F22E4925A580F1210959044500000000
      2018-12-31 15:29:47,537 - 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 106, in learn
      os.chown(emlfilename, uid, gid)
      PermissionError: [Errno 1] Operation not permitted: ‘/var/lib/kopano/spamd/spam/6711C711D4324340B385C9A3F6ED2232.eml’

      What’s wrong here?

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

        Read the info block at the end of https://documentation.kopano.io/kopanocore_administrator_manual/special_kc_configurations.html#configuring-kopano-spamd-for-automatic-spam-ham-learning

        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
        • cblaha
          cblaha last edited by

          I’ve add the following line to /etc/sudoers:

          kopano ALL=(amavis) NOPASSWD: /usr/bin/sa-learn --spam

          and kopano-spamd is running aus the user kopano

          kopano 19255 1 0 15:29 ? 00:00:01 /usr/bin/python3 /usr/sbin/kopano-spamd -F

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

            @cblaha this is not what the documentation tells you. Additionally I am not sure if spamd uses sudo at all.

            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
            • cblaha
              cblaha last edited by

              @fbartels: So, i don’t understand the documentation. Must i add the user to the group amavis?

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

                kopano-spamd by default runs in the user context of the user kopano (as defined by run_as_user and run_as_group). To succesfully run sa-learn make sure that the provided user is both part of the amavis group (so spamassasin can process the item), as well as local_admin_user within Kopano (so kopano-spamd has access to the users mailboxes).

                Yes, you could add the Kopano user to the amavis group.

                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
                • cblaha
                  cblaha last edited by

                  I am so desperate. This is my /etc/group

                  amavis:x:116:clamav,kopano
                  kopano:x:996:kapi,konnect,amavis,spamassassin
                  spamassassin:x:1007:kopano
                  spamd:x:5555:spamassassin,kopano

                  The Logfile always shows:

                  2018-12-31 16:28:16,639 - spamd - INFO - Learning message as SPAM, entryid: 00000000F83B1B5FC8F84509B0B0AE1E455E51610100000005000000E787D0AFFB7047ABB8F6EBD1DDE8AE6F00000000
                  2018-12-31 16:28:16,676 - 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 106, in learn
                  os.chown(emlfilename, uid, gid)
                  PermissionError: [Errno 1] Operation not permitted: ‘/var/lib/kopano/spamd/spam/FFAC2B62292B4D3887ABE9DDE18C87DA.eml’

                  Whats wrong with my configuration?

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

                    Using the default configuration? Would need to check on a test system next week.

                    For some dedicated attention I would recommend to open a support case.

                    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
                    • fbartels
                      fbartels Kopano last edited by

                      It certainly is a bit strange. I did some test as wekk and I get the same error message:

                      2019-01-02 15:52:15,041 - spamd - INFO - Learning message as SPAM, entryid: 00000000D5713A05C54F4CBB9899E84DD9B593FE0100000005000000548FAD18C4534CA78B2374C46D55FD2700000000
                      2019-01-02 15:52:15,042 - 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 106, in learn
                          os.chown(emlfilename, uid, gid)
                      PermissionError: [Errno 1] Operation not permitted: '/var/lib/kopano/spamd/spam/E6F09EA690A54940988C8C8467345422.eml'
                      

                      what makes it even stranger, what the script does when giving the error is a chown, and doing this manually works: sudo -H -u kopano chown kopano:amavis /var/lib/kopano/spamd/spam/E6F09EA690A54940988C8C8467345422.eml

                      Will need to check with a python developer tomorrow.

                      PS: nevertheless I updated the manual to make the steps more clear and also added a hint to the repo where you got that sudoers stuff from that the content of the repo are outdated. https://documentation.kopano.io/kopanocore_administrator_manual/special_kc_configurations.html#configuring-kopano-spamd-for-automatic-spam-ham-learning

                      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
                      • fbartels
                        fbartels Kopano last edited by

                        Diving into this caused quite some head scratching. The issue is caused by failing over to the bundled daemon module in python-kopano, which was still required in the python2 world, but not anymore in python3. The issue should go away when you install the python3-module manually. We will add this as an official dependency soon.

                        https://packages.debian.org/stretch/python3-daemon

                        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
                        • BMWfan
                          BMWfan last edited by BMWfan

                          I have tried it now also in the newest Version (kopano-spamd_8.7.80.424.3b35b58f3-0+49.1_amd64.deb) but also there is the problem not fixed:

                          2019-01-05 14:00:58,351 - spamd - INFO - Learning message as SPAM, entryid: 00000000A497753E7B1B4CE3894BB06ABB7C1F4501000000050000003AF8292887AE435FA977C1660CBA61C500000000
                          2019-01-05 14:00:58,377 - 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 106, in learn
                              os.chown(emlfilename, uid, gid)
                          PermissionError: [Errno 1] Operation not permitted: '/var/lib/kopano/spamd/spam/B469CB25904A45A79A66D3F5B6882661.eml'
                          
                          1 Reply Last reply Reply Quote 0
                          • ashceryth
                            ashceryth last edited by

                            @BMWfan

                            Did you install python3-daemon manually as suggested by @fbartels ?

                            Assuming you’re running Debian: apt-get install python3-daemon

                            BMWfan 1 Reply Last reply Reply Quote 0
                            • cblaha
                              cblaha last edited by

                              @fbartels: I’ve installed python3-daemon via apt-get but I get the error already.

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

                                @ashceryth yes, but i doesn’t work.

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

                                  @fbartels have you changed more then only installing the python-deamon?

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

                                    try both
                                    apt install python-daemon python3-daemon

                                    and/or
                                    apt install python-daemonize python3-daemonize

                                    And what are the rights on : /var/lib/kopano/spamd/spam/
                                    i havent looked at my system, but the rights are probley 755
                                    you can try
                                    chmod -R 1770 /var/lib/kopano/spamd

                                    adduser spamassassin kopano
                                    adduser amavis kopano

                                    restart spamassassin and amavis

                                    BMWfan 1 Reply Last reply Reply Quote 0
                                    • cblaha
                                      cblaha last edited by

                                      I’ve now installed

                                      python-daemon, python3-daemon,python-daemonize, python3-daemonize

                                      but i got always the same error message.

                                      I always changed the permission on /var/lib/kopano/spamd and add the user to the group kopano.

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

                                        @thctlo i’ve already done and now again without any progress depending on the failure.

                                        1 Reply Last reply Reply Quote 0
                                        • A Former User
                                          A Former User last edited by

                                          i have the same problem on centos 7.

                                          2019-01-09 21:08:27,656 - spamd - ERROR - Traceback (most recent call last):
                                          File “/usr/lib/python2.7/site-packages/kopano/log.py”, line 103, in log_exc
                                          try: yield
                                          File “/usr/lib/python2.7/site-packages/kopano_spamd/init.py”, line 83, in update
                                          self.learn(item, searchkey, True)
                                          File “/usr/lib/python2.7/site-packages/kopano_spamd/init.py”, line 106, in learn
                                          os.chown(emlfilename, uid, gid)
                                          OSError: [Errno 1] Operation not permitted: ‘/var/lib/kopano/spamd/spam/EEEE4E84C38D4D4DAC3EC2BCA3CD477A.eml’

                                          1 Reply Last reply Reply Quote 0
                                          • mark dufour
                                            mark dufour last edited by

                                            which version of python3-daemon are you using? so we can try to reproduce the problem here…

                                            A Former User BMWfan 3 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post