Mercurial > prosody-modules
annotate mod_s2s_never_encrypt_blacklist/mod_s2s_never_encrypt_blacklist.lua @ 686:592cfa6cf5d9
mod_host_guard: remove unused import.
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Sun, 27 May 2012 04:58:07 +0000 |
parents | 2b71ba2739e0 |
children | ef859c9d42c4 |
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 |
531
2b71ba2739e0
mod_s2s_never_encrypt_blacklist: stick to one code "punctuation" style.
Marco Cirillo <maranda@lightwitch.org>
parents:
417
diff
changeset
|
3 local bad_servers = module:get_option_set("tls_s2s_blacklist") |
2b71ba2739e0
mod_s2s_never_encrypt_blacklist: stick to one code "punctuation" style.
Marco Cirillo <maranda@lightwitch.org>
parents:
417
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) |
417
8fe1b47c9bde
mod_s2s_never_encrypt_blacklist: add option to check for the dull s2s session ip (OpenFire bork bork).
Marco Cirillo <maranda@lightwitch.org>
parents:
413
diff
changeset
|
7 if bad_servers:contains(event.origin.to_host) or bad_servers_ip:contains(event.origin.conn:ip()) |
531
2b71ba2739e0
mod_s2s_never_encrypt_blacklist: stick to one code "punctuation" style.
Marco Cirillo <maranda@lightwitch.org>
parents:
417
diff
changeset
|
8 then event.origin.conn.starttls = nil end |
412
8963f4026f3a
mod_s2s_never_encrypt_blacklist: first commit.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
9 end |
8963f4026f3a
mod_s2s_never_encrypt_blacklist: first commit.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
10 |
413
e4d33cdfed21
mod_s2s_never_encrypt_blacklist: filter both incoming and outgoing streams.
Marco Cirillo <maranda@lightwitch.org>
parents:
412
diff
changeset
|
11 local function disable_tls_for_baddies_out(event) |
417
8fe1b47c9bde
mod_s2s_never_encrypt_blacklist: add option to check for the dull s2s session ip (OpenFire bork bork).
Marco Cirillo <maranda@lightwitch.org>
parents:
413
diff
changeset
|
12 if bad_servers:contains(event.origin.from_host) or bad_servers_ip:contains(event.origin.conn:ip()) |
531
2b71ba2739e0
mod_s2s_never_encrypt_blacklist: stick to one code "punctuation" style.
Marco Cirillo <maranda@lightwitch.org>
parents:
417
diff
changeset
|
13 then event.origin.conn.starttls = nil end |
413
e4d33cdfed21
mod_s2s_never_encrypt_blacklist: filter both incoming and outgoing streams.
Marco Cirillo <maranda@lightwitch.org>
parents:
412
diff
changeset
|
14 end |
e4d33cdfed21
mod_s2s_never_encrypt_blacklist: filter both incoming and outgoing streams.
Marco Cirillo <maranda@lightwitch.org>
parents:
412
diff
changeset
|
15 |
e4d33cdfed21
mod_s2s_never_encrypt_blacklist: filter both incoming and outgoing streams.
Marco Cirillo <maranda@lightwitch.org>
parents:
412
diff
changeset
|
16 module:hook("s2s-stream-features", disable_tls_for_baddies_out, 10) |
e4d33cdfed21
mod_s2s_never_encrypt_blacklist: filter both incoming and outgoing streams.
Marco Cirillo <maranda@lightwitch.org>
parents:
412
diff
changeset
|
17 module:hook("stanza/http://etherx.jabber.org/streams:features", disable_tls_for_baddies_in, 510) |
e4d33cdfed21
mod_s2s_never_encrypt_blacklist: filter both incoming and outgoing streams.
Marco Cirillo <maranda@lightwitch.org>
parents:
412
diff
changeset
|
18 |