mod_antispam: initial import from ejabberd-contrib/mod_spam_filter
At that point this is very preliminary. Missing
- [x] tests Not sure where to add tests. Would be a major but rewarding effort. Please advice!
- [x] documentation https://github.com/processone/docs.ejabberd.im/pull/136 - for current status
- [x] ~merge
mod_muc_rtbl(maybe)~ Otherwise we'd have to configure RTBL hosts in different places. Also code-wise we would avoid duplicate functionality and avoid differing behavior
Current config:
modules:
[...]
mod_antispam:
rtbl_host: "xmppbl.org"
rtbl_domains_node: "spam_source_domains"
spam_domains_file: "/etc/ejabberd/spam-filter/domains.txt"
spam_jids_file: "/etc/ejabberd/spam-filter/jids.txt"
spam_urls_file: "/etc/ejabberd/spam-filter/urls.txt"
spam_dump_file: "/var/log/ejabberd/spam_dump.log"
access_spam:
allow:
user: [email protected]
If mod_muc_rtbl's functionality were to be merged into this module that config might need to change, especially wrt either have just one or more rtbl hosts.
Proposed change:
modules:
[...]
mod_antispam:
rtbl_hosts:
- xmppbl.org:
- spam_source_domains
- muc_bans_sha256
- rtbl.example.org:
- spam_source_domains: custom_node
rtbl_policy:
spam_source_domains: more_than_one
muc_bans_sha256: one
Possible rtbl_policy values are one|more_than_one|all. Ideas?
I had plans to remove the gen_server in this code and instead just use ets tables. Would make the code easier to navigate since you wouldn't have to jump between different places. But then, keeping the fd for the dump file requires a gen_server, that's why I stuck with it for now.
coverage: 34.092% (+0.4%) from 33.646% when pulling 7b08289799618d7d8c20757e0b6a38027b388fa4 on sstrigler:mod_antispam into c78e99dd543bee1b4bf7e3b3837c5ccd1baf1900 on processone:master.
Just a quick status report. Weather has been great and it's spring after all, so I've been out hiking. But before that, I started implementing some rudimentary tests, but more work needs to be done there.
I've come to the conclusion that I'd not want to merge mod_muc_rtbl functionality right now, but rather ship a first version just as is and then at some later point integrate what mod_muc_rtbl does right now and deprecate it. Except there's some objection of course.