comparison mod_admin_web/admin_web/mod_admin_web.lua @ 1117:d643c385d3f6

mod_admin_web: Provide some information about the TLS layer
author Florian Zeitz <florob@babelmonkeys.de>
date Mon, 22 Jul 2013 23:23:02 +0200
parents e3ad5f3aa6d4
children e5441d46d6ff
comparison
equal deleted inserted replaced
1116:2345a30dd8b4 1117:d643c385d3f6
40 id = uuid_generate(); 40 id = uuid_generate();
41 idmap[name] = id; 41 idmap[name] = id;
42 end 42 end
43 local item = st.stanza("item", { id = id }):tag("session", {xmlns = xmlns_c2s_session, jid = name}):up(); 43 local item = st.stanza("item", { id = id }):tag("session", {xmlns = xmlns_c2s_session, jid = name}):up();
44 if session.secure then 44 if session.secure then
45 item:tag("encrypted"):up(); 45 local encrypted = item:tag("encrypted");
46 local sock = session.conn and session.conn.socket and session.conn:socket()
47 local info = sock and sock.info and sock:info();
48 for k, v in pairs(info or {}) do
49 encrypted:tag("info", { name = k }):text(tostring(v)):up();
50 end
46 end 51 end
47 if session.compressed then 52 if session.compressed then
48 item:tag("compressed"):up(); 53 item:tag("compressed"):up();
49 end 54 end
50 service[host]:publish(xmlns_c2s_session, host, id, item); 55 service[host]:publish(xmlns_c2s_session, host, id, item);
68 idmap[name.."_"..type] = id; 73 idmap[name.."_"..type] = id;
69 end 74 end
70 local item = st.stanza("item", { id = id }):tag("session", {xmlns = xmlns_s2s_session, jid = name}) 75 local item = st.stanza("item", { id = id }):tag("session", {xmlns = xmlns_s2s_session, jid = name})
71 :tag(type):up(); 76 :tag(type):up();
72 if session.secure then 77 if session.secure then
78 local encrypted = item:tag("encrypted");
79
80 local sock = session.conn and session.conn.socket and session.conn:socket()
81 local info = sock and sock.info and sock:info();
82 for k, v in pairs(info or {}) do
83 encrypted:tag("info", { name = k }):text(tostring(v)):up();
84 end
85 local sock = session.conn:socket()
86
73 if session.cert_identity_status == "valid" then 87 if session.cert_identity_status == "valid" then
74 item:tag("encrypted"):tag("valid"):up():up(); 88 encrypted:tag("valid");
75 else 89 else
76 item:tag("encrypted"):tag("invalid"):up():up(); 90 encrypted:tag("invalid");
77 end 91 end
78 end 92 end
79 if session.compressed then 93 if session.compressed then
80 item:tag("compressed"):up(); 94 item:tag("compressed"):up();
81 end 95 end