Configure Luna hardware security module access
Connect Hyperledger Besu to a Luna hardware security module (HSM) to use the node's keys stored on the device.
The Luna HSM plugin can only be used to store the node's public and private key file. The plugin cannot be used to store transaction signing keys.
Prerequisites
- The Luna client software and Luna HSM must be configured before configuring Hyperledger Besu access.
Set the environment variables that specify the location of the Luna HSM library and Chrystoki.conf
file if not located in the default locations. For example:
export LD_LIBRARY_PATH=/home/myuser/luna-hsm/elab/jsp/lib/
export ChrystokiConfigurationPath=/home/myuser/luna-hsm/
- The nodes private and public keys have been created in the HSM.
Configure Hyperledger Besu
Copy the Luna client's
LunaProvider.jar
file into theplugins
directory.noteThe
plugins
directory is located in thepegasys-plus-<release>
directory when installed from a packaged binary.Create a plain text file containing the password to access the HSM. Ensure the password is located on the first line of the file.
Start Hyperledger Besu:
besu --security-module=luna-hsm \
--plugin-luna-hsm-private-key-alias="node1PrivateKey" \
--plugin-luna-hsm-public-key-alias="node1PublicKey" \
--plugin-luna-hsm-slot=0 \
--plugin-luna-hsm-password-file=./password.txt \
--metrics-enabled --metrics-category=JVM,RPC,LUNA_HSMThe command line:
- Enables the Luna HSM plugin using
--security-module=luna-hsm
. - Specifies the alias of the private key in the HSM using
--plugin-luna-hsm-private-key-alias
. - Specifies the alias of the public key in the HSM using
--plugin-luna-hsm-public-key-alias
. - Specifies the slot in which the keys are stored using
--plugin-luna-hsm-slot
. - Specifies the location of the password file created earlier using
--plugin-luna-hsm-password-file
. - Enables monitoring using
--metrics-enabled
. - Specifies the metrics categories to track using
--metrics-category
.
noteThe `LUNA_HSM` metric's category allows you to monitor the Hyperledger Besu and Luna HSM
connection. The category is not enabled by default.- Enables the Luna HSM plugin using