John Speno
02/08/2024, 8:50 PMdetail_query_overrides
configured in Fleet but I believe the network_interface_windows
I've set is not being sent to node. In fact, I see that the default value for that query is being sent instead. Any ideas?John Speno
02/08/2024, 8:50 PMfeatures:
enable_host_users: false
enable_software_inventory: false
detail_query_overrides:
disk_encryption_linux: null
disk_encryption_windows: null
disk_space_unix: null
disk_space_windows: null
network_interface_unix: "SELECT ia.address, id.mac FROM interface_addresses ia JOIN interface_details id ON id.interface = ia.interface JOIN routes r ON r.interface = ia.interface WHERE r.type = 'gateway' ORDER BY r.netmask asc, r.metric ASC, inet_aton(ia.address) IS NOT NULL DESC LIMIT 1"
network_interface_windows: "SELECT ia.address, id.mac FROM interface_addresses ia JOIN interface_details id ON id.interface = ia.interface JOIN routes r ON r.interface = ia.address WHERE r.destination = '0.0.0.0' AND r.netmask = 0 AND r.type = 'remote' AND (inet_aton(ia.address) is not null) LIMIT 1"
disk_encryption_darwin: null
John Speno
02/08/2024, 8:51 PMJohn Speno
02/08/2024, 9:02 PMdistributed/read
endpoint:
"fleet_detail_query_network_interface_windows": "SELECT\n ia.address,\n id.mac\nFROM\n interface_addresses ia\n JOIN interface_details id ON id.interface = ia.interface\n\t-- On Unix ia.interface is the name of the interface,\n\t-- whereas on Windows ia.interface is the IP of the interface.\n JOIN routes r ON r.interface = ia.address\nWHERE\n\t-- Destination 0.0.0.0/0 is the default route on route tables.\n r.destination = '0.0.0.0' AND r.netmask = 0\n\t-- Type of route is \"gateway\" for Unix, \"remote\" for Windows.\n AND r.type = 'remote'\n\t-- We are only interested on private IPs (some devices have their Public IP as Primary IP too).\n AND (\n\t\t-- Private IPv4 addresses.\n\t\tinet_aton(ia.address) IS NOT NULL AND (\n\t\t\tsplit(ia.address, '.', 0) = '10'\n\t\t\tOR (split(ia.address, '.', 0) = '172' AND (CAST(split(ia.address, '.', 1) AS INTEGER) \u0026 0xf0) = 16)\n\t\t\tOR (split(ia.address, '.', 0) = '192' AND split(ia.address, '.', 1) = '168')\n\t\t)\n\t\t-- Private IPv6 addresses start with 'fc' or 'fd'.\n\t\tOR (inet_aton(ia.address) IS NULL AND regex_match(lower(ia.address), '^f[cd][0-9a-f][0-9a-f]:[0-9a-f:]+', 0) IS NOT NULL)\n\t)\nORDER BY\n r.metric ASC,\n\t-- Prefer IPv4 addresses over IPv6 addresses if their route have the same metric.\n\tinet_aton(ia.address) IS NOT NULL DESC\nLIMIT 1;",
Kathy Satterlee
02/08/2024, 9:47 PMKathy Satterlee
02/08/2024, 9:49 PMfeatures:
enable_host_users: false
enable_software_inventory: false
detail_query_overrides:
disk_encryption_linux: null
disk_encryption_windows: null
disk_space_unix: null
disk_space_windows: null
network_interface_unix: SELECT ia.address, id.mac FROM interface_addresses ia JOIN interface_details id ON id.interface = ia.interface JOIN routes r ON r.interface = ia.interface WHERE r.type = 'gateway' ORDER BY r.netmask asc, r.metric ASC, inet_aton(ia.address) IS NOT NULL DESC LIMIT 1
network_interface_windows: SELECT ia.address, id.mac FROM interface_addresses ia JOIN interface_details id ON id.interface = ia.interface JOIN routes r ON r.interface = ia.address WHERE r.destination = '0.0.0.0' AND r.netmask = 0 AND r.type = 'remote' AND (inet_aton(ia.address) is not null) LIMIT 1
disk_encryption_darwin: null
Kathy Satterlee
02/08/2024, 9:50 PMJohn Speno
02/08/2024, 9:52 PMJohn Speno
02/08/2024, 10:03 PMJohn Speno
02/08/2024, 10:08 PMfleet_detail_query_network_interface_unix
does match what's in the config file and that is being sent to Linux platform nodes. /me shakes fist at WindowsKathy Satterlee
02/08/2024, 10:26 PMKathy Satterlee
02/08/2024, 10:31 PMfleetctl get config
, what comes back?John Speno
02/08/2024, 10:33 PMnetwork_interface_windows
line is missing!Kathy Satterlee
02/09/2024, 7:23 PMKathy Satterlee
02/09/2024, 7:23 PMJohn Speno
02/09/2024, 7:29 PMKathy Satterlee
02/09/2024, 7:33 PMfleetctl
and Fleet line up?Kathy Satterlee
02/09/2024, 7:34 PMJohn Speno
02/09/2024, 7:34 PMKathy Satterlee
02/09/2024, 7:35 PMJohn Speno
02/09/2024, 7:36 PMKathy Satterlee
02/09/2024, 7:36 PMJohn Speno
02/09/2024, 7:37 PM>>> import yaml
>>> f = open("fleet.yml", mode="r")
>>> y = yaml.safe_load(f)
>>> y['features']['detail_query_overrides']['network_interface_windows']
"SELECT ia.address, id.mac FROM interface_addresses ia JOIN interface_details id ON id.interface = ia.interface JOIN routes r ON r.interface = ia.address WHERE r.destination = '0.0.0.0' AND r.netmask = 0 AND r.type = 'remote' AND (inet_aton(ia.address) is not null) LIMIT 1"
John Speno
02/09/2024, 7:39 PMJohn Speno
02/09/2024, 8:01 PMnetwork_interface_unix
just now didn't show up using fleetctl get config
- in fact, it looks like a previous version of the config from a while back.John Speno
02/09/2024, 8:05 PMMySQL [opens]> select json_value->>'$.features' from app_config_json\G
*************************** 1. row ***************************
json_value->>'$.features': {"enable_host_users": false, "detail_query_overrides": {"disk_space_unix": null, "disk_space_windows": null, "disk_encryption_linux": null, "network_interface_unix": "SELECT ia.address, id.mac FROM interface_addresses ia JOIN interface_details id ON id.interface = ia.interface JOIN routes r ON r.interface = ia.interface WHERE r.destination = '0.0.0.0' AND r.netmask = 0 AND r.type = 'gateway' ORDER BY r.metric ASC, inet_aton(ia.address) IS NOT NULL DESC LIMIT 1", "disk_encryption_windows": null}, "enable_software_inventory": false}
John Speno
02/09/2024, 8:05 PMnetwork_interface_unix
and the config for windows is missing. 🕵️♂️Kathy Satterlee
02/09/2024, 8:18 PMJohn Speno
02/09/2024, 8:19 PM2023-07-10 07:23:07
John Speno
02/09/2024, 8:22 PMJohn Speno
02/09/2024, 8:35 PMfleetctl get config
now shows the correct and expected results. Now to see if those queries will be used by Fleet as intended. cheersJohn Speno
02/09/2024, 8:40 PMprimary_ip
is shrinking.giphy
02/09/2024, 8:40 PMJohn Speno
02/09/2024, 10:05 PMfleetctl apply
would have been the correct route?John Speno
02/09/2024, 10:08 PMUsing config file: /usr/local/fleet/conf/fleet.yml
is what I saw in the log.Kathy Satterlee
02/09/2024, 10:35 PMKathy Satterlee
02/09/2024, 10:36 PMfleetctl
or through the APIJohn Speno
02/10/2024, 12:04 AM