Mercurial > prosody-modules
diff 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 |
line wrap: on
line diff
--- a/mod_admin_web/admin_web/mod_admin_web.lua Sat Jul 13 17:43:30 2013 +0200 +++ b/mod_admin_web/admin_web/mod_admin_web.lua Mon Jul 22 23:23:02 2013 +0200 @@ -42,7 +42,12 @@ end local item = st.stanza("item", { id = id }):tag("session", {xmlns = xmlns_c2s_session, jid = name}):up(); if session.secure then - item:tag("encrypted"):up(); + local encrypted = item:tag("encrypted"); + local sock = session.conn and session.conn.socket and session.conn:socket() + local info = sock and sock.info and sock:info(); + for k, v in pairs(info or {}) do + encrypted:tag("info", { name = k }):text(tostring(v)):up(); + end end if session.compressed then item:tag("compressed"):up(); @@ -70,10 +75,19 @@ local item = st.stanza("item", { id = id }):tag("session", {xmlns = xmlns_s2s_session, jid = name}) :tag(type):up(); if session.secure then + local encrypted = item:tag("encrypted"); + + local sock = session.conn and session.conn.socket and session.conn:socket() + local info = sock and sock.info and sock:info(); + for k, v in pairs(info or {}) do + encrypted:tag("info", { name = k }):text(tostring(v)):up(); + end + local sock = session.conn:socket() + if session.cert_identity_status == "valid" then - item:tag("encrypted"):tag("valid"):up():up(); + encrypted:tag("valid"); else - item:tag("encrypted"):tag("invalid"):up():up(); + encrypted:tag("invalid"); end end if session.compressed then