Skip to content

Commit

Permalink
better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
hanshasselberg committed Nov 19, 2019
1 parent ece875d commit d0cb36f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tlsutil/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,20 @@ func (c *Configurator) check(config Config, pool *x509.CertPool, cert *tls.Certi

// Ensure we have a CA and cert if VerifyIncoming is set
if config.anyVerifyIncoming() {
autoEncryptMsg := " AutoEncrypt only secures the connection between client and server and doesn't affect incoming connections on the client."
if pool == nil {
return fmt.Errorf("VerifyIncoming set, and no CA certificate provided!")
errMsg := "VerifyIncoming set, and no CA certificate provided!"
if config.AutoEncryptTLS {
errMsg += autoEncryptMsg
}
return fmt.Errorf(errMsg)
}
if cert == nil {
return fmt.Errorf("VerifyIncoming set, and no Cert/Key pair provided!")
errMsg := "VerifyIncoming set, and no Cert/Key pair provided!"
if config.AutoEncryptTLS {
errMsg += autoEncryptMsg
}
return fmt.Errorf(errMsg)
}
}
return nil
Expand Down

0 comments on commit d0cb36f

Please sign in to comment.