Diff

plugins/mod_s2s.lua @ 11608:b2610460d9ab

mod_c2s,mod_s2s: Collect stats on TLS versions and ciphers
author Kim Alvefur <zash@zash.se>
date Wed, 16 Jun 2021 00:00:17 +0200
parent 11560:3bbb1af92514
child 11609:6dcc45a2e3bc
line wrap: on
line diff
--- a/plugins/mod_s2s.lua	Sat Jun 12 18:06:37 2021 +0200
+++ b/plugins/mod_s2s.lua	Wed Jun 16 00:00:17 2021 +0200
@@ -71,6 +71,11 @@
 	"Closed connections",
 	{"host", "direction", "error"}
 );
+local m_tls_params = module:metric(
+	"counter", "encrypted", "",
+	"Encrypted connections",
+	{"protocol"; "cipher"}
+);
 
 local sessions = module:shared("sessions");
 
@@ -384,6 +389,7 @@
 			local info = sock:info();
 			(session.log or log)("info", "Stream encrypted (%s with %s)", info.protocol, info.cipher);
 			session.compressed = info.compression;
+			m_tls_params:with_labels(info.protocol, info.cipher):add(1)
 		else
 			(session.log or log)("info", "Stream encrypted");
 		end