fixed tls ca

This commit is contained in:
ston1th 2020-11-15 01:20:25 +01:00
commit 59d44932a4
2 changed files with 3 additions and 14 deletions

View file

@ -5,7 +5,6 @@ import (
"crypto/x509"
"io/ioutil"
"net"
"os"
"time"
"git.giftfish.de/ston1th/vipman/pkg/config"
@ -25,23 +24,12 @@ func loadCertPool(file string) (p *x509.CertPool, err error) {
if file == "" {
return
}
f, err := os.Open(file)
if err != nil {
return
}
defer f.Close()
buf, err := ioutil.ReadAll(f)
if err != nil {
return
}
certs, err := x509.ParseCertificates(buf)
buf, err := ioutil.ReadFile(file)
if err != nil {
return
}
p = x509.NewCertPool()
for _, c := range certs {
p.AddCert(c)
}
p.AppendCertsFromPEM(buf)
return
}