Requirements
nerves_hub_link2.9.0 or later. Restoring the key file from the TPM needs 2.10.1 or later.- The
tpmlibrary,~> 0.2.0, in your firmware. - A TPM that already holds the device’s private key and certificate. NervesHubLink reads them. It does not provision the TPM.
- A Nerves system with the kernel module for your TPM. The configurator loads it with
modprobe. - The CA that signed the device certificates, registered with your organization.
Enable it
1
Add the dependency
2
Configure the host
tpm is in the project, nerves_key is not, and you have not set configurator, NervesHubLink uses NervesHubLink.Configurator.TPM. If your project has both libraries, select it explicitly:3
Set the TPM options, if the defaults do not fit
4
Register the CA and make the devices known
Register the CA that signed the device certificates. See Register a certificate authority.Then add each device before it connects, or give the CA a just-in-time provisioning profile. The device identifier is the common name in the certificate.
What the configurator does
At startup the configurator:- Runs
modprobewithprobe_name. It raises ifmodprobefails. - Checks that the TPM responds. It tries up to six times, 300 ms apart, then raises
TPM Unavailable. - Sets the
sslkeyoption to the TPM private key for the file atkey_pathjoined withkey_name. - If that file does not exist, reads the NV index at
key_addressand writes its contents to the file. - Sets the
sslcertoption to the certificate read from the NV index atcertificate_address. The certificate must be stored there as PEM. - Sets
cacertsto the CA certificates NervesHubLink trusts, unless you setcacertsorcacertfileyourself. See Connecting devices.
key or cert you set in ssl yourself is kept, and the matching step is skipped.
A failure in any of these steps raises when NervesHubLink starts.
Options
Set these under the:tpm key.

