From 735ba2df245274dc5c385684667d25829adf3460 Mon Sep 17 00:00:00 2001 From: Fredrik Wrede Date: Mon, 13 Nov 2023 16:12:04 +0000 Subject: [PATCH 1/4] update version tag --- docs/conf.py | 2 +- fedn/setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 963080333..bd2032b0e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,7 +12,7 @@ author = 'Scaleout Systems AB' # The full version, including alpha/beta/rc tags -release = '0.4.1' +release = '0.6.0' # Add any Sphinx extension module names here, as strings extensions = [ diff --git a/fedn/setup.py b/fedn/setup.py index 1dbdb951f..62888ce09 100644 --- a/fedn/setup.py +++ b/fedn/setup.py @@ -2,7 +2,7 @@ setup( name='fedn', - version='0.5.0', + version='0.6.0', description="""Scaleout Federated Learning""", author='Scaleout Systems AB', author_email='contact@scaleoutsystems.com', From caf512e2eb4e502c32900684b6ffd59bd93d6162 Mon Sep 17 00:00:00 2001 From: Fredrik Wrede Date: Tue, 14 Nov 2023 16:48:25 +0000 Subject: [PATCH 2/4] Update base image to python v3.10 --- Dockerfile | 2 +- docker-compose.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 67f026d03..fa8c5bd22 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Base image -ARG BASE_IMG=python:3.9-slim +ARG BASE_IMG=python:3.10-slim FROM $BASE_IMG # Requirements (use MNIST Keras as default) diff --git a/docker-compose.yaml b/docker-compose.yaml index c8d3aff15..aa4550c25 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -68,7 +68,7 @@ services: build: context: . args: - BASE_IMG: ${BASE_IMG:-python:3.9-slim} + BASE_IMG: ${BASE_IMG:-python:3.10-slim} working_dir: /app volumes: - ${HOST_REPO_DIR:-.}/fedn:/app/fedn @@ -89,7 +89,7 @@ services: build: context: . args: - BASE_IMG: ${BASE_IMG:-python:3.9-slim} + BASE_IMG: ${BASE_IMG:-python:3.10-slim} working_dir: /app volumes: - ${HOST_REPO_DIR:-.}/fedn:/app/fedn @@ -110,7 +110,7 @@ services: build: context: . args: - BASE_IMG: ${BASE_IMG:-python:3.9-slim} + BASE_IMG: ${BASE_IMG:-python:3.10-slim} working_dir: /app volumes: - ${HOST_REPO_DIR:-.}/fedn:/app/fedn @@ -127,7 +127,7 @@ services: build: context: . args: - BASE_IMG: ${BASE_IMG:-python:3.9-slim} + BASE_IMG: ${BASE_IMG:-python:3.10-slim} working_dir: /app volumes: - ${HOST_REPO_DIR:-.}/fedn:/app/fedn From 1d2695356b6c2dcfdeb20edfbdbee2655a467000 Mon Sep 17 00:00:00 2001 From: stefanhellander <59477428+stefanhellander@users.noreply.github.com> Date: Thu, 16 Nov 2023 13:22:11 +0100 Subject: [PATCH 3/4] Bugfix/SK-581 | Fixes problem with download of ssl cert when using python 3.9 (#486) --- fedn/fedn/network/clients/client.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/fedn/fedn/network/clients/client.py b/fedn/fedn/network/clients/client.py index b003136e8..e27616925 100644 --- a/fedn/fedn/network/clients/client.py +++ b/fedn/fedn/network/clients/client.py @@ -4,7 +4,7 @@ import os import queue import re -import ssl +import socket import sys import tempfile import threading @@ -15,7 +15,9 @@ from io import BytesIO import grpc +from cryptography.hazmat.primitives.serialization import Encoding from google.protobuf.json_format import MessageToJson +from OpenSSL import SSL import fedn.common.net.grpc.fedn_pb2 as fedn import fedn.common.net.grpc.fedn_pb2_grpc as rpc @@ -149,6 +151,20 @@ def _add_grpc_metadata(self, key, value): # Set metadata using tuple concatenation self.metadata += ((key, value),) + def _get_ssl_certificate(self, domain, port=443): + context = SSL.Context(SSL.SSLv23_METHOD) + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.connect((domain, port)) + ssl_sock = SSL.Connection(context, sock) + ssl_sock.set_tlsext_host_name(domain.encode()) + ssl_sock.set_connect_state() + ssl_sock.do_handshake() + cert = ssl_sock.get_peer_certificate() + ssl_sock.close() + sock.close() + cert = cert.to_cryptography().public_bytes(Encoding.PEM).decode() + return cert + def _connect(self, client_config): """Connect to assigned combiner. @@ -186,7 +202,7 @@ 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)) + cert = self._get_ssl_certificate(host, port=port) credentials = grpc.ssl_channel_credentials(cert.encode('utf-8')) if self.config['token']: From 36cf7f7972258f951965a9fb7f71ddab165aa48f Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 17 Nov 2023 14:24:32 +0100 Subject: [PATCH 4/4] Bugfix/SK-582 | If session id is empty it should be set to guid (#488) --- fedn/fedn/network/api/client.py | 5 ----- fedn/fedn/network/api/interface.py | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/fedn/fedn/network/api/client.py b/fedn/fedn/network/api/client.py index 0e0a48a52..58fc27304 100644 --- a/fedn/fedn/network/api/client.py +++ b/fedn/fedn/network/api/client.py @@ -1,5 +1,3 @@ -import uuid - import requests __all__ = ['APIClient'] @@ -137,9 +135,6 @@ def start_session(self, session_id=None, round_timeout=180, rounds=5, round_buff :return: A dict with success or failure message and session config. :rtype: dict """ - # If session id is None, generate a random session id. - if session_id is None: - session_id = str(uuid.uuid4()) response = requests.post(self._get_url('start_session'), json={ 'session_id': session_id, 'round_timeout': round_timeout, diff --git a/fedn/fedn/network/api/interface.py b/fedn/fedn/network/api/interface.py index 0821ed176..e56462493 100644 --- a/fedn/fedn/network/api/interface.py +++ b/fedn/fedn/network/api/interface.py @@ -2,6 +2,7 @@ import copy import os import threading +import uuid from io import BytesIO from flask import jsonify, send_from_directory @@ -863,7 +864,7 @@ def start_session( # Setup session config session_config = { - "session_id": session_id, + "session_id": session_id if session_id else str(uuid.uuid4()), "round_timeout": round_timeout, "buffer_size": round_buffer_size, "model_id": model_id,