Skip to content

Commit b61b328

Browse files
author
Ubuntu
committed
remote attestation for openfl participants
Signed-off-by: Ubuntu <azureuser@ofl-dev-vm-ad-anshumi1.qnxiewjiflyubbpcwut13wv1wh.cx.internal.cloudapp.net>
1 parent d8568e1 commit b61b328

File tree

7 files changed

+655
-0
lines changed

7 files changed

+655
-0
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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from openfl.federated import Plan
3333
from openfl.interface.cli_helper import CERT_DIR
3434
from openfl.utilities import click_types
35+
from openfl.utilities.attestation import attestation_utils as attestation_utils
3536
from openfl.utilities.path_check import is_directory_traversal
3637
from openfl.utilities.utils import getfqdn_env
3738

@@ -91,6 +92,25 @@ def start_(plan, authorized_cols, task_group):
9192
parsed_plan.config["assigner"]["settings"]["selected_task_group"] = task_group
9293
logger.info(f"Setting aggregator to assign: {task_group} task_group")
9394

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(
101+
"aggregator",
102+
attestation_env["ATTESTATION_REPORT_PATH"],
103+
attestation_env["ITA_API_KEY"],
104+
attestation_env["AVS_URL"],
105+
)
106+
# Generate and store the attestation report
107+
attestation_mr.get_attested_identity()
108+
logger.info("Remote attestation report fetched successfully.")
109+
else:
110+
logger.error("Failed to fetch remote attestation environment variables.")
111+
else:
112+
logger.info("Remote attestation is not enabled. Skipping attestation report generation.")
113+
94114
logger.info("🧿 Starting the Aggregator Service.")
95115

96116
parsed_plan.get_server().serve()

openfl/interface/collaborator.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from openfl.cryptography.participant import generate_csr
2424
from openfl.federated import Plan
2525
from openfl.interface.cli_helper import CERT_DIR
26+
from openfl.utilities.attestation import attestation_utils as attestation_utils
2627
from openfl.utilities.path_check import is_directory_traversal
2728
from openfl.utilities.utils import rmtree
2829

@@ -78,6 +79,25 @@ def start_(plan, collaborator_name, data_config):
7879

7980
# TODO: Need to restructure data loader config file loader
8081

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

openfl/utilities/attestation/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)