Mercurial > prosody-modules
comparison mod_firewall/README.markdown @ 2545:9b46d24edf0d
mod_firewall: Add and document COUNT condition
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 21 Feb 2017 22:41:58 +0000 |
parents | d637bc0ac604 |
children | 99b32f77f00d |
comparison
equal
deleted
inserted
replaced
2544:223eea31588d | 2545:9b46d24edf0d |
---|---|
154 | 154 |
155 # Now we can use these to SCAN incoming stanzas | 155 # Now we can use these to SCAN incoming stanzas |
156 # If it finds a match, bounce the stanza | 156 # If it finds a match, bounce the stanza |
157 SCAN: body for word in badwords | 157 SCAN: body for word in badwords |
158 BOUNCE=policy-violation (This word is not allowed!) | 158 BOUNCE=policy-violation (This word is not allowed!) |
159 | |
160 #### COUNT | |
161 | |
162 COUNT is similar to SCAN, in that it uses a defined SEARCH and breaks it up according to a PATTERN. Then it | |
163 counts the number of results. | |
164 | |
165 For example, to block every message with more than one URL: | |
166 | |
167 # Define a search location called 'body' which fetches the text of the 'body' element | |
168 %SEARCH body: body# | |
169 # Define a pattern called 'url' which matches HTTP links | |
170 %PATTERN url: https?://%S+ | |
171 | |
172 COUNT: url in body > 1 | |
173 BOUNCE=policy-violation (Up to one HTTP URL is allowed in messages) | |
159 | 174 |
160 ### Stanza matching | 175 ### Stanza matching |
161 | 176 |
162 Condition Matches | 177 Condition Matches |
163 ----------- ------------------------------------------------------------------------------------------------------------------------------------------------------------ | 178 ----------- ------------------------------------------------------------------------------------------------------------------------------------------------------------ |