* control: TLS: don't return empty error messages
This commit is contained in:
parent
241e7ca20c
commit
224c2a891d
|
@ -138,14 +138,14 @@ func verifyCertChain(data *tlsConfigStatus, certChain string, serverName string)
|
||||||
parsed, err := x509.ParseCertificate(cert.Bytes)
|
parsed, err := x509.ParseCertificate(cert.Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
data.WarningValidation = fmt.Sprintf("Failed to parse certificate: %s", err)
|
data.WarningValidation = fmt.Sprintf("Failed to parse certificate: %s", err)
|
||||||
return errors.New("")
|
return errors.New(data.WarningValidation)
|
||||||
}
|
}
|
||||||
parsedCerts = append(parsedCerts, parsed)
|
parsedCerts = append(parsedCerts, parsed)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(parsedCerts) == 0 {
|
if len(parsedCerts) == 0 {
|
||||||
data.WarningValidation = fmt.Sprintf("You have specified an empty certificate")
|
data.WarningValidation = fmt.Sprintf("You have specified an empty certificate")
|
||||||
return errors.New("")
|
return errors.New(data.WarningValidation)
|
||||||
}
|
}
|
||||||
|
|
||||||
data.ValidCert = true
|
data.ValidCert = true
|
||||||
|
@ -214,14 +214,14 @@ func validatePkey(data *tlsConfigStatus, pkey string) error {
|
||||||
|
|
||||||
if key == nil {
|
if key == nil {
|
||||||
data.WarningValidation = "No valid keys were found"
|
data.WarningValidation = "No valid keys were found"
|
||||||
return errors.New("")
|
return errors.New(data.WarningValidation)
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse the decoded key
|
// parse the decoded key
|
||||||
_, keytype, err := parsePrivateKey(key.Bytes)
|
_, keytype, err := parsePrivateKey(key.Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
data.WarningValidation = fmt.Sprintf("Failed to parse private key: %s", err)
|
data.WarningValidation = fmt.Sprintf("Failed to parse private key: %s", err)
|
||||||
return errors.New("")
|
return errors.New(data.WarningValidation)
|
||||||
}
|
}
|
||||||
|
|
||||||
data.ValidKey = true
|
data.ValidKey = true
|
||||||
|
|
Loading…
Reference in New Issue