@cryptotaxi247 / netdata-1 / commits / 34db6c358

blacklist registry machine GUIDs that have been shipped with distribution packages for IoT

Costa Tsaousis (ktsaou) committed Aug 31, 2016 at 08:20 UTC 34db6c358d3118eedbe5d2d0292197f9a61186f6
1 file changed +17
src/registry.c
+17
@@ -1227,6 +1227,21 @@ int registry_request_switch_json(struct web_client *w, char *person_guid, char *
1227 // ----------------------------------------------------------------------------
1228 // REGISTRY THIS MACHINE UNIQUE ID
1229
1230 +static inline int is_machine_guid_blacklisted(const char *guid) {
1231 + // these are machine GUIDs that have been included in distribution packages.
1232 + // we blacklist them here, so that the next version of netdata will generate
1233 + // new ones.
1234 +
1235 + if(!strcmp(guid, "8a795b0c-2311-11e6-8563-000c295076a6")
1236 + || !strcmp(guid, "4aed1458-1c3e-11e6-a53f-000c290fc8f5")
1237 + ) {
1238 + error("Blacklisted machine GUID '%s' found.", guid);
1239 + return 1;
1240 + }
1241 +
1242 + return 0;
1243 +}
1244 +
1245 char *registry_get_this_machine_guid(void) {
1246 if(likely(registry.machine_guid[0]))
1247 return registry.machine_guid;
@@ -1245,6 +1260,8 @@ char *registry_get_this_machine_guid(void) {
1260
1261 registry.machine_guid[0] = '\0';
1262 }
1263 + else if(is_machine_guid_blacklisted(registry.machine_guid))
1264 + registry.machine_guid[0] = '\0';
1265 }
1266 close(fd);
1267 }