Mercurial > prosody-modules
annotate mod_anti_spam/README.markdown @ 6562:5da6fb562df9 default tip
mod_unified_push: Fix push error handling (fixes #2000)
Use the error object that send_iq() passes
as an argument to it's reject callback instead of attempting
and failing to do the parsing in the callback itself.
| author | kmq |
|---|---|
| date | Mon, 06 Jul 2026 14:23:57 +0200 |
| parents | 0afd83bbdf09 |
| children |
| rev | line source |
|---|---|
| 6095 | 1 --- |
| 2 labels: | |
| 3 - 'Stage-Alpha' | |
| 4 summary: 'Spam filtering' | |
| 5 rockspec: | |
| 6 build: | |
| 7 modules: | |
| 8 mod_anti_spam.rtbl: rtbl.lib.lua | |
| 9 mod_anti_spam.trie: trie.lib.lua | |
|
6123
0afd83bbdf09
mod_anti_spam: Declare dependency on mod_pubsub_subscription for plugin installer
Kim Alvefur <zash@zash.se>
parents:
6095
diff
changeset
|
10 depends: |
|
0afd83bbdf09
mod_anti_spam: Declare dependency on mod_pubsub_subscription for plugin installer
Kim Alvefur <zash@zash.se>
parents:
6095
diff
changeset
|
11 - mod_pubsub_subscription |
| 6095 | 12 --- |
| 13 | |
| 14 This module aims to provide an all-in-one spam filter for any kind of Prosody | |
| 15 deployment. | |
| 16 | |
| 17 ## What is spam? | |
| 18 | |
| 19 You're lucky if you have to ask! But it's worth explaining, so we can be clear | |
| 20 about what the module does (and does not). | |
| 21 | |
| 22 Similar to every other popular communication network, there are people who try | |
| 23 to exploit XMPP for sending unsolicited messages - usually advertisements | |
| 24 for products and services. These people have gathered large lists of user | |
| 25 addresses, e.g. by searching and "scraping" websites for contact info. | |
| 26 | |
| 27 If your address has not been discovered by the spammers, you won't receive any | |
| 28 spam. Prosody does not reveal user addresses (except, obviously, to people who | |
| 29 you communicate with). So to avoid it being picked up by spammers, be careful | |
| 30 about posting it unprotected on websites, etc. | |
| 31 | |
| 32 However, if get unlucky and your address is discovered by spammers, you may | |
| 33 receive dozens of spam messages per day. mod_anti_spam is designed to filter | |
| 34 these annoying messages to prevent them from reaching you. | |
| 35 | |
| 36 ## How does it work? | |
| 37 | |
| 38 mod_anti_spam uses a variety of techniques to identify likely spam. Just as | |
| 39 the behaviour of spammers changes, The exact methods used to detect spam may | |
| 40 evolve over time in future updates. | |
| 41 | |
| 42 If the sender is in the recipient's contact list already, no filtering will be | |
| 43 performed. | |
| 44 | |
| 45 Otherwise, if the sender is a "stranger" to the recipient, the module will | |
| 46 perform some checks, and decide whether to let the message or contact request | |
| 47 through. | |
| 48 | |
| 49 ### Shared block lists | |
| 50 | |
| 51 mod_anti_spam can subscribe to Real-Time Block Lists (RTBLs) such as those | |
| 52 published by [xmppbl.org](https://xmppbl.org). This is a highly effective | |
| 53 measure to reduce spam from the network. | |
| 54 | |
| 55 To enable this feature, you need to specify one or more compatible spam | |
| 56 services in the config file: | |
| 57 | |
| 58 ```lua | |
| 59 anti_spam_services = { "xmppbl.org" } | |
| 60 ``` | |
| 61 | |
| 62 ### Content filters | |
| 63 | |
| 64 mod_anti_spam also supports optionally filtering messages with specific | |
| 65 content or matching certain patterns. | |
| 66 | |
| 67 A list of strings to block can be specified in the config file like so: | |
| 68 | |
| 69 ```lua | |
| 70 anti_spam_block_strings = { | |
| 71 -- Block messages containing the text "exploit" | |
| 72 "exploit"; | |
| 73 } | |
| 74 ``` | |
| 75 | |
| 76 Alternatively, you can specify a list of [Lua patterns](https://lua.org/manual/5.4/manual.html#6.4.1). | |
| 77 These are similar to regular expressions you may be familiar with from tools | |
| 78 like grep, but differ in a number of ways. Lua patterns are faster, but have | |
| 79 fewer features. The syntax is not fully compatible with other more widely-used | |
| 80 regular expression syntaxes. Read the Lua manual for full details. | |
| 81 | |
| 82 ```lua | |
| 83 anti_spam_block_patterns = { | |
| 84 -- Block OTR handshake greetings (modern XMPP clients do not use OTR) | |
| 85 "^%?OTRv2?3?%?"; | |
| 86 } | |
| 87 ``` | |
| 88 | |
| 89 There are no string or pattern filters in the module by default. | |
| 90 | |
| 91 ## Handling reports | |
| 92 | |
| 93 We recommend setting up Prosody to allow spam reporting, in case any spam | |
| 94 still gets through. Documentation can be found on [xmppbl.org's site](https://xmppbl.org/reports#server-operators). | |
| 95 | |
| 96 ## Compatibility | |
| 97 | |
| 98 Compatible with Prosody 0.12 and later. |
