Skip to content

Commit c239d66

Browse files
committed
Verify TLS keys loaded from docker contexts
This maches the behaviour of the docker cli when using contexts. Signed-off-by: Hakan Ardo <[email protected]>
1 parent 55f405e commit c239d66

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docker/context/context.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,12 @@ def _load_certs(self):
127127
elif filename.startswith("key"):
128128
key = os.path.join(tls_dir, endpoint, filename)
129129
if all([ca_cert, cert, key]):
130+
verify = None
131+
if endpoint == "docker":
132+
if not self.endpoints["docker"].get("SkipTLSVerify", False):
133+
verify = True
130134
certs[endpoint] = TLSConfig(
131-
client_cert=(cert, key), ca_cert=ca_cert)
135+
client_cert=(cert, key), ca_cert=ca_cert, verify=verify)
132136
self.tls_cfg = certs
133137
self.tls_path = tls_dir
134138

0 commit comments

Comments
 (0)