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

    Bug - Incoming spam emails is not sorted into junk folder

    Kopano Groupware Core
    6
    19
    1193
    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.
    • Blinkiz
      Blinkiz last edited by Blinkiz

      Incoming spam emails is not sorted into junk folder.
      Why?

      root@kopano:[~]: kopano-server -V
      kopano-server 8.7.80
      
      root@kopano:[~]: cat /etc/kopano/dagent.cfg | egrep -v "(^#.*|^$)"
      log_level	=	5
      log_raw_message = yes
      log_raw_message_path = /tmp/raw_messages
      spam_header_name = X-Spam
      spam_header_value = Yes
      
      root@kopano:[~]: grep -i 'spam' /tmp/raw_messages/LMTP_20181204122623_641be4e6.eml
      X-Rspamd-Queue-Id: D428A44FF9
      X-Spamd-Result: default: False [11.15 / 15.00];
      X-Rspamd-Server: smtp
      X-Spam: Yes
      
      Dec 04 12:26:23 kopano kopano-dagent[4694]: Accepted connection from [::ffff:14.153.254.211]:49396
      Dec 04 12:26:23 kopano kopano-dagent[4696]: Starting worker for LMTP request pid 4696
      Dec 04 12:26:23 kopano kopano-dagent[4696]: Resolved recipient arne@xxxxxx.se as user arne
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * Loading plugins started
      Dec 04 12:26:23 kopano kopano-dagent[4696]: ** Checking plugins in /var/lib/kopano/dagent/plugins
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * Loading plugins done
      Dec 04 12:26:23 kopano kopano-dagent[4696]: Mail will be delivered in Inbox
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * PostConverting processing started
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * PostConverting processing done
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * PreDelivery processing started
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * PreDelivery processing done
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * PreRuleProcess processing started
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * PreRuleProcess processing done
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * PostDelivery processing started
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * PostDelivery processing done
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * SendNewMailNotify processing started
      Dec 04 12:26:23 kopano kopano-dagent[4696]: * SendNewMailNotify processing done
      Dec 04 12:26:23 kopano kopano-dagent[4696]: Delivered message to "arne", Subject: "See attachment for more information", Message-Id: <kcis.FE63CF182D8C44568A92F40DDA1A87DC@kopano.xxxxx.io>, size 3662
      Dec 04 12:26:23 kopano kopano-dagent[4696]: Finished processing message
      Dec 04 12:26:23 kopano kopano-dagent[4696]: Raw message saved to "/tmp/raw_messages/LMTP_20181204122623_641be4e6.eml"
      Dec 04 12:26:23 kopano kopano-dagent[4696]: LMTP thread exiting
      

      Postfix has this configuration on a separate virtual host:

      root@smtp:[~]: grep -i 'kopano' /etc/postfix/main.cf
      virtual_transport = lmtp:kopano.lxd:2003
      
      1 Reply Last reply Reply Quote 0
      • AnotherAndy
        AnotherAndy last edited by

        hi @Blinkiz
        this is my config:
        cat /etc/kopano/dagent.cfg | egrep -v “(^#.*|^$)”
        server_socket = file:///var/run/kopano/server.sock
        log_method = file
        log_file = /var/log/kopano/dagent.log
        log_timestamp = 1
        log_raw_message = no
        log_raw_message_path = /tmp
        log_buffer_size = 4096
        tmp_path = /tmp
        server_bind = 127.0.0.1
        lmtp_port = 2003
        lmtp_max_threads = 20
        pid_file = /var/run/kopano/dagent.pid
        spam_header_name = X-Spam-Status
        spam_header_value = Yes,
        archive_on_delivery = no
        plugin_enabled = yes
        plugin_manager_path = /usr/share/kopano-dagent/python
        plugin_path = /var/lib/kopano/dagent/plugins
        set_rule_headers = yes
        no_double_forward = no
        default_charset = iso-8859-15

        check if spam_header_name = X-Spam-Status works

        Blinkiz 1 Reply Last reply Reply Quote -1
        • Blinkiz
          Blinkiz @AnotherAndy last edited by

          @AnotherAndy Am sorry if I was not clear enough. My bad. As you can see in my first post, “X-Spam-Status” does not exist in the incoming email but “X-Spam” does.

          1 Reply Last reply Reply Quote 0
          • jengelh
            jengelh Banned last edited by

            Dec 04 12:26:23 kopano kopano-dagent[4696]: Mail will be delivered in Inbox

            Unless you define some rules, or have some other magical extra component that does it for you, it won’t be moved to Junk.

            Blinkiz 1 Reply Last reply Reply Quote 0
            • Blinkiz
              Blinkiz @jengelh last edited by

              @jengelh Hello there. Thanks for replying.
              In the config file /etc/kopano/dagent.cfg it says

              # The following e-mail header will mark the mail as spam, so the mail
              # is placed in the Junk Mail folder, and not the Inbox.
              # The name is case insensitive.
              # set to empty to not use this detection scheme.
              spam_header_name = X-Spam
              

              I read it as the incoming email will be placed in the Junk Mail folder, and not the inbox. Is that not correct?

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

                Hi @Blinkiz ,
                that’s what I tried to say, use
                “spam_header_name = X-Spam-Status” - without “” in your dagent.cfg
                We had a similar topic here:
                https://forum.kopano.io/topic/125/spam-is-not-sorted-into-junk-folder/4

                Blinkiz 1 Reply Last reply Reply Quote -1
                • Blinkiz
                  Blinkiz @AnotherAndy last edited by

                  @AnotherAndy
                  Okay, I changed back to spam_header_name = X-Spam-Status and it still does not work. Again, I do not have a X-Spam-Status header in my incoming emails. I have X-Spam instead.

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

                    I’m sorry I thought you were also using spamassassin.
                    maybe @jengelh can tell the magic tricks to do

                    Blinkiz 1 Reply Last reply Reply Quote -1
                    • Blinkiz
                      Blinkiz @AnotherAndy last edited by

                      I found why it does not work for me. Look at the incoming message I wrote in my first post.

                      root@kopano:[~]: grep -i 'spam' /tmp/raw_messages/LMTP_20181204122623_641be4e6.eml
                      X-Rspamd-Queue-Id: D428A44FF9
                      X-Spamd-Result: default: False [11.15 / 15.00];
                      X-Rspamd-Server: smtp
                      X-Spam: Yes
                      

                      I then specify to look for X-Spam in my configuration.

                      root@kopano:[~]: cat /etc/kopano/dagent.cfg | egrep -v "(^#.*|^$)"
                      log_level	=	5
                      log_raw_message = yes
                      log_raw_message_path = /tmp/raw_messages
                      spam_header_name = X-Spam
                      spam_header_value = Yes
                      

                      Looking at the source code at https://github.com/Kopano-dev/kopano-core/blob/master/spooler/DAgent.cpp i can see that only the first match is returned. In my Message I first have “X-Spamd-Result” which will be the one Kopano is checking against and not “X-Spam” header.

                      This is a bug in the Kopano code.

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

                        Hi @Blinkiz ,

                        thanks for your report. I have created https://jira.kopano.io/browse/KC-1392 to follow this up.

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

                          I am suffering from the same bug because still running kopano 8.5.9.0 and an update is being planned. But my question is: can I patch my dagent quickly as shown here?

                          https://stash.kopano.io/projects/KC/repos/kopanocore/commits/2cc0820c6ba1e4698ff0bc4d3e00ff017d737b68

                          what do I need to do to patch my existing kopano-dagent with this bugfix? In my understanding it would me need to modify just the line 2114 in dagent.cpp and somehow compile/update it so I can get a patched kopano-dagent binary. Can anyone show me the correct command and steps therefore? I tried to search for a “dagent.cpp” but no hits on my filesystem.

                          any help appreciated

                          1 Reply Last reply Reply Quote 0
                          • jengelh
                            jengelh Banned last edited by jengelh


                            The patch (2cc082) is only in 8.7 and later which, incidentally, made its debut 365 days ago.

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

                              hehe, nice pic :) does that mean I cannot just change this particular line to get/compile a new kopano-dagent ? are there other/many stuff affected for that patch being able to be effective?

                              bhuisman 1 Reply Last reply Reply Quote 0
                              • bhuisman
                                bhuisman @micro last edited by

                                @micro You are running a version that was released more than 1.5 years ago. I can’t tell if ‘just patching’ will lead to trouble - I would recommend that you upgrade to the latest version instead and benefit from all the other improvements and fixes.

                                Regards, Bob

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

                                  definitely you’re right. Nevertheless I am curious if this could be a “faster” workaround. It does not mean I will not upgrade, but the upgrade is more time intensive and currently time is very limited along other projects (higher importance). That was just a thought if I could workaround by this.

                                  however, thanks for your reply.

                                  Blinkiz 1 Reply Last reply Reply Quote 0
                                  • Blinkiz
                                    Blinkiz @micro last edited by

                                    @micro Hello.
                                    To fix his problem without upgrading, change incoming spam header into “X-Spam-Status” or something else that can not match multiple times in your email header. In my case I configure this in rspamd.

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

                                      that’s exactly what I intented to do when this solution mentioned here not possible. Did you configure this in local.d/worker-proxy.inc ?

                                      Blinkiz 1 Reply Last reply Reply Quote 0
                                      • Blinkiz
                                        Blinkiz @micro last edited by

                                        @micro said in Bug - Incoming spam emails is not sorted into junk folder:

                                        that’s exactly what I intented to do when this solution mentioned here not possible. Did you configure this in local.d/worker-proxy.inc ?

                                        I do not remember, sorry. Am running latest version of Kopano now days.

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

                                          ok, solved. Works like a charm now …

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