Comparison

plugins/mod_admin_shell.lua @ 12480:7e9ebdc75ce4

net: isolate LuaSec-specifics For this, various accessor functions are now provided directly on the sockets, which reach down into the LuaSec implementation to obtain the information. While this may seem of little gain at first, it hides the implementation detail of the LuaSec+LuaSocket combination that the actual socket and the TLS layer are separate objects. The net gain here is that an alternative implementation does not have to emulate that specific implementation detail and "only" has to expose LuaSec-compatible data structures on the new functions.
author Jonas Schäfer <jonas@wielicki.name>
date Wed, 27 Apr 2022 17:44:14 +0200
parent 12464:f4c59af273a3
child 12506:d04f6f014636
comparison
equal deleted inserted replaced
12478:82270a6b1234 12480:7e9ebdc75ce4
805 key = "conn"; 805 key = "conn";
806 width = 8; 806 width = 8;
807 mapper = function(conn, session) 807 mapper = function(conn, session)
808 if not session.secure then return "insecure"; end 808 if not session.secure then return "insecure"; end
809 if not conn or not conn:ssl() then return "secure" end 809 if not conn or not conn:ssl() then return "secure" end
810 local sock = conn and conn:socket(); 810 local tls_info = conn.ssl_info and conn:ssl_info();
811 if not sock then return "secure"; end
812 local tls_info = sock.info and sock:info();
813 return tls_info and tls_info.protocol or "secure"; 811 return tls_info and tls_info.protocol or "secure";
814 end; 812 end;
815 }; 813 };
816 encryption = { 814 encryption = {
817 title = "Encryption"; 815 title = "Encryption";
818 description = "Encryption algorithm used (TLS cipher suite)"; 816 description = "Encryption algorithm used (TLS cipher suite)";
819 width = 30; 817 width = 30;
820 key = "conn"; 818 key = "conn";
821 mapper = function(conn) 819 mapper = function(conn)
822 local sock = conn:socket(); 820 local info = conn and conn.ssl_info and conn:ssl_info();
823 local info = sock and sock.info and sock:info();
824 if info then return info.cipher end 821 if info then return info.cipher end
825 end; 822 end;
826 }; 823 };
827 cert = { 824 cert = {
828 title = "Certificate"; 825 title = "Certificate";