support loading certs from a directory

Add `remotes/certutil` functions for loading `ca.crt`, `client.cert`, and `client.key` into `tls.Config` from a directory like `/etc/docker/certs.d/<hostname>.

See https://docs.docker.com/engine/security/certificates/ .

Client applications including CRI plugin are expected to configure the resolver using these functions.

As an example, the `ctr` tool is extended to support `ctr images pull --certs-dir=/etc/docker/certs.d example.com/foo/bar:baz`.

Tested with Harbor 1.8.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2019-08-10 17:07:58 +09:00
committed by Derek McGowan
parent e852da5855
commit dc131aa862
3 changed files with 164 additions and 0 deletions

View File

@@ -61,6 +61,11 @@ var (
Name: "refresh",
Usage: "refresh token for authorization server",
},
cli.StringFlag{
Name: "certs-dir",
// compatible with "/etc/docker/certs.d"
Usage: "custom certificates directory that contains \"<hostname>/{ca.crt, client.cert, client.key}\"",
},
}
// ContainerFlags are cli flags specifying container options