From 670b538dde78ce28f09b7be83f787722ccabca59 Mon Sep 17 00:00:00 2001 From: Aditya Manthramurthy Date: Tue, 19 Jun 2018 13:38:22 -0700 Subject: [PATCH] Fix server crash when no system certificates are found (#6055) --- cmd/certs.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/certs.go b/cmd/certs.go index fdc910501..a7378f20b 100644 --- a/cmd/certs.go +++ b/cmd/certs.go @@ -86,10 +86,11 @@ func getRootCAs(certsCAsDir string) (*x509.CertPool, error) { return nil, nil } - rootCAs, err := x509.SystemCertPool() - if err != nil { - // In some systems like Windows, system cert pool is not supported. - // Hence we create a new cert pool. + rootCAs, _ := x509.SystemCertPool() + if rootCAs == nil { + // In some systems (like Windows) system cert pool is + // not supported or no certificates are present on the + // system - so we create a new cert pool. rootCAs = x509.NewCertPool() }