Software /
code /
prosody-modules
Comparison
mod_secure_interfaces/mod_secure_interfaces.lua @ 1177:a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 29 Aug 2013 12:20:20 +0100 |
child | 2726:55f3ab952d06 |
comparison
equal
deleted
inserted
replaced
1176:06e0c279f6a8 | 1177:a464261deba8 |
---|---|
1 local secure_interfaces = module:get_option_set("secure_interfaces", { "127.0.0.1" }); | |
2 | |
3 module:hook("stream-features", function (event) | |
4 local session = event.origin; | |
5 if session.type ~= "c2s_unauthed" then return; end | |
6 local socket = session.conn:socket(); | |
7 if not socket.getsockname then return; end | |
8 local localip = socket:getsockname(); | |
9 if secure_interfaces:contains(localip) then | |
10 module:log("debug", "Marking session from %s as secure", session.ip or "[?]"); | |
11 session.secure = true; | |
12 end | |
13 end, 2500); |