fixed tls ca
This commit is contained in:
parent
41027fa380
commit
59d44932a4
2 changed files with 3 additions and 14 deletions
|
|
@ -21,6 +21,7 @@ func ParseFile(file string) (cfg *Config, err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
cfg = new(Config)
|
||||
err = yaml.NewDecoder(f).Decode(cfg)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue