From 0ed4126240afa25d730f18d520cb7c753545ab40 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Sat, 29 Dec 2018 05:39:16 -0800 Subject: [PATCH] Fix cert and key file mix up Signed-off-by: Tamal Saha --- api/v3/server.go | 2 +- pkg/grpcutil/muxed_server.go | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/api/v3/server.go b/api/v3/server.go index 4cac16fe..0cd1c732 100644 --- a/api/v3/server.go +++ b/api/v3/server.go @@ -76,7 +76,7 @@ func loggingHandler(h http.Handler) http.Handler { } // 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{ Addr: addr, ServicesFunc: func(gsrv *grpc.Server) { diff --git a/pkg/grpcutil/muxed_server.go b/pkg/grpcutil/muxed_server.go index e444b90d..6d11da87 100644 --- a/pkg/grpcutil/muxed_server.go +++ b/pkg/grpcutil/muxed_server.go @@ -116,8 +116,14 @@ func (srv *MuxedGRPCServer) ListenAndServeTLS(certFile, keyFile, caPath string, if srv.TLSConfig == nil { srv.TLSConfig = &tls.Config{} } - configureCA(srv.TLSConfig, caPath) - configureCertificate(srv.TLSConfig, certFile, keyFile) + err := configureCA(srv.TLSConfig, caPath) + 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) if err != nil {