Software / code / prosody-modules
Comparison
mod_s2s_auth_dane/mod_s2s_auth_dane.lua @ 1963:98d757dc0771
mod_s2s_auth_dane: Add a telnet console command that exposes DANE information
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 10 Dec 2015 23:24:55 +0100 |
| parent | 1962:2f32196586bb |
| child | 1970:5ea6f4e6fa8c |
comparison
equal
deleted
inserted
replaced
| 1962:2f32196586bb | 1963: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 |