Changeset

5764:969e0a054795

mod_c2s, mod_s2s: Log a message that stream encryption has been enabled with some details
author Kim Alvefur <zash@zash.se>
date Fri, 02 Aug 2013 15:12:24 +0200
parents 5763:0e52f1d5ca71
children 5765:d854c17a45fd
files plugins/mod_c2s.lua plugins/mod_s2s/mod_s2s.lua
diffstat 2 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Fri Aug 02 14:44:56 2013 +0200
+++ b/plugins/mod_c2s.lua	Fri Aug 02 15:12:24 2013 +0200
@@ -68,12 +68,15 @@
 	if session.secure == false then
 		session.secure = true;
 
-		-- Check if TLS compression is used
 		local sock = session.conn:socket();
 		if sock.info then
-			session.compressed = sock:info"compression";
-		elseif sock.compression then
-			session.compressed = sock:compression(); --COMPAT mw/luasec-hg
+			local info = sock:info();
+			(session.log or log)("info", "Stream encrypted (%s) with %s, authenticated with %s and exchanged keys with %s",
+				info.protocol, info.encryption, info.authentication, info.key);
+			session.compressed = info.compression;
+		else
+			(session.log or log)("info", "Stream encrypted");
+			session.compressed = sock.compression and sock:compression(); --COMPAT mw/luasec-hg
 		end
 	end
 
--- a/plugins/mod_s2s/mod_s2s.lua	Fri Aug 02 14:44:56 2013 +0200
+++ b/plugins/mod_s2s/mod_s2s.lua	Fri Aug 02 15:12:24 2013 +0200
@@ -283,12 +283,15 @@
 	if session.secure == false then
 		session.secure = true;
 
-		-- Check if TLS compression is used
 		local sock = session.conn:socket();
 		if sock.info then
-			session.compressed = sock:info"compression";
-		elseif sock.compression then
-			session.compressed = sock:compression(); --COMPAT mw/luasec-hg
+			local info = sock:info();
+			(session.log or log)("info", "Stream encrypted (%s) with %s, authenticated with %s and exchanged keys with %s",
+				info.protocol, info.encryption, info.authentication, info.key);
+			session.compressed = info.compression;
+		else
+			(session.log or log)("info", "Stream encrypted");
+			session.compressed = sock.compression and sock:compression(); --COMPAT mw/luasec-hg
 		end
 	end