mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-05 15:42:46 +00:00
Remove TLS fingerprints, improve perspective unmarshal handling (#1452)
* Add prefer_direct_fetch option * Update gomatrixserverlib * Update gomatrixserverlib * Update gomatrixserverlib * Don't deal in TLS fingerprints anymore
This commit is contained in:
parent
43cdba9a69
commit
f290e92a34
10 changed files with 34 additions and 58 deletions
|
@ -16,7 +16,6 @@ package config
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/sha256"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"io"
|
||||
|
@ -252,20 +251,6 @@ func loadConfig(
|
|||
c.Global.OldVerifyKeys[i].KeyID, c.Global.OldVerifyKeys[i].PrivateKey = keyID, privateKey
|
||||
}
|
||||
|
||||
for _, certPath := range c.FederationAPI.FederationCertificatePaths {
|
||||
absCertPath := absPath(basePath, certPath)
|
||||
var pemData []byte
|
||||
pemData, err = readFile(absCertPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fingerprint := fingerprintPEM(pemData)
|
||||
if fingerprint == nil {
|
||||
return nil, fmt.Errorf("no certificate PEM data in %q", absCertPath)
|
||||
}
|
||||
c.FederationAPI.TLSFingerPrints = append(c.FederationAPI.TLSFingerPrints, *fingerprint)
|
||||
}
|
||||
|
||||
c.MediaAPI.AbsBasePath = Path(absPath(basePath, c.MediaAPI.BasePath))
|
||||
|
||||
// Generate data from config options
|
||||
|
@ -494,20 +479,6 @@ func readKeyPEM(path string, data []byte, enforceKeyIDFormat bool) (gomatrixserv
|
|||
}
|
||||
}
|
||||
|
||||
func fingerprintPEM(data []byte) *gomatrixserverlib.TLSFingerprint {
|
||||
for {
|
||||
var certDERBlock *pem.Block
|
||||
certDERBlock, data = pem.Decode(data)
|
||||
if data == nil {
|
||||
return nil
|
||||
}
|
||||
if certDERBlock.Type == "CERTIFICATE" {
|
||||
digest := sha256.Sum256(certDERBlock.Bytes)
|
||||
return &gomatrixserverlib.TLSFingerprint{SHA256: digest[:]}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AppServiceURL returns a HTTP URL for where the appservice component is listening.
|
||||
func (config *Dendrite) AppServiceURL() string {
|
||||
// Hard code the appservice server to talk HTTP for now.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue