{"comment":{"url":"https://api.github.com/repos/fanf/ldap-inventory/comments/10913484","html_url":"https://github.com/fanf/ldap-inventory/commit/6d4586c276f8a37de632d2194d32fb25388b9a3a#commitcomment-10913484","id":10913484,"user":{"login":"peckpeck","id":7976666,"avatar_url":"https://avatars.githubusercontent.com/u/7976666?v=3","gravatar_id":"","url":"https://api.github.com/users/peckpeck","html_url":"https://github.com/peckpeck","followers_url":"https://api.github.com/users/peckpeck/followers","following_url":"https://api.github.com/users/peckpeck/following{/other_user}","gists_url":"https://api.github.com/users/peckpeck/gists{/gist_id}","starred_url":"https://api.github.com/users/peckpeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peckpeck/subscriptions","organizations_url":"https://api.github.com/users/peckpeck/orgs","repos_url":"https://api.github.com/users/peckpeck/repos","events_url":"https://api.github.com/users/peckpeck/events{/privacy}","received_events_url":"https://api.github.com/users/peckpeck/received_events","type":"User","site_admin":false},"position":135,"line":135,"path":"inventory-api/src/main/scala/com/normation/inventory/services/provisionning/CheckInventoryDigest.scala","commit_id":"6d4586c276f8a37de632d2194d32fb25388b9a3a","created_at":"2015-04-27T11:08:39Z","updated_at":"2015-04-27T11:08:39Z","body":"Algorithm:\r\n\r\nStore in DB the fact that the node has already sent us a signature.\r\n\r\n* For a new node (first inventory)\r\n * if it has no signature -> if we are in strict mode reject otherwise treat as before\r\n * if it has a signature validate with the key from inventory file then treat as before\r\n\r\n* For a pending node (next inventories)\r\n * if it has no signature -> if we are in strict mode reject otherwise treat as before\r\n * if it has a signature \r\n    * if in strict mode validate with the key from DB then treat like accepted node\r\n    * else treat as first inventory\r\n\r\n* For an accepted node\r\n * if we have a signature flag in DB\r\n    * if there is no signature -> reject \r\n    * if there is a signature\r\n      * validate signature with the DB key -> reject or accept\r\n      * if the key has changed, update it from inventory file\r\n * if it has no signature flag in DB \r\n    * if there is no signature \r\n      * if we are in strict mode -> reject\r\n      * else accept\r\n    * if there is a signature set the signature flag and start over\r\n\r\n\r\nMigration from pre signature: if there is no signature, we still accept node updates, and new node inventories. But as soon as a node sends a signed inventory, we use the known key to verify it and refuse any unsigned or badly signed inventories.\r\n\r\nNormal mode: if this mode is set, everything badly signed is rejected, and everything signed with an unknown key is accepted.\r\n\r\nStrict mode: if the strict mode is set, everything not signed is rejected. And everything signed with an unknown key is rejected except the first inventory. \r\n\r\nMigration from normal mode to strict mode should happen only after every node has a signature flag. \r\n\r\nWe validate the signature using the last known key, so key change can be handled by signing the new key with the old one.\r\n"}}