Fix missing valid properties in validation of FIM and YARA agent options (#8707)

This commit is contained in:
Martin Angers 2022-11-14 15:50:41 -05:00 committed by GitHub
parent 928b4be2c2
commit 54bb5448a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1 @@
* Fixed validation of agent options where valid options were being rejected (such as `exclude_paths`).

View File

@ -1323,6 +1323,23 @@ spec:
`,
wantErr: `422 Validation Failed: host_percentage must be > 0 to enable the host status webhook`,
},
{
desc: "config with FIM values for agent options (#8699)",
spec: `
apiVersion: v1
kind: config
spec:
agent_options:
config:
file_paths:
ssh:
- /home/%/.ssh/authorized_keys
exclude_paths:
ssh:
- /home/ubuntu/.ssh/authorized_keys
`,
wantOutput: `[+] applied fleet config`,
},
}
// NOTE: Integrations required fields are not tested (Jira/Zendesk) because
// they require a complex setup to mock the client that would communicate

View File

@ -81,10 +81,17 @@ type osqueryAgentOptions struct {
FilePaths map[string][]string `json:"file_paths"`
FileAccesses []string `json:"file_accesses"`
// Documentation for the following 2 fields is "hidden" in osquery's FIM page:
// https://osquery.readthedocs.io/en/stable/deployment/file-integrity-monitoring/
FilePathsQuery map[string][]string `json:"file_paths_query"`
ExcludePaths map[string][]string `json:"exclude_paths"`
YARA struct {
Signatures map[string][]string `json:"signatures"`
FilePaths map[string][]string `json:"file_paths"`
// Documentation for signature_urls is "hidden" in osquery's YARA page:
// https://osquery.readthedocs.io/en/stable/deployment/yara/#retrieving-yara-rules-at-runtime
SignatureURLs []string `json:"signature_urls"`
} `json:"yara"`
PrometheusTargets struct {