Comparison

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
comparison
equal deleted inserted replaced
11607:03eb4c0dca27 11608:b2610460d9ab
68 ); 68 );
69 local m_closed_connections = module:metric( 69 local m_closed_connections = module:metric(
70 "counter", "closed", "", 70 "counter", "closed", "",
71 "Closed connections", 71 "Closed connections",
72 {"host", "direction", "error"} 72 {"host", "direction", "error"}
73 );
74 local m_tls_params = module:metric(
75 "counter", "encrypted", "",
76 "Encrypted connections",
77 {"protocol"; "cipher"}
73 ); 78 );
74 79
75 local sessions = module:shared("sessions"); 80 local sessions = module:shared("sessions");
76 81
77 local runner_callbacks = {}; 82 local runner_callbacks = {};
382 local sock = session.conn:socket(); 387 local sock = session.conn:socket();
383 if sock.info then 388 if sock.info then
384 local info = sock:info(); 389 local info = sock:info();
385 (session.log or log)("info", "Stream encrypted (%s with %s)", info.protocol, info.cipher); 390 (session.log or log)("info", "Stream encrypted (%s with %s)", info.protocol, info.cipher);
386 session.compressed = info.compression; 391 session.compressed = info.compression;
392 m_tls_params:with_labels(info.protocol, info.cipher):add(1)
387 else 393 else
388 (session.log or log)("info", "Stream encrypted"); 394 (session.log or log)("info", "Stream encrypted");
389 end 395 end
390 end 396 end
391 397