mod_s2s_never_encrypt_blacklist/mod_s2s_never_encrypt_blacklist.lua
author Kim Alvefur <zash@zash.se>
Sun, 25 Jun 2023 16:27:55 +0200
changeset 5575 ca3c2d11823c
parent 1343 7dbde05b48a9
permissions -rw-r--r--
mod_pubsub_feeds: Track latest timestamp seen in feeds instead of last poll This should ensure that an entry that has a publish timestmap after the previously oldest post, but before the time of the last poll check, is published to the node. Previously if an entry would be skipped if it was published at 13:00 with a timestamp of 12:30, where the last poll was at 12:45. For feeds that lack a timestamp, it now looks for the first post that is not published, assuming that the feed is in reverse chronological order, then iterates back up from there.

-- Filter out servers which gets choppy and buggy when it comes to starttls.
-- (C) 2011-2013, Marco Cirillo (LW.Org)

local bad_servers = module:get_option_set("tls_s2s_blacklist", {})
local bad_servers_ip = module:get_option_set("tls_s2s_blacklist_ip", {})
local libev = module:get_option_boolean("use_libevent")

local function disable_tls_for_baddies_in(event)
	local session = event.origin
	if bad_servers:contains(session.from_host) or bad_servers_ip:contains(session.conn:ip()) then
		module:log("debug", "disabling tls on incoming stream from %s...", tostring(session.from_host));
		if libev then session.conn.starttls = false; else session.conn.starttls = nil; end
	end
end

local function disable_tls_for_baddies_out(event)
	local session = event.origin
	if bad_servers:contains(session.to_host) then
		module:log("debug", "disabling tls on outgoing stream from %s...", tostring(session.to_host));
		if libev then session.conn.starttls = false; else session.conn.starttls = nil; end
	end
end

module:hook("s2s-stream-features", disable_tls_for_baddies_in, 600)
module:hook("stanza/http://etherx.jabber.org/streams:features", disable_tls_for_baddies_out, 600)