service: convert network certfp to lower-case

In tls.Config.VerifyPeerCertificate, we compare it against the
result of hex.EncodeToString.
This commit is contained in:
Simon Ser 2023-10-24 16:51:42 +02:00
parent d93251e714
commit 467f8cd187

View File

@ -526,7 +526,7 @@ func (fs *networkFlagSet) update(network *database.Network) error {
network.Realname = *fs.Realname network.Realname = *fs.Realname
} }
if fs.CertFP != nil { if fs.CertFP != nil {
certFP := strings.ReplaceAll(*fs.CertFP, ":", "") certFP := strings.ToLower(strings.ReplaceAll(*fs.CertFP, ":", ""))
if _, err := hex.DecodeString(certFP); err != nil { if _, err := hex.DecodeString(certFP); err != nil {
return fmt.Errorf("the certificate fingerprint must be hex-encoded") return fmt.Errorf("the certificate fingerprint must be hex-encoded")
} }