Changeset

11835:a405884c62f4

mod_s2s_auth_certs: Collect stats on validation results (for #975)
author Kim Alvefur <zash@zash.se>
date Tue, 05 Oct 2021 16:30:41 +0200
parents 11834:f54d9abc4e14
children 11836:8ccb22c0fa56
files plugins/mod_s2s_auth_certs.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_s2s_auth_certs.lua	Tue Oct 05 15:49:47 2021 +0200
+++ b/plugins/mod_s2s_auth_certs.lua	Tue Oct 05 16:30:41 2021 +0200
@@ -4,6 +4,9 @@
 local NULL = {};
 local log = module._log;
 
+local measure_cert_statuses = module:metric("counter", "checked", "", "Certificate validation results",
+	{ "chain"; "identity" })
+
 module:hook("s2s-check-certificate", function(event)
 	local session, host, cert = event.session, event.host, event.cert;
 	local conn = session.conn:socket();
@@ -43,5 +46,6 @@
 			log("debug", "certificate identity validation result: %s", session.cert_identity_status);
 		end
 	end
+	measure_cert_statuses:with_labels(session.cert_chain_status or "unknown", session.cert_identity_status or "unknown"):add(1);
 end, 509);