With this POC, you can create specific rules to alert about commands run by the user. To do this, you must first enable Audit logging to capture and log execve system calls so the Wazuh agent can read these logs.
Configure your environment as follows to test the POC.
systemctl status auditd.serviceto check that the Linux Auditing System is installed and running on your CentOS 8 endpoint.
/var/ossec/etc/ossec.confin your CentOS 8 endpoint is configured for the agent to read the
audit.logfile. This configuration is included by default.
<localfile> <log_format>audit</log_format> <location>/var/log/audit/audit.log</location> </localfile>
Get your current euid in the CentOS 8 endpoint. This is needed to monitor the actions of your user. Root user monitoring is not recommended for this test, as it can be quite noisy.
# echo $EUID
Create the rules for your user at
/etc/audit/rules.d/wazuh.rules. Make sure to replace
<your_user_id>with your current
-a exit,always -F euid=your_user_id -F arch=b32 -S execve -k audit-wazuh-c -a exit,always -F euid=your_user_id -F arch=b64 -S execve -k audit-wazuh-c
Optionally, you can delete old rules.
# auditctl -D
Load rules from file.
# auditctl -R /etc/audit/rules.d/wazuh.rules
Log into the CentOS 8 endpoint as the monitored user.
Execute a ping to www.google.com