mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 16:39:01 +00:00
Fix no such table errors for mdm & munki_info in vanilla osquery macOS hosts (#6170)
* Add discovery queries for mdm and munki_info * Add changes file * Amend discovery table tests
This commit is contained in:
parent
f3212f4537
commit
515454e47f
3 changed files with 22 additions and 4 deletions
1
changes/5992-fix-no-such-table-errors-mdm-munki
Normal file
1
changes/5992-fix-no-such-table-errors-mdm-munki
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Fixed `no such table` errors for `mdm` and `munki_info` for vanilla osquery macOS hosts.
|
||||
|
|
@ -413,6 +413,8 @@ func verifyDiscovery(t *testing.T, queries, discovery map[string]string) {
|
|||
discoveryUsed := map[string]struct{}{
|
||||
hostDetailQueryPrefix + "google_chrome_profiles": {},
|
||||
hostDetailQueryPrefix + "orbit_info": {},
|
||||
hostDetailQueryPrefix + "mdm": {},
|
||||
hostDetailQueryPrefix + "munki_info": {},
|
||||
}
|
||||
for name := range queries {
|
||||
require.NotEmpty(t, discovery[name])
|
||||
|
|
|
|||
|
|
@ -48,10 +48,12 @@ func (q *DetailQuery) RunsForPlatform(platform string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// detailQueries defines the detail queries that should be run on the host, as
|
||||
// hostDetailQueries defines the detail queries that should be run on the host, as
|
||||
// well as how the results of those queries should be ingested into the
|
||||
// fleet.Host data model. This map should not be modified at runtime.
|
||||
var detailQueries = map[string]DetailQuery{
|
||||
// fleet.Host data model (via IngestFunc).
|
||||
//
|
||||
// This map should not be modified at runtime.
|
||||
var hostDetailQueries = map[string]DetailQuery{
|
||||
"network_interface": {
|
||||
Query: `select ia.address, id.mac, id.interface
|
||||
from interface_details id join interface_addresses ia
|
||||
|
|
@ -306,15 +308,25 @@ FROM logical_drives WHERE file_system = 'NTFS' LIMIT 1;`,
|
|||
Platforms: []string{"windows"},
|
||||
IngestFunc: ingestDiskSpace,
|
||||
},
|
||||
}
|
||||
|
||||
// extraDetailQueries defines extra detail queries that should be run on the host, as
|
||||
// well as how the results of those queries should be ingested into the hosts related tables
|
||||
// (via DirectIngestFunc).
|
||||
//
|
||||
// This map should not be modified at runtime.
|
||||
var extraDetailQueries = map[string]DetailQuery{
|
||||
"mdm": {
|
||||
Query: `select enrolled, server_url, installed_from_dep from mdm;`,
|
||||
DirectIngestFunc: directIngestMDM,
|
||||
Platforms: []string{"darwin"},
|
||||
Discovery: discoveryTable("mdm"),
|
||||
},
|
||||
"munki_info": {
|
||||
Query: `select version from munki_info;`,
|
||||
DirectIngestFunc: directIngestMunkiInfo,
|
||||
Platforms: []string{"darwin"},
|
||||
Discovery: discoveryTable("munki_info"),
|
||||
},
|
||||
"google_chrome_profiles": {
|
||||
Query: `SELECT email FROM google_chrome_profiles WHERE NOT ephemeral AND email <> ''`,
|
||||
|
|
@ -851,7 +863,10 @@ func directIngestMunkiInfo(ctx context.Context, logger log.Logger, host *fleet.H
|
|||
|
||||
func GetDetailQueries(ac *fleet.AppConfig, fleetConfig config.FleetConfig) map[string]DetailQuery {
|
||||
generatedMap := make(map[string]DetailQuery)
|
||||
for key, query := range detailQueries {
|
||||
for key, query := range hostDetailQueries {
|
||||
generatedMap[key] = query
|
||||
}
|
||||
for key, query := range extraDetailQueries {
|
||||
generatedMap[key] = query
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue