I am trying to preauthorize a device onto the mender dashboard.
I am referring to the below article:
For this I have done the following:
- Used the mender keygen-client to generate a set of public and private key for the device
- Used the public key to hit the mender API that puts the particular device into pre-authorisation state.
The device does come up in the mender dashboard as preauthorized.
What I am trying now is to make the device go from pre-auth state to accepted state for which I have copied the private key (generated from the keygen-client tool) into /data/mender/mender-agent.pem file.
After a restart of the mender client service, insted of making the device go into accepted state a new device request comes on the dashboard (in pending state). So now I have one device entry in preauthorized state and a new entry in pending state.
I had read in the article mentioned above that by default mender considers the MAC ID of the device as the unique identity parameter.
There is a file : mender-device-identity in /etc/mender/identity, it is a script and when I run that it gives the MAC ID of the device as output. I tried modifying the script to output either the serial number, MAC ID or device ID but each time the device was never going into accepted state.
Can someone help me in identifying where I am going wrong with this? I am looking out for a logical flow on how to make the device go to accepted state from pre-authorized state.