Provisioning in NVIDIA FLARE

A necessary first step in establishing a federation is provisioning to establish the identities of the server, clients, and admin clients.

When operating federated learning, communication channels use shared TLS certificates generated during provisioning to establish the identities and secure communication between participants.

Provisioning in NVIDIA FLARE generates mutual-trusted system-wide configurations for all participants so all of them can join the NVIDIA FLARE system across different locations. To achieve this, a provisioning tool powered by the Open Provision API and its builder modules is included in NVIDIA FLARE (nvflare.lighter) to create a startup kit for each participant with the necessary configuration artifacts.

The configurations usually include, but are not limited to, the following information:

  • network discovery, such as domain names, port numbers or IP addresses

  • credentials for authentication, such as certificates of participants and root authority

  • authorization policy, such as roles, rights and rules

  • tamper-proof mechanism, such as signatures

  • convenient commands, such as shell scripts with default command line options to easily start an individual participant

In order to enable developers to freely add / modify / remove the above configurations to fit their own requirements, we created the Open Provision API. Now developers can take advantage of this API to perform the provisioning tasks which meet their own requirements in addition to the default provisioning before for creating packages for the server, client, and administrators.

NVIDIA FLARE Open Provision API

Architecture

../_images/Open_Provision_API.png

The above diagram describes the architecture of NVIDIA FLARE Open Provision API in blue. Those two green blocks are the sample python code (provision.py) collecting project configuration information (project.yml) and interacting with components of Open Provision API to accomplish a provisioning task. The Provisioner and blocks inside the blue box are classes or subclasses of Open Provision API.

Details

project.yml

This is a simple yaml file, describing participants and builders. Note that Open Provision API itself does not define the format of this file. Any developer can create his/her own file that describes participants and builders in a different format. The developer can even store such information in one URL as long as there is code (provision.py in the above sample diagram) that can load the information and convert such information to calls to Open Provision API.

provision.py

This python file is the sample application to interact with the Open Provision API. It also loads project.yml, parses command line options, instantiates classes/subclasses defined from Open Provision API and displays helpful messages to users. As mentioned previously, developers are encouraged to modify provision.py or write their own applications that fit their own requirements. It is also possible to completely utilize Open Provision API without any standalone applications. For example, if developers have their existing applications and would like to add provisioning capabilities for the NVIDIA FLARE system, they can add API calls to Open Provision API to generate required outputs.

Provisioner

This is the container class that owns all instances of Project, Workspace, Provision Context, Builders and Participants, as shown in the above diagram. A typical usage of this class is like the following:

provisioner = Provisioner(workspace_full_path, builders)

provisioner.provision(project)

Project

The Project class keeps information about participants. Therefore, information of any participant can be retrieved from the Project instance:

class Project(object):
   def __init__(self, name: str, description: str, participants: List[Participant]):
       self.name = name
       all_names = list()
       for p in participants:
           if p.name in all_names:
               raise ValueError(f"Unable to add a duplicate name {p.name} into this project.")
           else:
               all_names.append(p.name)
       self.description = description
       self.participants = participants

   def get_participants_by_type(self, type, first_only=True):
       found = list()
       for p in self.participants:
           if p.type == type:
               if first_only:
                   return p
               else:
                   found.append(p)
       return found

Participant

Each participant is one entity that communicates with other participants inside the NVIDIA FLARE system during runtime. Each participant has the following attributes: type, name, org, and props. The attribute props is a dictionary and stores additional information:

class Participant(object):
   def __init__(self, type: str, name: str, org: str, *args, **kwargs):
       self.type = type
       self.name = name
       self.org = org
       self.subject = name
       self.props = kwargs

The name of each participant must be unique. This is enforced in Project’s __init__ method. The type defines the behavior of this participant when it is alive in the NVIDIA FLARE system. For example, type = ‘server’ defines that the participant acts as a server. Three types are commonly used for a typical NVIDIA FLARE system: server, client, and admin. However, developers can freely add other types when needed, such as ‘gateway,’ ‘proxy,’ or ‘database.’ The builders can take such information into consideration so that they can generate relevant results based on the type attribute.

Builder

The builders in the above diagram are provided as a convenient way to generate commonly used zip files for a typical NVIDIA FLARE system. Developers are encouraged to add / modify or even remove those builders to fit their own requirements.

Each builder is responsible for taking the information from project, its own __init__ arguments, and provisioner to generate data. For example, the HEBuilder is responsible for generating tenseal context files for server and client, but not admin. Additionally, the context for the server does not include either public key or secret key while the context for clients include both. Its __init__ arguments consist of poly_modules_degree, coeff_mod_bit_sizes, scale_bits and scheme. With all of the information, HEBuilder can output context files correctly.

Provisioner calls each builder’s initialize method first during provisioning time in a loop. This allows builders to prepare information and to populate their instance variables. After calling each builder’s initialize method, the Provisioner calls each builder’s build method in another loop. This method is usually implemented to execute the actual build process (generating necessary files). At the end, the provisioner calls the finalize method of each builder in REVERSE ORDER in the third loop so all builders have a chance to wrap up their states. This comes from the convention that the earlier a builder’s initialize method is called, the later its finalize method should be called.

The iterations in each of the above three loops are always determined by the builders list, the second argument passed to Provisioner class. Therefore, different orders in the builders list affect the results.

For example, when one builder’s finalize method cleans up and removes the wip folder which is shared by all builders, builders being called after it will not be able to access the wip folder.

Note

The collaboration among all builders is the responsibility of Open Provision API developers.

Every builder has to subclass the Builder class and override one or more of these three methods:

class Builder(ABC):
   def initialize(self, ctx: dict):
       pass

   def build(self, project: Project, ctx: dict):
       pass

   def finalize(self, ctx: dict):
       pass

Workspace

Each builder can access four folders under provision workspace which is managed by Provisioner (see Provisioner’s first argument). Those folders are ‘wip’ (for working-in-progress), ‘kit_dir’ (a subfolder in ‘wip’), ‘state’ (used to persist information between different revisions) and ‘resources’ (for read-only / static information).

Provision Context

Provision context is created by Provisioner and can be read / written by all participants and builders. A builder might add a piece of information to it so that another builder can retrieve it. As a hypothetical example, developers might want to add a second homomorphic encryption builder to generate a different set of HE contexts based on certificates from CertBuilder and the context of the first HE builder. To achieve this, the developers can write certificates to provision context at CertBuilder and he context to provision context at HEBuilder. The information is automatically available to the second HE builder.

Open Provision API Case Studies

Before we start, please remember that the builders have three methods to be implemented optionally, initialize, build and finalize. The Provisioner calls initialize methods of all builders, then build methods of all builders. Both in the order of builders list. However, the finalize methods of all builders are called by Provisioner in REVERSE order. Please keep this in mind.

For example, in Case 2, the builders is a list and append method adds the WebPostDistributionBuilder to the end of the builder list. As mentioned above, the initialize and build methods are called in the order of the builder list while the finalize method is called in the reverse order. We can expect the finalize method of the WebPostDistributionBuilder is called before other builders’ finalize methods and before other builders’ build methods.

Case 1: generating additional files

The developers would like to add a configuration file about a database server to admin participants. The configuration is like this:

[database]
db_server = server name
db_port = port_number
user_name = admin's name

As this requires adding one file to every admin participant, the developer can write a DBBuilder as follows:

class DBConfigBuilder(Builder):
   def __init__(self, db_server, db_port):
       self.db_server = db_server
       self.db_port = db_port

   def build(self, project, ctx):
       for admin in project.get_participants_by_type("admin", first_only=False):
           dest_dir = self.get_kit_dir(admin, ctx)
           with open(os.path.join(dest_dir, "database.conf"), 'wt') as f:
               f.write("[database]\n")
               f.write(f"db_server = {self.db_server}\n")
               f.write(f"db_port = {self.db_port}\n")
               f.write(f"user_name = {admin.name}\n")

And in project.yml, add an entry in the builders section:

- path: byob.DBConfigBuilder
  args:
    db_server: example.com
    db_port: 5432

Case 2: enhancing an existing builder

The developer would like to push zip files of each generated folder, to a web server via a POST method. This can be done easily by implementing a new builder as follows (after pip install requests):

class WebPostDistributionBuilder(Builder):
   def __init__(self, url):
       self.url = url

   def build(self, project: Project, ctx: dict):
       wip_dir = self.get_wip_dir(ctx)
       dirs = [name for name in os.listdir(wip_dir) if os.path.isdir(os.path.join(wip_dir, name))]
       for dir in dirs:
           dest_zip_file = os.path.join(wip_dir, f"{dir}")
           shutil.make_archive(dest_zip_file, "zip", root_dir=os.path.join(wip_dir, dir), base_dir="startup")
           files = {"upload_file": open(dest_zip_file, "rb")}
           r = requests.post(self.url, files=files)

And just replace the existing one with the new builder under Builders in the project.yml:

- path: byob.WebPostDistributionBuilder
  args:
    url: https://example.com/nvflare/provision

For the above two cases, if developers opt to use Open Provision API directly instead of project.yml, they can do this (some code omitted for clarity):

from byob import WebPostDistributionBuilder
builders = list()
# Adding other builders
# ...

# Using our new WebPostDistributionBuilder builders.append(WebPostDistributionBuilder(url="https://example.com/nvflare/provision"))

# Instantiate Provisioner
provisioner = Provisioner(workspace_full_path, builders)

Case 3: adding both new builders and participants of new types

The developers would like to add participants of type = ‘gateway.’ In order to handle this type of participants, a new builder is needed to write gateway specific configuration. First, specify that in project.yml:

- name: gateway1
  type: gateway
  org: nvidia
  port: 8102

or in API style:

participants = list()
p = Participant(name="gateway1", type="gateway", org="nvidia", port=8102)
participants.append(p)

A new builder to write ‘gateway.conf’ can be implemented as follows (for reference):

class GWConfigBuilder(Builder):
  def build(self, project, ctx):
      for gw in project.get_participants_by_type("gateway", first_only=False):
          dest_dir = self.get_kit_dir(gw, ctx)
          with open(os.path.join(dest_dir, "gateway.conf"), 'wt') as f:
              port = gw.props.get("port")
              f.write("[gateway]\n")
              f.write(f"name = {gw.name}\n")
              f.write(f"port = {port}\n")

Case 4: adding a builder for enabling the creation of zip archives for the startup kits

DistributionBuilder was included in NVIDIA FLARE before version 2.2.1 but has been removed from the default builders. You can make this builder available and add it as a builder in project.yml if you want to zip the startup kits:

import os
import shutil
import subprocess

from nvflare.lighter.spec import Builder, Project
from nvflare.lighter.utils import generate_password

class DistributionBuilder(Builder):
    def __init__(self, zip_password=False):
        """Build the zip files for each folder.
        Creates the zip files containing the archives for each startup kit. It will add password protection if the
        argument (zip_password) is true.
        Args:
            zip_password: if true, will create zipped packages with passwords
        """
        self.zip_password = zip_password

    def build(self, project: Project, ctx: dict):
        """Create a zip for each individual folder.
        Note that if zip_password is True, the zip command will be used to encrypt zip files.  Users have to
        install this zip utility before provisioning.  In Ubuntu system, use this command to install zip utility:
        sudo apt-get install zip
        Args:
            project (Project): project instance
            ctx (dict): the provision context
        """
        wip_dir = self.get_wip_dir(ctx)
        dirs = [
            name
            for name in os.listdir(wip_dir)
            if os.path.isdir(os.path.join(wip_dir, name)) and "nvflare_" not in name
        ]
        for dir in dirs:
            dest_zip_file = os.path.join(wip_dir, f"{dir}")
            if self.zip_password:
                pw = generate_password()
                run_args = ["zip", "-rq", "-P", pw, dest_zip_file + ".zip", ".", "-i", "startup/*"]
                os.chdir(dest_zip_file)
                try:
                    subprocess.run(run_args)
                    print(f"Password {pw} on {dir}.zip")
                except FileNotFoundError:
                    raise RuntimeError("Unable to zip folders with password.  Maybe the zip utility is not installed.")
                finally:
                    os.chdir(os.path.join(dest_zip_file, ".."))
            else:
                shutil.make_archive(dest_zip_file, "zip", root_dir=os.path.join(wip_dir, dir), base_dir="startup")

If the above code is made available at nvflare.lighter.impl.workspace.DistributionBuilder, add the following to your project.yml at the bottom of the list of builders:

path: nvflare.lighter.impl.workspace.DistributionBuilder
args:
  zip_password: true

Takeaways for Custom Builders

From the cases shown previously, implementing your own Builders only requires the following steps:

  1. Subclass the Builder class

  2. Implement the required methods (initialize, build, finalize). Not all of them have to be implemented.

  3. The builder can locate the working-in-progress space from the return value of this method self.get_wip_dir(ctx). This space is shared by all builders.

  4. Builder writes participant-specific files to the kit directory which is the return value of self.get_kit_dir(participant, ctx)

  5. Builders have to coordinate with one another. For example, the WebPostDistributionBuilder generates zip files from the contents inside kit directories. That implies some other builders have to write those contents first.

Bundled builders

The following is the list of bundled builders included by default in the NVIDIA FLARE package. They are provided as a convenient tool. As mentioned previously, developers are encouraged to add / modify / remove builders based on their own requirements:

Current Docker and Kubernetes runtime launch preparation is handled after startup kits are created with nvflare deploy prepare.

workspace structure
└── example_project
    ├── prod_00
    │   ├── admin@nvidia.com
    │   │   ├── local
    │   │   ├── startup
    │   │   └── transfer
    │   ├── nvflare_compose
    │   ├── server1
    │   │   ├── local
    │   │   ├── startup
    │   │   └── transfer
    │   ├── site-1
    │   │   ├── local
    │   │   ├── startup
    │   │   └── transfer
    │   └── site-2
    │       ├── local
    │       ├── startup
    │       └── transfer
    ├── resources
    └── state

The prod_NN folders contain the provisioning results. The number, NN, increases every time the provision command runs successfully.

Project yaml file

This is the key file that describes the information which provisioning tool will be using to generate startup kits for server, clients and admins. If there is no project.yml in your current working directory, simply run provision without any option. It will ask you if you would like to have one sample copy of this file created.

(nvflare-venv) ~/workspace$ provision
No project.yml found in current folder.
Would you like to generate a sample project.yml file? (y/n)

Edit the project.yml configuration file to meet your project requirements:

  • “api_version” should be set to 3 or 4. Version 4 adds support for multi-study configuration (see Multi-Study Support)

  • “name” is used to identify this project.

  • “participants” describes the different parties in the FL system, distinguished by type. For all participants, “name” should be unique. org is required except for admin certificate provider entries, whose organization comes from the issued certificate. The “name” of the server should be in the format of a fully qualified domain name. It is possible to use a unique hostname rather than FQDN, with the IP mapped to the hostname by having it added to /etc/hosts:

    • Type “server” describes the FL server, with the “org”, “name”, “fed_learn_port”, “admin_port”, and “enable_byoc”:

      • “fed_learn_port” is the port number for communication between the FL server and FL clients

      • “admin_port” is the port number for communication between the FL server and FL administration client

    • Type “client” describes the FL clients, with one “org” and “name” for each client as well as “enable_byoc” settings.

    • Type “admin” describes the admin clients. For traditional static admin certificates, the name must be a unique email. For startup kits using an admin certificate provider, the name may be a unique kit name such as sso-admin-kit because the real admin identity comes from the short-lived certificate issued after login. Static admins must define org and a role of “project_admin”, “org_admin”, “lead” or “member”. Admin certificate provider entries omit org and role; those values come from the issued certificate.

  • “builders” contains all of the builders and the args to be passed into each. See the details in docstrings of the Bundled builders.

  • “studies” (optional, requires api_version: 4): defines named studies with per-study site enrollment and admin membership. See Multi-Study Support for the full schema and examples.

Admin certificate provider configuration

Use an admin certificate provider when admin users should obtain credentials from an external certificate provider instead of receiving long-lived private keys in their startup kits. Server and client startup kits are unchanged.

The built-in step_ca provider delegates OIDC login and short-lived certificate issuance to step-ca. FLARE only stores the provider configuration in the generated admin startup kit and then validates the returned certificate before using it. The admin machine must have the step CLI installed.

Example configuration:

participants:
  - name: static-admin@example.com
    type: admin
    org: nvidia
    role: project_admin

  - name: sso-admin-kit
    type: admin
    admin_cert_provider:
      provider: step_ca
      renewal_window: 43200
      provider_config:
        ca_url: https://step-ca.example.com
        provisioner: nvflare-admin-oidc
        cert_ttl: 24h
        command_timeout: 300

Only admin participants with admin_cert_provider receive provider-backed startup kits. The generated sso-admin-kit startup kit contains admin_cert_provider in fed_admin.json and omits static admin client.crt and client.key. Traditional admin participants still receive static admin certificate material unless external_cert: true is set. The admin client invokes the configured provider when the cached certificate is missing, invalid, expired, or close to expiry. Cached certificate material is stored under ~/.nvflare/admin_certificates and can be removed manually to force fresh credential acquisition. The returned certificate must chain to rootCA.pem, match its private key, contain a valid FLARE organization and admin role, and be valid for the current time. If cert_ttl is omitted, the built-in step_ca provider requests 24h. The renewal window defaults to 43,200 seconds (12 hours). FLARE reacquires credentials before signing when the certificate has no more than that much validity remaining. This reserves deployment time but does not guarantee when the scheduler starts a job; increase both the issuer certificate lifetime and renewal window when deployments may be delayed longer.

For optional certificate-derived study membership, see Certificate-Derived Study Membership and the step-ca study entitlement mapping example below.

The certificate provider must map authenticated IdP claims to one allowed (organization, role) pair. For example, an IdP role such as nvflare-demo-hospital-a-project_admin can map to organization hospital-a and role project_admin. Perform this mapping in the step-ca X.509 template (or in the IdP), using exact allowlisted values. Do not accept organization and role as independent user-controlled claims. If several allowed roles for the same organization are present, select the highest privilege; fail closed if the organization is ambiguous.

Custom certificate providers can be configured with provider: module:function. FLARE calls the function as provider(config=provider_config, root_ca_file=root_ca_file). It must return an nvflare.fuel.sec.admin_cert_provider.AdminCertFiles instance. The certificate and key paths must remain readable until FLARE copies them; providers that own a temporary directory should set the result’s temp_dir so FLARE can clean it up. FLARE derives expires_at from the certificate. FLARE performs the same certificate validation for custom providers as it does for step_ca.

step-ca study entitlement mapping

The example template below adds study URI SANs for a dedicated provisioner with one fixed organization and role. The issuer must chain to FLARE’s trusted root CA. Configure the provisioner to request openid and email scopes and your IdP to supply these claims in the signed, validated ID token, not only an access token:

{
  "email": "alice@example.com",
  "email_verified": true,
  "groups": ["nvflare-demo-example-lead"],
  "nvflare_studies": ["cancer-research"]
}

email_verified must be true; the required groups entry permits the fixed organization example and role lead. The resulting certificate has commonName=alice@example.com, organizationName=example, unstructuredName=lead, and this study SAN:

https://nvidia.com/nvflare/v1/project/demo/study/cancer-research

Alice gains membership in the existing cancer-research study; her role stays lead. An absent or empty nvflare_studies array adds no membership. See Certificate-Derived Study Membership for authorization rules and limits. There is no issuer-side study allowlist; deployments can add one if needed.

Keep group assignments and study entitlements administrator-controlled, not self-service profile fields. The template rejects CLI template data (.Insecure.User) and never derives identity or entitlements from CSR fields.

For a new deployment, customize the fixed values in step_ca_admin.tpl and configure the saved file as the OIDC provisioner’s options.x509.templateFile in ca.json, or use step ca provisioner update --x509-template for managed provisioners. projectURIPath is the percent-encoded project label described in Certificate-Derived Study Membership.

For an existing deployment, merge only the study-to-SAN logic, preserving your identity/role mapping rather than replacing it with this example’s fixed role.

{{- /*
Example for a dedicated provisioner with one organization and one FLARE role.
Customize the fixed values below; preserve existing identity/role mapping when
adding study SANs to another template. projectURIPath is a percent-encoded label,
not an authorization boundary. See the published provisioning guide for setup.
*/ -}}
{{- $projectURIPath := "demo" -}}
{{- $organization := "example" -}}
{{- $flareRole := "lead" -}}
{{- $requiredAdminGroup := "nvflare-demo-example-lead" -}}
{{- $studyURIBase := printf "https://nvidia.com/nvflare/v1/project/%s/study/" $projectURIPath -}}
{{- if not (kindIs "map" .Token) -}}
  {{- fail "a signed OIDC token is required" -}}
{{- end -}}
{{- $token := .Token -}}
{{- if .Insecure.User -}}
  {{- fail "user-supplied template data is not accepted" -}}
{{- end -}}
{{- $email := get $token "email" -}}
{{- if or (not (kindIs "string" $email)) (eq $email "") -}}
  {{- fail "the signed OIDC token must contain a non-empty email claim" -}}
{{- end -}}
{{- $emailVerified := get $token "email_verified" -}}
{{- if or (not (kindIs "bool" $emailVerified)) (not $emailVerified) -}}
  {{- fail "the signed OIDC token must contain email_verified=true" -}}
{{- end -}}
{{- $groups := get $token "groups" -}}
{{- if or (not (kindIs "slice" $groups)) (not (has $requiredAdminGroup $groups)) -}}
  {{- fail (printf "the signed OIDC token is missing required admin group %q" $requiredAdminGroup) -}}
{{- end -}}
{{- $hasStudyClaim := hasKey $token "nvflare_studies" -}}
{{- $sans := list (dict "type" "email" "value" $email) -}}
{{- if $hasStudyClaim -}}
  {{- $requestedStudies := get $token "nvflare_studies" -}}
  {{- if not (kindIs "slice" $requestedStudies) -}}
    {{- fail "nvflare_studies must be an array" -}}
  {{- end -}}
  {{- if gt (len $requestedStudies) 64 -}}
    {{- fail "nvflare_studies exceeds the 64-study limit" -}}
  {{- end -}}

  {{- $seen := dict -}}
  {{- range $study := $requestedStudies -}}
    {{- if not (kindIs "string" $study) -}}
      {{- fail "each nvflare_studies entry must be a string" -}}
    {{- end -}}
    {{- if eq $study "default" -}}
      {{- fail "the reserved default study must not appear in nvflare_studies" -}}
    {{- end -}}
    {{- if not (regexMatch "^[a-z0-9]([a-z0-9_-]{0,61}[a-z0-9])?$" $study) -}}
      {{- fail (printf "invalid study name %q in nvflare_studies" $study) -}}
    {{- end -}}
    {{- if hasKey $seen $study -}}
      {{- fail (printf "duplicate study %q in nvflare_studies" $study) -}}
    {{- end -}}
    {{- $_ := set $seen $study true -}}
    {{- $sans = append $sans (dict "type" "uri" "value" (printf "%s%s" $studyURIBase $study)) -}}
  {{- end -}}
{{- end -}}
{
  "subject": {
    "commonName": {{ toJson $email }},
    "organization": {{ toJson $organization }},
    "extraNames": [
      {
        "type": "1.2.840.113549.1.9.2",
        "value": {{ toJson $flareRole }}
      }
    ]
  },
  "sans": {{ toJson $sans }},
{{- if typeIs "*rsa.PublicKey" .Insecure.CR.PublicKey }}
  "keyUsage": ["keyEncipherment", "digitalSignature"],
{{- else }}
  "keyUsage": ["digitalSignature"],
{{- end }}
  "extKeyUsage": ["clientAuth"]
}

Externally issued workload certificates

Use external_cert: true for externally enrolled server/client/relay endpoints and external_job_ca: true for an externally supplied server job-signing CA. The options are independent and leave other credentials unchanged. Both apply only to centralized nvflare provision; distributed provisioning rejects them. Deployment tooling supplies the selected credentials. Provisioning continues to issue any remaining credentials using its configured CA key. When all credentials are externally managed, Public-root-only provisioning distributes the enterprise root certificate and startup configuration.

participants:
  - name: server1
    type: server
    org: example_org
    external_cert: true
    external_job_ca: true  # optional; server only

  - name: site-1
    type: client
    org: example_org
    external_cert: true

With external_cert, kits retain configuration and rootCA.pem but omit the endpoint pair. Install startup/server.crt and startup/server.key on servers, or startup/client.crt and startup/client.key on clients and relays, before running start.sh. On servers and clients, configure ssl_cert and ssl_private_key to use alternative endpoint paths, including absolute paths. Relay endpoint files and all listener files are located beside the root certificate.

Use a matching RSA-2048 key (required by endpoint message encryption) and a PEM chain ordered leaf first, then intermediates, trusted by rootCA.pem. The leaf CN must match the configured participant identity; put server hostnames in SANs. Every relay, and each client with listening_host, also needs a server.crt/server.key pair for its listener, with the participant’s identity as CN and listener hostnames in SANs. Mount credentials read-only into FLARE, writable only by enrollment tooling.

Certificate and key replacement require an endpoint restart. Stop the affected server or client, install a matching key and certificate chain, then restart it before its certificate expires. The key may be reused or replaced. Keep the participant identity and trusted root unchanged; peers accept the new credentials through their normal authentication checks and exchange certificates again after reconnecting. On a rejected or timed-out heartbeat, a client freshly authenticates the server and re-registers if the server’s key no longer verifies its session token. This does not depend on a direct server connection. Recovery attempts are bounded; failed attempts leave existing credentials intact and retry on later heartbeats. Recovery can wait for the existing heartbeat timeout before checking the server. Plan for job interruption during the restart; job survival is not guaranteed. FLARE does not watch files, schedule renewal, or reload credentials into running processes. Certificate replacement does not revoke the old certificate or terminate other established sessions, which can continue beyond certificate expiry. For a compromised key, block access and terminate affected sessions before installing a new key.

Use end-to-end mTLS. For listening_host, explicitly set connection_security: mtls in the project YAML; a secure scheme alone does not change the default. gRPC requires both role-specific credential paths when an endpoint listens and connects: server_cert/server_key for listeners and client_cert/client_key for outgoing connections.

This option supports standard mTLS startup kits. Provisioning rejects external_cert for signed Confidential Computing and HE kits: their integrity manifest covers the original certificate bytes. Such kits must be reprovisioned and signed when credentials change.

Externally supplied server job CA

With external_job_ca, deployment tooling must generate the key locally at the server, obtain an approved CA certificate, and install startup/job_ca.crt and startup/job_ca.key before deploying secure jobs. Provisioning omits this pair, does not import the external key into its state, and leaves installed material intact.

Deployment prerequisite: FLARE requires an approved job-signing CA whose certificate chain permits issuance of job certificates. It need not be issued by the CA used for endpoint enrollment. Both paths must reach the configured rootCA.pem. Ordinary endpoint enrollment permission does not authorize CA issuance. Do not loosen existing IT path-length constraints; obtain approval for the hierarchy and for the server holding the signing key before deployment.

The certificate file contains the job CA first, followed by its issuing intermediates. The job CA requires a matching RSA or EC key, CA:TRUE/pathlen:0, keyCertSign, and the issuer-signed URI SAN https://nvidia.com/nvflare/v1/ca/job. Any EKU restriction in the chain must permit both client and server authentication. Ancestors must permit the extra CA level: an issuing CA with pathlen:0 cannot issue this job CA.

FLARE validates the chain and requires more than one hour of remaining validity before job issuance. Missing or invalid material blocks secure job deployment; there is no endpoint-key fallback. Jobs use locally issued credentials even when the external issuer is unavailable, and cannot outlive the chain. The job CA stays fixed: this option adds no renewal, rotation, or live replacement.

Keep enrollment tokens and issuer configuration in a parent-only secret mount, not job-visible startup, local, custom, or workspace directories. Startup files other than *.key may be forwarded into jobs. Processes sharing an OS identity are not a filesystem security boundary. Kubernetes startup Secrets exclude HE context files. Content-integrity checks remain required; the job CA is not a CC/HE content-signing key.

Public-root-only provisioning

Public-root-only provisioning receives the root CA certificate, which contains its public key. The root CA private key stays with your enterprise PKI. Internal enterprise CAs are supported, regardless of browser or public-internet trust.

Provisioning distributes this certificate and startup configuration while deployment tooling supplies the credentials. Add the following argument to CertBuilder in project.yml:

builders:
  - path: nvflare.lighter.impl.cert.CertBuilder
    args:
      public_root_cert: rootCA.pem

Set public_root_cert to your enterprise root certificate file. Configure the credential source for each participant:

Participant

Required configuration

Server

external_cert: true and external_job_ca: true

Client or relay

external_cert: true (also covers listener credentials)

Admin

Either admin_cert_provider or external_cert: true; never both. For file-based admins, IT installs startup/client.crt and startup/client.key before login. The certificate CN must match the email-shaped admin name. Omit org and role; the cert supplies them.

Provisioning checks these settings and reports the participant name and required setting for any incomplete configuration. The admin provider obtains credentials on the admin machine when needed. Certificates from any external CA can be used when they satisfy FLARE’s identity, key, and chain requirements.

The root path is relative to project.yml (the current directory for Python API callers). It must contain exactly one currently valid, self-signed PEM CA certificate with critical CA BasicConstraints and keyCertSign usage. Its path_length must permit at least the subordinate job CA: use a value of one or greater, or leave the constraint unrestricted. Supply a certificate-only PEM file. Provisioning writes it as startup/rootCA.pem in every kit. Reprovisioning creates new kits; deployment tooling must install the external credentials in each deployed kit.

Use the complete example below with your own root and admin provider settings:

api_version: 3
name: demo
description: Public-root-only provisioning with externally managed credentials

participants:
  - name: server
    type: server
    org: org
    external_cert: true
    external_job_ca: true
  - name: site-1
    type: client
    org: org
    external_cert: true
  - name: admin-sso
    type: admin
    admin_cert_provider:
      provider: step_ca
      provider_config:
        ca_url: https://ca.example.com
        provisioner: oidc
  - name: automation@example.com
    type: admin
    external_cert: true

builders:
  - path: nvflare.lighter.impl.workspace.WorkspaceBuilder
  - path: nvflare.lighter.impl.static_file.StaticFileBuilder
  - path: nvflare.lighter.impl.cert.CertBuilder
    args:
      public_root_cert: rootCA.pem
  - path: nvflare.lighter.impl.signature.SignatureBuilder

Run nvflare provision -p project.yml -w workspace and deliver the kits through your authenticated deployment process. Install endpoint and listener files as described in Externally issued workload certificates, and the server’s job CA as described in Externally supplied server job CA. The server continues to sign job certificates locally. At runtime, FLARE verifies certificate chains and participant identities using the installed certificate verifier and its supported certificate profiles.

Use centralized provisioning with exactly one CertBuilder. For CC/HE content signing, hierarchical edge provisioning, or the Python API’s supplied-root-plus-key workflow, use the legacy provisioning mode. The enterprise CA controls the root certificate’s validity. Configure an external job CA for every server, including when enable_job_ca is false.

Default project.yml file

The following is an example of the default project.yml file.

api_version: 3
name: example_project
description: NVIDIA FLARE sample project yaml file

participants:
  # Change the name of the server (server1) to the Fully Qualified Domain Name
  # (FQDN) of the server, for example: server1.example.com.
  # Ensure that the FQDN is correctly mapped in the /etc/hosts file.
  - name: server1
    type: server
    org: nvidia
    fed_learn_port: 8002
  - name: site-1
    type: client
    org: nvidia
    # Specifying listening_host will enable the creation of one pair of
    # certificate/private key for this client, allowing the client to function
    # as a server for 3rd-party integration.
    # The value must be a hostname that the external trainer can reach via the network.
    # listening_host: site-1-lh
  - name: site-2
    type: client
    org: nvidia
  - name: admin@nvidia.com
    type: admin
    org: nvidia
    role: project_admin
  - name: org-admin@nvidia.com
    type: admin
    org: nvidia
    role: org_admin
  - name: lead@nvidia.com
    type: admin
    org: nvidia
    role: lead

# The same methods in all builders are called in their order defined in builders section
builders:
  - path: nvflare.lighter.impl.workspace.WorkspaceBuilder
    args:
      template_file:
        - master_template.yml
        - aws_template.yml
        - azure_template.yml
  - path: nvflare.lighter.impl.static_file.StaticFileBuilder
    args:
      # config_folder can be set to inform NVIDIA FLARE where to get configuration
      config_folder: config

      # scheme for communication driver (currently supporting the default, http, only).
      # scheme: http

      # app_validator is used to verify if uploaded app has proper structures
      # if not set, no app_validator is included in fed_server.json
      # app_validator: PATH_TO_YOUR_OWN_APP_VALIDATOR

      # download_job_url is set to http://download.server.com/ as default in fed_server.json.  You can override this
      # to different url.
      # download_job_url: http://download.server.com/
  - path: nvflare.lighter.impl.cert.CertBuilder
    # root_valid_days applies only when this workspace creates its root CA for the first time.
    # The default is 360 days. For example, use the following to create a 10-year root:
    # args:
    #   root_valid_days: 3650
  - path: nvflare.lighter.impl.signature.SignatureBuilder

Attention

Please make sure that the FL server ports are accessible by all participating sites.

Provision command

Running nvflare provision -h shows all available options.

usage: nvflare provision [-h] [-p PROJECT_FILE] [-g] [-e] [-w WORKSPACE]
                         [-c CUSTOM_FOLDER] [--add_user ADD_USER]
                         [--add_client ADD_CLIENT] [-s] [--force] [--schema]

options:
-h, --help                                               show this help message and exit
-p PROJECT_FILE, --project_file PROJECT_FILE                 file to describe FL project
-g, --generate                                             generate a sample project.yml and exit
-e, --gen_edge                                             generate a sample edge project.yml and exit
-w WORKSPACE, --workspace WORKSPACE                          directory used by provision
-c CUSTOM_FOLDER, --custom_folder CUSTOM_FOLDER    additional folder to load python code
--add_user ADD_USER                                             yaml file for added user
--add_client ADD_CLIENT                                       yaml file for added client
-s, --gen_scripts                                            generate helper scripts such as start_all.sh
--force                                                      skip Y/N confirmation prompts
--schema                                                     print command schema as JSON and exit

Running provision without any options and without a project.yml file in the current working directory will prompt to copy a default project.yml to the current working directory.

JSON mode

nvflare provision --format json returns only a JSON envelope on stdout. When the command generates a sample project file, the JSON data section includes structured guidance such as:

  • message

  • next_step

  • suggested_command

This keeps JSON output machine-readable while still carrying follow-up instructions.

Root CA validity

By default, centralized provisioning creates a self-signed project root CA that is valid for 360 days by default. To select a different initial validity, set the positive integer root_valid_days for CertBuilder in project.yml:

builders:
  - path: nvflare.lighter.impl.cert.CertBuilder
    args:
      root_valid_days: 3650

This setting only applies when a workspace creates its root. Later runs reuse the root in the workspace’s state directory and report its actual NotBefore and NotAfter values. A configured validity that does not match the existing root fails clearly. Participant certificates keep their normal 360-day validity unless the root expires sooner.

Changing an established root requires a separate multi-root rollover; root_valid_days never extends or replaces it.

Using an enterprise public root

To distribute an enterprise root certificate without its private key, configure public_root_cert in the CertBuilder arguments in project.yml. Every server, client and relay must use external credentials, the server must use an external job CA, and every admin must select either a certificate provider or external_cert: true for files installed by IT. Provisioning fails if any required credential still needs local issuance. The command is unchanged: nvflare provision -p project.yml -w workspace. See Public-root-only provisioning for the configuration and deployment steps.

Job CA

By default, provisioning also creates a job-signing intermediate CA, job_ca.crt / job_ca.key, in the server startup kit only. The server uses it to issue a short-lived certificate to every job process (see Per-Job Certificates); in secure mode jobs cannot run without it. It is on by default and can be turned off:

builders:
  - path: nvflare.lighter.impl.cert.CertBuilder
    args:
      enable_job_ca: false

Like the participant certificates, the job CA is kept in the workspace’s state directory and reused on later provisioning runs; an expired one is regenerated. Running nvflare provision again on a workspace created before this feature adds the job CA to the server kit without changing any other certificate.

With external_job_ca: true, deployment tooling supplies this pair instead; provisioning does not create or renew it. Public-root-only provisioning requires this setting. See Externally supplied server job CA for its certificate profile.

Certificate Identity Overrides

For mTLS deployments, each CellNet endpoint is authenticated against the peer certificate common name (CN). By default, the expected certificate identity is derived from the participant name or FQCN. If a participant intentionally uses a certificate CN that differs from its FLARE site name, set auth_identity in project.yml before provisioning.

For example, if the FLARE site is named site-1 but its certificate CN is server.example.com:

participants:
  - name: site-1
    type: client
    org: nvidia
    auth_identity: server.example.com

Provisioning uses this value to generate the corresponding startup-kit configuration, including peer identity mappings needed by the server and by job cells. A job cell such as site-1.<job_id> still authenticates with the parent site’s configured certificate identity.

Important

Endpoint-to-CN binding is enforced when an mTLS transport exposes the authenticated peer CN. Some active-side gRPC connections do not expose the peer CN to the Python driver, so NVFlare accepts those active connections and relies on passive-side endpoint validation plus the normal application-layer authentication checks.

Admin console cells use per-session endpoint names and authenticate the admin user by certificate/user identity on the admin listener. Keep admin application-layer authentication configured and protected.

auth_identity is loaded when a FLARE process starts. After rotating site certificates or changing certificate CNs, regenerate the startup kits as needed and restart the affected FLARE processes so the in-memory identity resolver uses the new certificate identity.

Warning

Do not edit startup/fed_client.json or startup/fed_server.json by hand in a signed startup kit. If startup/signature.json is present, the startup configuration is covered by the signature and manual edits invalidate that signature. Change project.yml and re-run provisioning so the startup configuration and signature are generated together.

Dynamic Provisioning

The options --add_user and --add_client allow for adding to an existing project. Both of these commands take a yaml file to define the additional participant to provision.

Sample user.yaml for --add_user:

name: new_user@nvidia.com
org: nvidia
role: project_admin

Sample client.yaml for --add_client:

name: new-site
org: nvidia
components:
  resource_manager:    # This id is reserved by system.  Do not change it.
    path: nvflare.app_common.resource_managers.gpu_resource_manager.GPUResourceManager
    args:
      num_of_gpus: 0
      mem_per_gpu_in_GiB: 0
  resource_consumer:    # This id is reserved by system.  Do not change it.
    path: nvflare.app_common.resource_consumers.gpu_resource_consumer.GPUResourceConsumer
    args:

After running nvflare provision with --add_user or --add_client followed by the name of the yaml file (nvflare.lighter.provision will look for the yaml file in the current directory), the new user or client will be included in the prod_NN folder.

To permanently include users or clients, please update the project.yml.

Note

To use multi-study features, set api_version: 4 in your project.yml and add a studies: section. See Multi-Study Support for details.

Provisioning Output

NVFLARE 2.2 supports the concept of “Site Config” to enable Org Admin to manage their own policies for resource management (resources.json), data privacy (privacy.json), as well as security control (authorization.json). The content of the Site Config is managed by the Org Admin for their own sites.

To help Org Admin easily understand and manage their Site Config, the provisioning system will create the Site Config with default policy files.

Furthermore, to help Org Admin install and operate their NVFLARE sites more easily, the Provision system will create a Readme.txt file that describes how to manage their sites.

The output from the Provision process is a package (called Site Installation Kit). The Installation Kit is a folder of this structure:

Installation Kit
    startup
        Certs, private key, fed_[server|client].json, shell scripts
    local
        resources.json - used by main and job process (on client)
        privacy.json - used by job process only
        authorization.json - used by main process only
    Readme.txt: describe how to use scripts to install startup and site; how to manage content in the "site" folder

Changes to Startup Kit Content

  1. Move authorization.json from “startup” to “site”.

  2. For client sites, remove resource manager and resource consumer configuration from fed_client.json in “startup”, and put them into resources.json in “site”.

  3. For server sites, remove job scheduler configuration from fed_server.json in “startup”, and put them into resources.json in “site”.

During the runtime, the workspace used by each participant will be updated, resulting in the following workspace structure:

Workspace Structure

{WSROOT}
    Startup
        Fed_server|client.json
        Site cert, site private key, root certificate, and site
        Start.sh
        Xxx.sh
        yyy.sh
    local
        Resources.json.default
        Authorization.json.default
        Privacy.json.sample
        Log.config.default
        Resources.json
        Authorization.json
        Privacy.json
        Log.config
        custom/
            local_code.xyz
    Audit.txt
    Log.txt
    1234567 (run)
            Log.txt
            job_meta.json
            App_xxx
                Fl_app.txt
                Config
                    Config_fed_client.json
                    …
                Custom
                        xyz.py
    234562 (run)
            Log.txt
            job_meta.json
            App_xxx
                Fl_app.txt
                Config
                Custom