Comparison

mod_secure_interfaces/mod_secure_interfaces.lua @ 2726:55f3ab952d06

mod_secure_interfaces: Add debug log in non-secure case also
author Matthew Wild <mwild1@gmail.com>
date Thu, 06 Jul 2017 10:48:39 +0100
parent 1177:a464261deba8
child 2730:cd828b1cb5b9
comparison
equal deleted inserted replaced
2725:210c3a7644cb 2726:55f3ab952d06
2 2
3 module:hook("stream-features", function (event) 3 module:hook("stream-features", function (event)
4 local session = event.origin; 4 local session = event.origin;
5 if session.type ~= "c2s_unauthed" then return; end 5 if session.type ~= "c2s_unauthed" then return; end
6 local socket = session.conn:socket(); 6 local socket = session.conn:socket();
7 if not socket.getsockname then return; end 7 if not socket.getsockname then
8 module:log("debug", "Unable to determine local address of incoming connection");
9 return;
10 end
8 local localip = socket:getsockname(); 11 local localip = socket:getsockname();
9 if secure_interfaces:contains(localip) then 12 if secure_interfaces:contains(localip) then
10 module:log("debug", "Marking session from %s as secure", session.ip or "[?]"); 13 module:log("debug", "Marking session from %s to %s as secure", session.ip or "[?]", localip);
11 session.secure = true; 14 session.secure = true;
15 else
16 module:log("debug", "Not marking session from %s to %s as secure", session.ip or "[?]", localip);
12 end 17 end
13 end, 2500); 18 end, 2500);