mod_secure_interfaces: Add debug log in non-secure case also

Thu, 06 Jul 2017 10:48:39 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 06 Jul 2017 10:48:39 +0100
changeset 2726
55f3ab952d06
parent 2725
210c3a7644cb
child 2727
91cbeb6ad987

mod_secure_interfaces: Add debug log in non-secure case also

mod_secure_interfaces/mod_secure_interfaces.lua file | annotate | diff | comparison | revisions
--- a/mod_secure_interfaces/mod_secure_interfaces.lua	Thu Apr 27 12:41:53 2017 +0200
+++ b/mod_secure_interfaces/mod_secure_interfaces.lua	Thu Jul 06 10:48:39 2017 +0100
@@ -4,10 +4,15 @@
 	local session = event.origin;
 	if session.type ~= "c2s_unauthed" then return; end
 	local socket = session.conn:socket();
-	if not socket.getsockname then return; end
+	if not socket.getsockname then
+		module:log("debug", "Unable to determine local address of incoming connection");
+		return;
+	end
 	local localip = socket:getsockname();
 	if secure_interfaces:contains(localip) then
-		module:log("debug", "Marking session from %s as secure", session.ip or "[?]");
+		module:log("debug", "Marking session from %s to %s as secure", session.ip or "[?]", localip);
 		session.secure = true;
+	else
+		module:log("debug", "Not marking session from %s to %s as secure", session.ip or "[?]", localip);
 	end
 end, 2500);

mercurial