Add new database tables and queries for host operating systems (#6920)

This commit is contained in:
gillespi314
2022-08-09 13:34:41 -05:00
committed by GitHub
parent 3a1c4e45f2
commit 3a88afaf98
15 changed files with 1003 additions and 71 deletions
+23
View File
@@ -682,6 +682,22 @@ func (a *agent) batteries() []map[string]string {
return result
}
func (a *agent) osUnixLike() []map[string]string {
return []map[string]string{
{
"build": "18G3020",
"major": "10",
"minor": "14",
"name": "Mac OS X",
"patch": "6",
"platform": "darwin",
"arch": "x86_64",
"version": "10.14.6",
"kernel_version": "21.4.0",
},
}
}
func (a *agent) processQuery(name, query string) (handled bool, results []map[string]string, status *fleet.OsqueryStatus) {
const (
hostPolicyQueryPrefix = "fleet_policy_query_"
@@ -723,6 +739,13 @@ func (a *agent) processQuery(name, query string) (handled bool, results []map[st
results = a.batteries()
}
return true, results, &ss
case name == hostDetailQueryPrefix+"os_unix_like":
ss := fleet.OsqueryStatus(rand.Intn(2))
if ss == fleet.StatusOK {
results = a.osUnixLike()
}
return true, results, &ss
default:
// Look for results in the template file.
if t := a.templates.Lookup(name); t == nil {