Make kopano-spamd more flexible (configurable spam header)
Zonk last edited by Zonk
it would be nice, if I could configure kopano-spamd more flexible to use it with other spamfilters than spamassasin. I currently use rspamd which is using “X-Spam: Yes” instead of “X-Spam-Flag: YES” in mail headers. I found the check in the code and edited it manually for my needs.
I replaced X-Spam-Flag with X-Spam and “YES” with “Yes” ;) I hope someone could make it configurable in spamd.cfg.
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.
Zonk last edited by
i will try it. sadly i’m not a dev.
tph2018 last edited by
Just ran into this same issue. Sent a patch contribution which implements this flexibilty.
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.
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)
change booth files from:
(not header or header.upper() != 'YES')):
(not header or header.upper() != 'Yes')):
@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
noise last edited by noise
learncmd in the cfg
do you mean
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:
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 last edited by BMWfan
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: cannot stat file spam/ Jan 16 09:08:49 smtp inotify-spamlearn.py: INFO Processing [Inotify] /var/lib/kopano/spamd/spam/0ACAA615C3524AD992F105A5E8B571EE.eml: Jan 16 09:08:49 smtp inotify-spamlearn.py: 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 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?
@BMWfan no amavis is not in use and sa_group is uncommented in spamd.cfg. only rspamd is installed