changeset 413:e4d33cdfed21

mod_s2s_never_encrypt_blacklist: filter both incoming and outgoing streams.
author Marco Cirillo <maranda@lightwitch.org>
date Fri, 02 Sep 2011 23:35:25 +0000
parents 8963f4026f3a
children 10ff12fa82e2
files mod_s2s_never_encrypt_blacklist/mod_s2s_never_encrypt_blacklist.lua
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_s2s_never_encrypt_blacklist/mod_s2s_never_encrypt_blacklist.lua	Fri Sep 02 22:51:28 2011 +0000
+++ b/mod_s2s_never_encrypt_blacklist/mod_s2s_never_encrypt_blacklist.lua	Fri Sep 02 23:35:25 2011 +0000
@@ -2,8 +2,14 @@
 
 local bad_servers = module:get_option_set("tls_s2s_blacklist");
 
-local function disable_tls_for_baddies(event)
+local function disable_tls_for_baddies_in(event)
 	if bad_servers:contains(event.origin.to_host) then event.origin.conn.starttls = nil; end
 end
 
-module:hook("stanza/http://etherx.jabber.org/streams:features", disable_tls_for_baddies, 510)
+local function disable_tls_for_baddies_out(event)
+	if bad_servers:contains(event.origin.from_host) then event.origin.conn.starttls = nil; end
+end
+
+module:hook("s2s-stream-features", disable_tls_for_baddies_out, 10)
+module:hook("stanza/http://etherx.jabber.org/streams:features", disable_tls_for_baddies_in, 510)
+