publish: Improve certificate verification
Remove colons and convert to lower case. hex.EncodeToString outputs a lower case string.
This commit is contained in:
parent
25e65db8bd
commit
ad2bc1fd89
1 changed files with 2 additions and 1 deletions
3
main.go
3
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))
|
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 != "" {
|
if configFingerprint != "" {
|
||||||
tlsCfg := &tls.Config{}
|
tlsCfg := &tls.Config{}
|
||||||
tlsCfg.VerifyPeerCertificate = func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
|
tlsCfg.VerifyPeerCertificate = func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
|
||||||
|
|
Loading…
Reference in a new issue