annotate mod_s2s_never_encrypt_blacklist/mod_s2s_never_encrypt_blacklist.lua @ 923:5f38d762d071

mod_s2s_never_encrypt_blacklist: add missing semicolons.
author Marco Cirillo <maranda@lightwitch.org>
date Thu, 07 Mar 2013 16:57:17 +0100
parents 661e2322b4df
children 0a78ac54bd03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
412
8963f4026f3a mod_s2s_never_encrypt_blacklist: first commit.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
1 -- Filter out servers which gets choppy and buggy when it comes to starttls.
8963f4026f3a mod_s2s_never_encrypt_blacklist: first commit.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
2
921
ef859c9d42c4 mod_s2s_never_encrypt_blacklist: supply an empty table as default value, fixes traceback. (Thanks Tobias)
Marco Cirillo <maranda@lightwitch.org>
parents: 531
diff changeset
3 local bad_servers = module:get_option_set("tls_s2s_blacklist", {})
ef859c9d42c4 mod_s2s_never_encrypt_blacklist: supply an empty table as default value, fixes traceback. (Thanks Tobias)
Marco Cirillo <maranda@lightwitch.org>
parents: 531
diff changeset
4 local bad_servers_ip = module:get_option_set("tls_s2s_blacklist_ip", {})
412
8963f4026f3a mod_s2s_never_encrypt_blacklist: first commit.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
5
413
e4d33cdfed21 mod_s2s_never_encrypt_blacklist: filter both incoming and outgoing streams.
Marco Cirillo <maranda@lightwitch.org>
parents: 412
diff changeset
6 local function disable_tls_for_baddies_in(event)
922
661e2322b4df mod_s2s_never_encrypt_blacklist: cleanup code, also hooks were mixed up.
Marco Cirillo <maranda@lightwitch.org>
parents: 921
diff changeset
7 local session = event.origin
661e2322b4df mod_s2s_never_encrypt_blacklist: cleanup code, also hooks were mixed up.
Marco Cirillo <maranda@lightwitch.org>
parents: 921
diff changeset
8 if bad_servers:contains(session.from_host) or bad_servers_ip:contains(session.conn:ip()) then
661e2322b4df mod_s2s_never_encrypt_blacklist: cleanup code, also hooks were mixed up.
Marco Cirillo <maranda@lightwitch.org>
parents: 921
diff changeset
9 module:log("debug", "disabling tls on incoming stream from %s...", tostring(session.from_host));
923
5f38d762d071 mod_s2s_never_encrypt_blacklist: add missing semicolons.
Marco Cirillo <maranda@lightwitch.org>
parents: 922
diff changeset
10 session.conn.starttls = nil;
922
661e2322b4df mod_s2s_never_encrypt_blacklist: cleanup code, also hooks were mixed up.
Marco Cirillo <maranda@lightwitch.org>
parents: 921
diff changeset
11 end
412
8963f4026f3a mod_s2s_never_encrypt_blacklist: first commit.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
12 end
8963f4026f3a mod_s2s_never_encrypt_blacklist: first commit.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
13
413
e4d33cdfed21 mod_s2s_never_encrypt_blacklist: filter both incoming and outgoing streams.
Marco Cirillo <maranda@lightwitch.org>
parents: 412
diff changeset
14 local function disable_tls_for_baddies_out(event)
922
661e2322b4df mod_s2s_never_encrypt_blacklist: cleanup code, also hooks were mixed up.
Marco Cirillo <maranda@lightwitch.org>
parents: 921
diff changeset
15 local session = event.origin
661e2322b4df mod_s2s_never_encrypt_blacklist: cleanup code, also hooks were mixed up.
Marco Cirillo <maranda@lightwitch.org>
parents: 921
diff changeset
16 if bad_servers:contains(session.to_host) then
661e2322b4df mod_s2s_never_encrypt_blacklist: cleanup code, also hooks were mixed up.
Marco Cirillo <maranda@lightwitch.org>
parents: 921
diff changeset
17 module:log("debug", "disabling tls on outgoing stream from %s...", tostring(session.to_host));
923
5f38d762d071 mod_s2s_never_encrypt_blacklist: add missing semicolons.
Marco Cirillo <maranda@lightwitch.org>
parents: 922
diff changeset
18 session.conn.starttls = nil;
922
661e2322b4df mod_s2s_never_encrypt_blacklist: cleanup code, also hooks were mixed up.
Marco Cirillo <maranda@lightwitch.org>
parents: 921
diff changeset
19 end
413
e4d33cdfed21 mod_s2s_never_encrypt_blacklist: filter both incoming and outgoing streams.
Marco Cirillo <maranda@lightwitch.org>
parents: 412
diff changeset
20 end
e4d33cdfed21 mod_s2s_never_encrypt_blacklist: filter both incoming and outgoing streams.
Marco Cirillo <maranda@lightwitch.org>
parents: 412
diff changeset
21
922
661e2322b4df mod_s2s_never_encrypt_blacklist: cleanup code, also hooks were mixed up.
Marco Cirillo <maranda@lightwitch.org>
parents: 921
diff changeset
22 module:hook("s2s-stream-features", disable_tls_for_baddies_in, 600)
661e2322b4df mod_s2s_never_encrypt_blacklist: cleanup code, also hooks were mixed up.
Marco Cirillo <maranda@lightwitch.org>
parents: 921
diff changeset
23 module:hook("stanza/http://etherx.jabber.org/streams:features", disable_tls_for_baddies_out, 600)