mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
commit
ae6651a919
2 changed files with 11 additions and 4 deletions
|
@ -15,4 +15,5 @@ var (
|
|||
ErrBadBlob = errors.New("blob: bad blob")
|
||||
ErrBadBlobDigest = errors.New("blob: bad blob digest")
|
||||
ErrUnknownCode = errors.New("error: unknown error code")
|
||||
ErrBadCACert = errors.New("tls: invalid ca cert")
|
||||
)
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
|
||||
"github.com/anuvu/zot/errors"
|
||||
"github.com/anuvu/zot/pkg/storage"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/rs/zerolog"
|
||||
|
@ -56,11 +57,16 @@ func (c *Controller) Run() error {
|
|||
panic(err)
|
||||
}
|
||||
caCertPool := x509.NewCertPool()
|
||||
caCertPool.AppendCertsFromPEM(caCert)
|
||||
server.TLSConfig = &tls.Config{
|
||||
ClientAuth: clientAuth,
|
||||
ClientCAs: caCertPool,
|
||||
if !caCertPool.AppendCertsFromPEM(caCert) {
|
||||
panic(errors.ErrBadCACert)
|
||||
}
|
||||
server.TLSConfig = &tls.Config{
|
||||
ClientAuth: clientAuth,
|
||||
ClientCAs: caCertPool,
|
||||
PreferServerCipherSuites: true,
|
||||
MinVersion: tls.VersionTLS12,
|
||||
}
|
||||
server.TLSConfig.BuildNameToCertificate()
|
||||
}
|
||||
|
||||
return server.ServeTLS(l, c.Config.HTTP.TLS.Cert, c.Config.HTTP.TLS.Key)
|
||||
|
|
Loading…
Reference in a new issue