Bug - Incoming spam emails is not sorted into junk folder
-
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
-
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-15check if spam_header_name = X-Spam-Status works
-
@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.
-
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.
-
@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?
-
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 -
@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. -
I’m sorry I thought you were also using spamassassin.
maybe @jengelh can tell the magic tricks to do -
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.
-
Hi @Blinkiz ,
thanks for your report. I have created https://jira.kopano.io/browse/KC-1392 to follow this up.
-
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?
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
-
The patch (2cc082) is only in 8.7 and later which, incidentally, made its debut 365 days ago. -
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?
-
@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.
-
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.
-
@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. -
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 ?
-
@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.
-
ok, solved. Works like a charm now …