Software / code / prosody
Comparison
plugins/mod_tls.lua @ 11340:a7109eb45e30
mod_tls: Attempt STARTTLS even if not advertised as per RFC 7590
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 29 Jan 2021 23:17:08 +0100 |
| parent | 10784:0b0fe73199d2 |
| child | 11341:c567e5e2b77a |
comparison
equal
deleted
inserted
replaced
| 11339:25260c20c5a4 | 11340:a7109eb45e30 |
|---|---|
| 148 end); | 148 end); |
| 149 | 149 |
| 150 -- For s2sout connections, start TLS if we can | 150 -- For s2sout connections, start TLS if we can |
| 151 module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) | 151 module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) |
| 152 module:log("debug", "Received features element"); | 152 module:log("debug", "Received features element"); |
| 153 if can_do_tls(session) and stanza:get_child("starttls", xmlns_starttls) then | 153 if can_do_tls(session) then |
| 154 module:log("debug", "%s is offering TLS, taking up the offer...", session.to_host); | 154 if stanza:get_child("starttls", xmlns_starttls) then |
| 155 module:log("debug", "%s is offering TLS, taking up the offer...", session.to_host); | |
| 156 else | |
| 157 module:log("debug", "%s is *not* offering TLS, trying anyways!", session.to_host); | |
| 158 end | |
| 155 session.sends2s(starttls_initiate); | 159 session.sends2s(starttls_initiate); |
| 156 return true; | 160 return true; |
| 157 end | 161 end |
| 158 end, 500); | 162 end, 500); |
| 159 | 163 |