mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #19507 from aaronlehmann/certificate-error-message
Clarify error message when a .cert file is missing a corresponding key
This commit is contained in:
commit
aed5691644
1 changed files with 2 additions and 2 deletions
|
@ -109,7 +109,7 @@ func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
|
||||||
keyName := certName[:len(certName)-5] + ".key"
|
keyName := certName[:len(certName)-5] + ".key"
|
||||||
logrus.Debugf("cert: %s", filepath.Join(directory, f.Name()))
|
logrus.Debugf("cert: %s", filepath.Join(directory, f.Name()))
|
||||||
if !hasFile(fs, keyName) {
|
if !hasFile(fs, keyName) {
|
||||||
return fmt.Errorf("Missing key %s for certificate %s", keyName, certName)
|
return fmt.Errorf("Missing key %s for client certificate %s. Note that CA certificates should use the extension .crt.", keyName, certName)
|
||||||
}
|
}
|
||||||
cert, err := tls.LoadX509KeyPair(filepath.Join(directory, certName), filepath.Join(directory, keyName))
|
cert, err := tls.LoadX509KeyPair(filepath.Join(directory, certName), filepath.Join(directory, keyName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -122,7 +122,7 @@ func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
|
||||||
certName := keyName[:len(keyName)-4] + ".cert"
|
certName := keyName[:len(keyName)-4] + ".cert"
|
||||||
logrus.Debugf("key: %s", filepath.Join(directory, f.Name()))
|
logrus.Debugf("key: %s", filepath.Join(directory, f.Name()))
|
||||||
if !hasFile(fs, certName) {
|
if !hasFile(fs, certName) {
|
||||||
return fmt.Errorf("Missing certificate %s for key %s", certName, keyName)
|
return fmt.Errorf("Missing client certificate %s for key %s", certName, keyName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue