Mercurial > prosody-modules
comparison mod_firewall/scripts/spam-blocking.pfw @ 2556:cc01a5bfcf3b
mod_firewall: spam-blocking.pfw, initial anti-spam ruleset
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 23 Feb 2017 14:14:38 +0000 |
| parents | |
| children | 56db2ab3b853 |
comparison
equal
deleted
inserted
replaced
| 2555:a9eb4d5566f3 | 2556:cc01a5bfcf3b |
|---|---|
| 1 #### Anti-spam ruleset | |
| 2 | |
| 3 #### General rules for all incoming stanzas #### | |
| 4 ::deliver | |
| 5 | |
| 6 # Pass stanzas that a user sends to their own account | |
| 7 TO SELF? | |
| 8 PASS. | |
| 9 | |
| 10 # Pass stanzas that are addressed to a valid full JID | |
| 11 TO FULL JID? | |
| 12 PASS. | |
| 13 | |
| 14 # Pass stanzas from contacts | |
| 15 SUBSCRIBED? | |
| 16 PASS. | |
| 17 | |
| 18 # Run extra rules that apply to messages only | |
| 19 KIND: message | |
| 20 JUMP_CHAIN=user/check_spam_message | |
| 21 | |
| 22 # Run extra rules that apply to presence stanzas only | |
| 23 KIND: presence | |
| 24 JUMP CHAIN=user/check_spam_presence | |
| 25 | |
| 26 #### Rules for messages #### | |
| 27 ::user/check_spam_message | |
| 28 | |
| 29 # Non-chat message types often generate pop-ups in clients, | |
| 30 # so we won't accept them from strangers | |
| 31 NOT TYPE: chat | |
| 32 JUMP CHAIN=user/reject_spam | |
| 33 | |
| 34 # This chain can be used by other scripts | |
| 35 # and modules that analyze message content | |
| 36 JUMP CHAIN=user/check_spam_message_content | |
| 37 | |
| 38 #### Rules for presence stanzas #### | |
| 39 ::user/check_spam_presence | |
| 40 | |
| 41 # We don't want to receive presence from random strangers, | |
| 42 # but still allow subscription requests | |
| 43 NOT TYPE: subscribe | |
| 44 DROP. | |
| 45 | |
| 46 # This chain can be used by other scripts | |
| 47 # and modules to filter subscription requests | |
| 48 JUMP CHAIN=user/check_subscription_request | |
| 49 | |
| 50 #### Stanzas reaching this chain will be rejected #### | |
| 51 ::user/reject_spam | |
| 52 | |
| 53 LOG=Rejecting suspected spam: $(stanza:top_tag()) | |
| 54 BOUNCE=policy-violation |
