Annotate

mod_anti_spam/README.markdown @ 6125:a54b94a3e994

mod_anti_spam: Fix luacheck warning
author Matthew Wild <mwild1@gmail.com>
date Mon, 30 Dec 2024 13:52:59 +0000
parent 6123:f6bbf42c341c
child 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
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 ---
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 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
13 deployment.
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 ## What is spam?
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 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
18 about what the module does (and does not).
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 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
21 to exploit XMPP for sending unsolicited messages - usually advertisements
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22 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
23 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
24
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
25 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
26 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
27 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
28 about posting it unprotected on websites, etc.
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
29
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
30 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
31 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
32 these annoying messages to prevent them from reaching you.
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
33
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
34 ## How does it work?
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 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
37 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
38 evolve over time in future updates.
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
39
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
40 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
41 performed.
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
42
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
43 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
44 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
45 through.
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
46
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
47 ### Shared block lists
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 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
50 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
51 measure to reduce spam from the network.
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
52
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
53 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
54 services in the config file:
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
55
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
56 ```lua
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
57 anti_spam_services = { "xmppbl.org" }
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
58 ```
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
59
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
60 ### Content filters
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 mod_anti_spam also supports optionally filtering messages with specific
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
63 content or matching certain patterns.
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
64
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
65 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
66
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
67 ```lua
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
68 anti_spam_block_strings = {
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
69 -- Block messages containing the text "exploit"
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
70 "exploit";
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
71 }
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
72 ```
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 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
75 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
76 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
77 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
78 regular expression syntaxes. Read the Lua manual for full details.
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
79
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
80 ```lua
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
81 anti_spam_block_patterns = {
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
82 -- 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
83 "^%?OTRv2?3?%?";
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
84 }
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
85 ```
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 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
88
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
89 ## Handling reports
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 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
92 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
93
f6bbf42c341c mod_anti_spam: Add README
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
94 ## Compatibility
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 Compatible with Prosody 0.12 and later.