plugins/mod_s2s.lua
branch0.12
changeset 12478 8fac32810144
parent 12366 0fd58f54d653
child 12480 d8a6e03a7161
child 12683 7d4a95ba9b6c
--- a/plugins/mod_s2s.lua	Wed Apr 13 18:46:11 2022 +0100
+++ b/plugins/mod_s2s.lua	Mon Apr 25 15:07:49 2022 +0100
@@ -349,6 +349,15 @@
 			}, nil, "Could not establish encrypted connection to remote server");
 		end
 	end
+
+	if session.type == "s2sout_unauthed" and not session.authenticated_remote and secure_auth and not insecure_domains[host] then
+		session:close({
+			condition = "policy-violation";
+			text = "Failed to verify certificate (internal error)";
+		});
+		return;
+	end
+
 	if hosts[host] then
 		session:close({ condition = "undefined-condition", text = "Attempt to authenticate as a host we serve" });
 	end
@@ -531,6 +540,8 @@
 		if session.secure and not session.cert_chain_status then
 			if check_cert_status(session) == false then
 				return;
+			else
+				session.authenticated_remote = true;
 			end
 		end