summaryrefslogtreecommitdiff
path: root/registry/registry.go
diff options
context:
space:
mode:
authorAaron Lehmann <aaron.lehmann@docker.com>2016-01-20 10:53:41 -0800
committerAaron Lehmann <aaron.lehmann@docker.com>2016-01-20 11:34:59 -0800
commitd5e2802eae4815b06ce477d8de54fe0caa3aa812 (patch)
tree4bc2b1d1b2beaea945709461e13d177ee76fdb6b /registry/registry.go
parent4b63689679089f7bb2286e7c330d6a7884c0aec3 (diff)
downloaddocker-d5e2802eae4815b06ce477d8de54fe0caa3aa812.tar.gz
Clarify error message when a .cert file is missing a corresponding key
The daemon uses two similar filename extensions to identify different kinds of certificates. ".crt" files are interpreted as CA certificates, and ".cert" files are interprted as client certificates. If a CA certificate is accidentally given the extension ".cert", it will lead to the following error message: Missing key ca.key for certificate ca.cert To make this slightly less confusing, clarify the error message with a note that CA certificates should use the extension ".crt". Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Diffstat (limited to 'registry/registry.go')
-rw-r--r--registry/registry.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/registry/registry.go b/registry/registry.go
index 643fa56e6a..bacc4aed1f 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -109,7 +109,7 @@ func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
keyName := certName[:len(certName)-5] + ".key"
logrus.Debugf("cert: %s", filepath.Join(directory, f.Name()))
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))
if err != nil {
@@ -122,7 +122,7 @@ func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
certName := keyName[:len(keyName)-4] + ".cert"
logrus.Debugf("key: %s", filepath.Join(directory, f.Name()))
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)
}
}
}