comparison mod_warn_legacy_tls/mod_warn_legacy_tls.lua @ 3730:ec3eb426271e

mod_warn_legacy_tls: Log a warning attached to sessions using deprecated TLS versions
author Kim Alvefur <zash@zash.se>
date Sun, 03 Nov 2019 13:29:44 +0100
parents 36023eb3254e
children 406b32b50457
comparison
equal deleted inserted replaced
3729:75299ac7e258 3730:ec3eb426271e
12 return session.conn:socket():info"protocol"; 12 return session.conn:socket():info"protocol";
13 end, session); 13 end, session);
14 if not ok then 14 if not ok then
15 module:log("debug", "Could not determine TLS version: %s", protocol); 15 module:log("debug", "Could not determine TLS version: %s", protocol);
16 elseif deprecated_protocols:contains(protocol) then 16 elseif deprecated_protocols:contains(protocol) then
17 session.log("warn", "Uses %s", protocol);
17 module:add_timer(15, function () 18 module:add_timer(15, function ()
18 if session.type == "c2s" and session.resource then 19 if session.type == "c2s" and session.resource then
19 session.send(st.message({ from = host, type = "headline", to = session.full_jid }, warning_message:format(protocol))); 20 session.send(st.message({ from = host, type = "headline", to = session.full_jid }, warning_message:format(protocol)));
20 end 21 end
21 end); 22 end);