mod_tls: Add "support" for <failure> by closing gracefully
authorKim Alvefur <zash@zash.se>
Fri, 21 May 2021 19:04:01 +0200
changeset 11584 9ad5ec65132d
parent 11583 ec4f0ec3c0d5
child 11585 7e111f7147dc
mod_tls: Add "support" for <failure> by closing gracefully Nicer than the "unsupported stanza type" error we get otherwise.
plugins/mod_tls.lua
--- a/plugins/mod_tls.lua	Thu May 20 23:18:29 2021 +0200
+++ b/plugins/mod_tls.lua	Fri May 21 19:04:01 2021 +0200
@@ -174,3 +174,9 @@
 		return true;
 	end
 end);
+
+module:hook_tag(xmlns_starttls, "failure", function (session, stanza) -- luacheck: ignore 212/stanza
+	module:log("warn", "TLS negotiation with %s failed.", session.to_host);
+	session:close(nil, "TLS negotiation failed");
+	return false;
+end);