Skip to content

Commit

Permalink
Bug 2097830: macOS: certificate is untrusted error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross Peoples committed Jul 15, 2022
1 parent ddfe9e9 commit 0e24036
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/cli/login/loginoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net"
"os"
"path/filepath"
"strings"
"time"

kerrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -136,6 +137,10 @@ func (o *LoginOptions) getClientConfig() (*restclient.Config, error) {
// try to TCP connect to the server to make sure it's reachable, and discover
// about the need of certificates or insecure TLS
if err := dialToServer(*clientConfig); err != nil {
if strings.Contains(err.Error(), "certificate is not trusted") {
err = x509.CertificateInvalidError{Reason: x509.Expired, Detail: err.Error()}
}

switch err.(type) {
// certificate authority unknown, check or prompt if we want an insecure
// connection or if we already have a cluster stanza that tells us to
Expand Down

0 comments on commit 0e24036

Please sign in to comment.