Authenticate SuperNodes#

Flower has built-in support for authenticated SuperNodes that you can use to verify the identities of each SuperNode connecting to a SuperLink. Flower node authentication works similar to how GitHub SSH authentication works:

  • SuperLink (server) stores a list of known (client) node public keys

  • Using ECDH, both SuperNode and SuperLink independently derive a shared secret

  • Shared secret is used to compute the HMAC value of the message sent from SuperNode to SuperLink as a token

  • SuperLink verifies the token

We recommend you to check out the complete code example demonstrating federated learning with Flower in an authenticated setting.

Note

This guide covers a preview feature that might change in future versions of Flower.

Note

For increased security, node authentication can only be used when encrypted connections (SSL/TLS) are enabled.

Enable node authentication in SuperNode#

Similar to the long-running Flower server (SuperLink), you can easily enable node authentication in the long-running Flower client (SuperNode). Use the following terminal command to start an authenticated SuperNode:

flower-client-app client:app
    --root-certificates certificates/ca.crt
    --server 127.0.0.1:9092
    --authentication-keys ./keys/client_credentials ./keys/client_credentials.pub

The --authentication-keys flag expects two arguments: a path to the node’s private key file and a path to the node’s public key file. For development purposes, you can generate a private and public key pair using ssh-keygen -t ecdsa -b 384.

Security notice#

The system’s security relies on the credentials of the SuperLink and each SuperNode. Therefore, it is imperative to safeguard and safely store the credentials to avoid security risks such as Public Key Infrastructure (PKI) impersonation attacks. The node authentication mechanism also involves human interaction, so please ensure that all of the communication is done in a secure manner, using trusted communication methods.

Conclusion#

You should now have learned how to start a long-running Flower server (SuperLink) and client (SuperNode) with node authentication enabled. You should also know the significance of the private key and store it safely to minimize security risks.