I've been reading the LwM2M spec (version 1.1.1) and have played around with Eclipse Leshan to test things out myself. I've managed to bootstrap a client using a BS server, and then register to the device management server and send data there successfully. But so far I've done all of this using the "nosec" security mode, configuring a dedicated endpoint for the client on my BS server and using the same name for the endpoint in the client.
I tried using pre-shared key (PSK) with an identity instead on the BS server, and it works as long as I set the endpoint client name to null
on the client. I've understood the parameter is optional and can be left out if it's included in the identity already, but that the bootstrap server MUST check the endpoint client name against the given identity if both are given, and return "bad request" if they don't match.
I've also understood that endpoint client name should be unique for each client (per server).
Doesn't this mean that the bootstrap server must know in advance all the clients that are going to request bootstrapping from it? If each client can send a unique endpoint client name and the server must check it if one is given, it sounds like the server must have a list of allowed names and/or identities for the bootstrapping to succeed.
I had previously planned to have a bootstrap server that could serve a single customer's all devices – thousands of them – as long as they each asked for a config using a customer-specific identity and key, without having to know how many of those devices there would be or their device-specific identities. I could then provide each of those devices the same LwM2M Server config and just collect a list of devices that have bootstrapped (and registered).
But now it seems such an approach is impossible, or then I've badly misunderstood something about the bootstrap interface. Which is it?
Update:
I think what I should have asked to be better understood is: "Do all devices need to be pre-provisioned to the bootstrap server before they can start the bootstrap interface?"
I've come to believe it's indeed needed if the server fulfills the LwM2M standard also from the security point of view; the BS server needs to identify each client, and as each client should have a unique key (or certificate), the server can only recognize clients whose keys it has been pre-provisioned with.