From 608d4f11cfec88ee963194c33c1d100147a061ba Mon Sep 17 00:00:00 2001 From: Fredrik Wrede Date: Mon, 31 Oct 2022 12:22:06 +0100 Subject: [PATCH] Bugfix - Fetch ca cert via ssl package (#440) --- fedn/fedn/client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fedn/fedn/client.py b/fedn/fedn/client.py index 471bd960e..37ba07be7 100644 --- a/fedn/fedn/client.py +++ b/fedn/fedn/client.py @@ -4,6 +4,7 @@ import os import queue import re +import ssl import sys import tempfile import threading @@ -267,8 +268,9 @@ def _connect(self, client_config): elif self.config['secure']: secure = True print("CLIENT: using CA certificate for GRPC channel") + cert = ssl.get_server_certificate((host, port)) - credentials = grpc.ssl_channel_credentials() + credentials = grpc.ssl_channel_credentials(cert.encode('utf-8')) channel = grpc.secure_channel("{}:{}".format(host, str(port)), credentials) else: print("CLIENT: using insecure GRPC channel")