Software /
code /
prosody-modules
Comparison
mod_s2s_blacklist/mod_s2s_blacklist.lua @ 1179:27b4e01ddbc4
mod_s2s_blacklist: A new _simple_ s2s blacklist module
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 03 Sep 2013 10:45:54 +0100 |
child | 1324:853a382c9bd6 |
comparison
equal
deleted
inserted
replaced
1178:412f62d05a23 | 1179:27b4e01ddbc4 |
---|---|
1 local st = require "util.stanza"; | |
2 | |
3 local blacklist = module:get_option_inherited_set("s2s_blacklist", {}); | |
4 | |
5 module:hook("route/remote", function (event) | |
6 if blacklist:contains(event.to_host) then | |
7 module:send(st.error_reply(event.stanza, "cancel", "not-allowed", "Communication with this domain is restricted")); | |
8 return true; | |
9 end | |
10 end, 100); | |
11 | |
12 module:hook("s2s-stream-features", function (event) | |
13 if blacklist:contains(event.origin.from_host) then | |
14 event.origin:close({ | |
15 condition = "policy-violation"; | |
16 text = "Communication with this domain is restricted"; | |
17 }); | |
18 end | |
19 end, 1000); |