Annotate

mod_anti_spam/README.markdown @ 6211:750d64c47ec6 draft default tip

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