This document describes how an EVE device registers with a Controller on first boot. It complies with the official "Device API" available here.
An EVE device, on boot, first determines if it already is registered, then, if it is not, runs the registration process.
On boot, the device looks in /config/
partition to determine if it has registered:
- If no files
device.cert.pem
anddevice.key.pem
exist, device has not registered, begin registration process in the next section. - If files
device.cert.pem
anddevice.key.pem
exist and fileself-register-pending
exists, registration has potentially stalled mid-stream, continue registration process in the next section. - If no file
self-register-pending
exists, and filesdevice.cert.perm
anddevice.key.pem
exist, device has registered, exit registration process.
- Device reads its configuration from
/config/
partition, which contain the following files:server
- contents are the FQDN to the Controller for this Deviceonboard.cert.pem
andonboard.key.pem
- the onboarding public certificate and private key, respectivelyroot-certificate.pem
- the certificate of the CA that signed the Controller's certificate
- Device constructs all requests to
https://<contents_of_server_file>/<endpoint>
, for example, if contents ofserver
areapi.zededa.com:885
, then theping
endpoint is athttps://api.zededa.com:885/api/v1/edgedevice/ping
- Device creates a file in
/config/
partition namedself-register-pending
, with no contents, as a transaction lock file that registration is in process - Device generate a unique device key and certificate and saves them to persistent location. As of this writing, it is in the
/config/
partition asdevice.cert.pem
anddevice.key.pem
. In the future, it may be in a tpm or other hardware key/certificate generation and storage mechanism. - Device sends a
POST
request to theregister
endpoint, using the onboarding certificate for mTLS authentication, per the API, with body contents of aZRegistrerMsg
, including the device serial and device certificate in the message - Once registration is accepted, Device removes from
/config/
partition fileself-register-pending
If registration fails, the device continues to retry to register. Since the controller might not yet have pre-registered the device's onboarding certificate or serial, retries provide it with the ability to eventually succeed.