Skip to content

Commit 778e898

Browse files
author
Ubuntu
committed
remote attestation for openfl participants
1 parent e848af1 commit 778e898

File tree

7 files changed

+651
-1
lines changed

7 files changed

+651
-1
lines changed

openfl-docker/gramine_app/fx.manifest.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,5 @@ sgx.allowed_files = [
7171
"file:{{ workspace_root }}/plan/cols.yaml",
7272
"file:{{ workspace_root }}/plan/data.yaml",
7373
"file:{{ workspace_root }}/plan/plan.yaml",
74+
"file:{{ workspace_root }}/attestation",
7475
]

openfl-workspace/workspace/plan/defaults/network.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ settings:
44
agg_port : auto
55
hash_salt : auto
66
use_tls : True
7+
enable_remote_attestation : False
78
client_reconnect_interval : 5
89
require_client_auth : True
910
cert_folder : cert

openfl/interface/aggregator.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from openfl.utilities import click_types
3535
from openfl.utilities.path_check import is_directory_traversal
3636
from openfl.utilities.utils import getfqdn_env
37+
from openfl.utilities.attestation import attestation_utils as attestation_utils
3738

3839
logger = getLogger(__name__)
3940

@@ -90,6 +91,21 @@ def start_(plan, authorized_cols, task_group):
9091
parsed_plan.config["assigner"]["settings"] = {}
9192
parsed_plan.config["assigner"]["settings"]["selected_task_group"] = task_group
9293
logger.info(f"Setting aggregator to assign: {task_group} task_group")
94+
95+
# Check if remote attestation is enabled in the plan configuration
96+
if parsed_plan.config["network"]["settings"].get("enable_remote_attestation", False):
97+
# Fetch remote attestation environment variables
98+
attestation_env = attestation_utils.fetch_attestation_env_vars()
99+
if attestation_env is not None:
100+
attestation_mr = attestation_utils.AttestationManager("aggregator", attestation_env["ATTESTATION_REPORT_PATH"], attestation_env["ITA_API_KEY"], attestation_env["AVS_URL"])
101+
# Generate and store the attestation report
102+
attestation_mr.get_attested_identity()
103+
logger.info("Remote attestation report fetched successfully.")
104+
else:
105+
logger.error("Failed to fetch remote attestation environment variables.")
106+
else:
107+
logger.info("Remote attestation is not enabled. Skipping attestation report generation.")
108+
93109

94110
logger.info("🧿 Starting the Aggregator Service.")
95111

openfl/interface/collaborator.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from openfl.interface.cli_helper import CERT_DIR
2626
from openfl.utilities.path_check import is_directory_traversal
2727
from openfl.utilities.utils import rmtree
28-
28+
from openfl.utilities.attestation import attestation_utils as attestation_utils
2929
logger = getLogger(__name__)
3030

3131

@@ -78,6 +78,20 @@ def start_(plan, collaborator_name, data_config):
7878

7979
# TODO: Need to restructure data loader config file loader
8080

81+
# Check if remote attestation is enabled in the plan configuration
82+
if plan.config["network"]["settings"].get("enable_remote_attestation", False):
83+
# Fetch remote attestation environment variables
84+
attestation_env = attestation_utils.fetch_attestation_env_vars()
85+
if attestation_env is not None:
86+
attestation_mr = attestation_utils.AttestationManager(collaborator_name, attestation_env["ATTESTATION_REPORT_PATH"], attestation_env["ITA_API_KEY"], attestation_env["AVS_URL"])
87+
# Generate and store the attestation report
88+
attestation_mr.get_attested_identity()
89+
logger.info("Remote attestation report stored successfully.")
90+
else:
91+
logger.error("Remote attestation environment variables not set.")
92+
else:
93+
logger.info("Remote attestation is not enabled in the plan configuration.")
94+
8195
echo(f"Data = {plan.cols_data_paths}")
8296
logger.info("🧿 Starting a Collaborator Service.")
8397

openfl/utilities/attestation/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)