I'm running script on agent to collect data about vulnerabilities and generating an alert for each vulnerability. But, for some reason, dont see any alerts generated.
/var/ossec/etc/shared/default/agent.conf:
<agent_config os="Windows">
<wodle name="syscollector">
<disabled>no</disabled>
<interval>1h</interval>
<os>yes</os>
<packages>yes</packages>
<hotfixes>yes</hotfixes>
</wodle>
</agent_config>
<agent_config os="Linux">
<wodle name="command">
<disabled>no</disabled>
<tag>trivy-image-scan</tag>
<command>/bin/bash /var/ossec/etc/shared/trivy.sh</command>
<interval>1m</interval>
<ignore_output>no</ignore_output>
<run_on_start>yes</run_on_start>
<skip_verification>yes</skip_verification>
<timeout>0</timeout>
</wodle>
<wodle name="syscollector">
<disabled>no</disabled>
<interval>1h</interval>
<os>yes</os>
<packages>yes</packages>
<hotfixes>yes</hotfixes>
</wodle>
</agent_config>
/var/trivy.sh:
#!/bin/bash
vulnsJson=$(trivy image httpd --format json --severity HIGH,CRITICAL -q --server
http://192.168.1.202:4954 | jq -c '.Results[] | .Vulnerabilities')
for row in $(echo "${vulnsJson}" | jq -r '.[] | @base64'); do
_jq() {
echo ${row} | base64 --decode | jq -r ${1}
}
echo $(_jq '.')
done
Script runs utility to collect vulnerabilities from 'httpd' image and transfers it to wazuh manager by 'echo'. Example of output:
{ "VulnerabilityID": "CVE-2023-31484", "PkgID": "perl...@5.36.0-7", "PkgName": "perl-base", "InstalledVersion": "5.36.0-7", "Status": "affected", "Layer": { "DiffID": "sha256:a2d7501dfb3541f3d736125cdfd748618194f60cbb5c63f4de67a92530899628" }, "SeveritySource": "nvd", "PrimaryURL": "
https://avd.aquasec.com/nvd/cve-2023-31484", "DataSource": { "ID": "debian", "Name": "Debian Security Tracker", "URL": "
https://salsa.debian.org/security-tracker-team/security-tracker" }, "Title": "CPAN.pm before 2.35 does not verify TLS certificates when downloading distributions over HTTPS", "Description": "CPAN.pm before 2.35 does not verify TLS certificates when downloading distributions over HTTPS.", "Severity": "HIGH", "CweIDs": [ "CWE-295" ], "CVSS": { "nvd": { "V3Vector": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "V3Score": 8.1 }, "redhat": { "V3Vector": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N", "V3Score": 7.4 } }, "References": [ "
http://www.openwall.com/lists/oss-security/2023/04/29/1", "
http://www.openwall.com/lists/oss-security/2023/05/03/3", "
http://www.openwall.com/lists/oss-security/2023/05/03/5", "
http://www.openwall.com/lists/oss-security/2023/05/07/2", "
https://access.redhat.com/security/cve/CVE-2023-31484", "
https://blog.hackeriet.no/perl-http-tiny-insecure-tls-default-affects-cpan-modules/", "
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-31484", "
https://github.com/andk/cpanpm/commit/9c98370287f4e709924aee7c58ef21c85289a7f0 (2.35-TRIAL)", "
https://github.com/andk/cpanpm/pull/175", "
https://lists.fedoraproject.org/archives/list/package-...@lists.fedoraproject.org/message/BM6UW55CNFUTNGD5ZRKGUKKKFDJGMFHL/", "
https://lists.fedoraproject.org/archives/list/package-...@lists.fedoraproject.org/message/LEGCEOKFJVBJ2QQ6S2H4NAEWTUERC7SB/", "
https://metacpan.org/dist/CPAN/changes", "
https://nvd.nist.gov/vuln/detail/CVE-2023-31484", "
https://ubuntu.com/security/notices/USN-6112-1", "
https://ubuntu.com/security/notices/USN-6112-2", "
https://www.cve.org/CVERecord?id=CVE-2023-31484", "
https://www.openwall.com/lists/oss-security/2023/04/18/14" ], "PublishedDate": "2023-04-29T00:15:00Z", "LastModifiedDate": "2023-08-02T15:28:00Z" }
Manager correctly parsing it, checked with 'wazuh-logtest':
