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.
Check our documentation to learn more about the Linux auditd system.
Configure your environment as follows to test the PoC.
Run the following command to check that the Linux Auditing System is installed and running on your Ubuntu 20 endpoint.
# systemctl status auditd.service
If auditd is not installed, you can install it with the following command:
# apt-get install -y auditd
/var/ossec/etc/ossec.confin your Ubuntu 20 endpoint is configured for the agent to read the
<localfile> <log_format>audit</log_format> <location>/var/log/audit/audit.log</location> </localfile>
Restart the Wazuh agent to apply the changes.
# systemctl restart wazuh-agent
Get your current euid in the Ubuntu 20 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 Ubuntu 20 endpoint as the monitored user.
Execute a ping to www.google.com