* tlsConfigStatus.usable is public, renamed ("ValidPair") and is exported to json ("valid_pair")
This commit is contained in:
parent
f4a6ca726c
commit
5ad9f8ead2
2
app.go
2
app.go
|
@ -179,7 +179,7 @@ func run(args options) {
|
|||
address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.TLS.PortHTTPS))
|
||||
// validate current TLS config and update warnings (it could have been loaded from file)
|
||||
data := validateCertificates(config.TLS.CertificateChain, config.TLS.PrivateKey, config.TLS.ServerName)
|
||||
if !data.usable {
|
||||
if !data.ValidPair {
|
||||
log.Fatal(data.WarningValidation)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ type tlsConfigStatus struct {
|
|||
KeyType string `yaml:"-" json:"key_type,omitempty"` // KeyType is one of RSA or ECDSA
|
||||
|
||||
// is usable? set by validator
|
||||
usable bool
|
||||
ValidPair bool `yaml:"-" json:"valid_pair"` // ValidPair is true if both certificate and private key are correct
|
||||
|
||||
// warnings
|
||||
WarningValidation string `yaml:"-" json:"warning_validation,omitempty"` // WarningValidation is a validation warning message with the issue description
|
||||
|
|
|
@ -1227,7 +1227,7 @@ func validateCertificates(certChain, pkey, serverName string) tlsConfigStatus {
|
|||
data.WarningValidation = fmt.Sprintf("Invalid certificate or key: %s", err)
|
||||
return data
|
||||
}
|
||||
data.usable = true
|
||||
data.ValidPair = true
|
||||
}
|
||||
|
||||
return data
|
||||
|
|
|
@ -71,7 +71,7 @@ kXS9jgARhhiWXJrk
|
|||
data.NotBefore == notBefore &&
|
||||
data.NotAfter == notAfter &&
|
||||
// data.DNSNames[0] == &&
|
||||
data.usable) {
|
||||
data.ValidPair) {
|
||||
t.Fatalf("valid cert & priv key: validateCertificates(): %v", data)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1247,6 +1247,10 @@ definitions:
|
|||
type: "string"
|
||||
example: "You have specified an empty certificate"
|
||||
description: "warning_validation is a validation warning message with the issue description"
|
||||
valid_pair:
|
||||
type: "boolean"
|
||||
example: "true"
|
||||
description: "valid_pair is true if both certificate and private key are correct"
|
||||
NetInterface:
|
||||
type: "object"
|
||||
description: "Network interface info"
|
||||
|
|
Loading…
Reference in New Issue