mod_s2s_auth_dane/mod_s2s_auth_dane.lua
changeset 1967 98d757dc0771
parent 1966 2f32196586bb
child 1974 5ea6f4e6fa8c
equal deleted inserted replaced
1966:2f32196586bb 1967:98d757dc0771
   353 			end
   353 			end
   354 		end
   354 		end
   355 	end
   355 	end
   356 end);
   356 end);
   357 
   357 
       
   358 -- Telnet command
       
   359 if module:get_option_set("modules_enabled", {}):contains("admin_telnet") then
       
   360 	module:depends("admin_telnet"); -- Make sure the env is there
       
   361 	local def_env = module:shared("admin_telnet/env");
       
   362 
       
   363 	local sessions = module:shared("s2s/sessions");
       
   364 
       
   365 	local function annotate(session, line)
       
   366 		line = line or {};
       
   367 		table.insert(line, "--");
       
   368 		if session.dane == nil then
       
   369 			table.insert(line, "No DANE attempted, probably insecure SRV response");
       
   370 		elseif session.dane == false then
       
   371 			table.insert(line, "DANE failed or response was insecure");
       
   372 		elseif type(session.dane) ~= "table" then
       
   373 			table.insert(line, "Waiting for DANE records...");
       
   374 		elseif session.dane.matching then
       
   375 			table.insert(line, "Matching DANE record:\n|       " .. tostring(session.dane.matching));
       
   376 		else
       
   377 			table.insert(line, "DANE records:\n|       " .. tostring(session.dane));
       
   378 		end
       
   379 		return table.concat(line, " ");
       
   380 	end
       
   381 
       
   382 	function def_env.s2s:show_dane(...)
       
   383 		return self:show(..., annotate);
       
   384 	end
       
   385 end
       
   386