Comparison

mod_anti_spam/README.markdown @ 6209:d611ed13df7e draft

Merge
author Trần H. Trung <xmpp:trần.h.trung@trung.fun>
date Tue, 18 Mar 2025 00:16:25 +0700
child 6211:750d64c47ec6
comparison
equal deleted inserted replaced
6208:e20901443eae 6209:d611ed13df7e
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
10 depends:
11 - mod_pubsub_subscription
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.