Merge pull request #679 from kubeshield/master

Fix cert and key file mix up
This commit is contained in:
Jimmy Zelinskie 2019-01-08 19:06:41 -05:00 committed by GitHub
commit effe1552fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -76,7 +76,7 @@ func loggingHandler(h http.Handler) http.Handler {
} }
// ListenAndServe serves the Clair v3 API over gRPC and the gRPC Gateway. // ListenAndServe serves the Clair v3 API over gRPC and the gRPC Gateway.
func ListenAndServe(addr, keyFile, certFile, caPath string, store database.Datastore) error { func ListenAndServe(addr, certFile, keyFile, caPath string, store database.Datastore) error {
srv := grpcutil.MuxedGRPCServer{ srv := grpcutil.MuxedGRPCServer{
Addr: addr, Addr: addr,
ServicesFunc: func(gsrv *grpc.Server) { ServicesFunc: func(gsrv *grpc.Server) {

View File

@ -116,8 +116,14 @@ func (srv *MuxedGRPCServer) ListenAndServeTLS(certFile, keyFile, caPath string,
if srv.TLSConfig == nil { if srv.TLSConfig == nil {
srv.TLSConfig = &tls.Config{} srv.TLSConfig = &tls.Config{}
} }
configureCA(srv.TLSConfig, caPath) err := configureCA(srv.TLSConfig, caPath)
configureCertificate(srv.TLSConfig, certFile, keyFile) if err != nil {
return err
}
err = configureCertificate(srv.TLSConfig, certFile, keyFile)
if err != nil {
return err
}
listener, err := tls.Listen("tcp", srv.Addr, srv.TLSConfig) listener, err := tls.Listen("tcp", srv.Addr, srv.TLSConfig)
if err != nil { if err != nil {