Software / code / prosody
Comparison
plugins/mod_dialback.lua @ 11558:d0e9ffccdef9 0.11 0.11.9
mod_dialback: Remove d-w-d feature
Backs out 1d0862814bfc and 2fdd71b08126
Largely unused, undocumented and did not have enough tests to provide
confidence in its correct operation.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 12 May 2021 17:22:02 +0200 |
| parent | 11557:6be890ca492e |
| child | 11560:3bbb1af92514 |
comparison
equal
deleted
inserted
replaced
| 11557:6be890ca492e | 11558:d0e9ffccdef9 |
|---|---|
| 20 local xmlns_stream = "http://etherx.jabber.org/streams"; | 20 local xmlns_stream = "http://etherx.jabber.org/streams"; |
| 21 | 21 |
| 22 local dialback_requests = setmetatable({}, { __mode = 'v' }); | 22 local dialback_requests = setmetatable({}, { __mode = 'v' }); |
| 23 | 23 |
| 24 local dialback_secret = sha256_hash(module:get_option_string("dialback_secret", uuid_gen()), true); | 24 local dialback_secret = sha256_hash(module:get_option_string("dialback_secret", uuid_gen()), true); |
| 25 local dwd = module:get_option_boolean("dialback_without_dialback", false); | |
| 26 | |
| 27 --- Helper to check that a session peer's certificate is valid | |
| 28 function check_cert_status(session, host) | |
| 29 local conn = session.conn:socket() | |
| 30 local cert | |
| 31 if conn.getpeercertificate then | |
| 32 cert = conn:getpeercertificate() | |
| 33 end | |
| 34 | |
| 35 return module:fire_event("s2s-check-certificate", { host = host, session = session, cert = cert }); | |
| 36 end | |
| 37 | |
| 38 | 25 |
| 39 function module.save() | 26 function module.save() |
| 40 return { dialback_secret = dialback_secret }; | 27 return { dialback_secret = dialback_secret }; |
| 41 end | 28 end |
| 42 | 29 |
| 102 return true; | 89 return true; |
| 103 elseif not from then | 90 elseif not from then |
| 104 origin:close("improper-addressing"); | 91 origin:close("improper-addressing"); |
| 105 end | 92 end |
| 106 | 93 |
| 107 if dwd and origin.secure then | |
| 108 if check_cert_status(origin, from) == false then | |
| 109 return | |
| 110 elseif origin.cert_chain_status == "valid" and origin.cert_identity_status == "valid" then | |
| 111 origin.sends2s(st.stanza("db:result", { to = from, from = to, id = attr.id, type = "valid" })); | |
| 112 module:fire_event("s2s-authenticated", { session = origin, host = from }); | |
| 113 return true; | |
| 114 end | |
| 115 end | |
| 116 | 94 |
| 117 origin.hosts[from] = { dialback_key = stanza[1] }; | 95 origin.hosts[from] = { dialback_key = stanza[1] }; |
| 118 | 96 |
| 119 dialback_requests[from.."/"..origin.streamid] = origin; | 97 dialback_requests[from.."/"..origin.streamid] = origin; |
| 120 | 98 |