Open jda opened 2 years ago
Thinking three files per device: desired config, current config, and authkeylog (most recent key wins)
General config could be CLI flags or config file. Use CLI flags for first rev.
Need one config file containing mac addresses that we are willing to service. One per line. Read at program startup only (worry about SIGHUP or whatever later).
Need config flag for the inform URL we provide to devices when they try to adopt.
Need config flag for dir to hold per-device configs.
Dump json that device sends us in inform to ${MACADDR}.json
in config dir.
Every time we adopt or rotate device creds, append cred to ${MACADDR}.auth
Device handling should be stateless. Request comes in. Check if mac is in list of mac we want to service.
If it is, check for ${MACADDR}.auth
file. If it exists, read it and try to decrypt based on keys in file. If no .auth
file, generate new key, add it to file, and reply with adopt/set config to new key.
Sort config support for basic adoption flow, including: