From ad2bc1fd8907c62d233cc09dcfb50dd19d7b0e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Fri, 25 Aug 2023 22:36:00 +0200 Subject: [PATCH] publish: Improve certificate verification Remove colons and convert to lower case. hex.EncodeToString outputs a lower case string. --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 7fa4e99..a3a2ccf 100644 --- a/main.go +++ b/main.go @@ -333,7 +333,8 @@ func (br *bridge) publish(n *notification) error { req.Header.Set("Actions", fmt.Sprintf("http, Silence, %s, method=POST, body=%s%s", url, n.silenceBody, authString)) } - configFingerprint := br.cfg.Ntfy.CertFingerprint + // hex.EncodeToString outputs a lower case string + configFingerprint := strings.ToLower(strings.ReplaceAll(br.cfg.Ntfy.CertFingerprint, ":", "")) if configFingerprint != "" { tlsCfg := &tls.Config{} tlsCfg.VerifyPeerCertificate = func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {