comparison mod_sslv3_warn/mod_sslv3_warn.lua @ 1525:37cef218ba20

mod_sslv3_warn: Module to notice users connected with SSLv3 that they need to upgrade becasue SSLv3 is insecure
author Kim Alvefur <zash@zash.se>
date Wed, 15 Oct 2014 11:37:39 +0200
parents
children
comparison
equal deleted inserted replaced
1524:604a8cee9d58 1525:37cef218ba20
1 local st = require"util.stanza";
2 local host = module.host;
3
4 local warning_message = module:get_option_string("sslv3_warning", "Your connection is encrypted using the SSL 3.0 protocol, which has been demonstrated to be insecure and will be disabled soon. Please upgrade your client.");
5
6 module:hook("resource-bind", function (event)
7 local session = event.session;
8 module:log("debug", "mod_%s sees that %s logged in", module.name, session.username);
9
10 local ok, protocol = pcall(function(session)
11 return session.conn:socket():info"protocol";
12 end, session);
13 if not ok then
14 module:log("debug", protocol);
15 elseif protocol == "SSLv3" then
16 module:add_timer(15, function ()
17 if session.type == "c2s" and session.resource then
18 session.send(st.message({ from = host, type = "headline", to = session.full_jid }, warning_message));
19 end
20 end);
21 end
22 end);