Verify TLS keys loaded from docker contexts

This maches the behaviour of the docker cli when using contexts.

Signed-off-by: Hakan Ardo <hakan@debian.org>
This commit is contained in:
Hakan Ardo 2021-03-03 09:27:21 +01:00
parent 55f405e04a
commit c239d66d5d
1 changed files with 5 additions and 1 deletions

View File

@ -127,8 +127,12 @@ class Context:
elif filename.startswith("key"):
key = os.path.join(tls_dir, endpoint, filename)
if all([ca_cert, cert, key]):
verify = None
if endpoint == "docker":
if not self.endpoints["docker"].get("SkipTLSVerify", False):
verify = True
certs[endpoint] = TLSConfig(
client_cert=(cert, key), ca_cert=ca_cert)
client_cert=(cert, key), ca_cert=ca_cert, verify=verify)
self.tls_cfg = certs
self.tls_path = tls_dir