- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud

Design Custom Logging for the Listed Events
This lab is related to logs. We need to create a custom logging solution to monitor for a set of specific system calls of a process listed in the lab specifications. All of this should be logged under `/log/var` and the name of the file is arbitrary. We need to monitor and log all attempts to write a given file (also provided in the lab specifications). We also need to monitor and log all attempts by a user to access a domain.

Lab Info
Table of Contents
-
Challenge
Log System Calls of a Process - sysCalls.py
Get Process ID
ps aux | grep sysCalls
sudo auditctl -a always,exit -S all -F pid=[PID] -k [your key]
-
Challenge
Log Attempts to Access a File - /home/cloud_user/test_file.txt
sudo auditctl -a always,exit -F path=/home/cloud_user/test_file.txt -F perm=wa -k [your key]
-
Challenge
Log Open Files by cloud_user
sudo auditctl -a always,exit -S openat -F auid=[UID] -k [your key]
-
Challenge
Make Sure the Rules Will Survive a Reboot
Get the path of the
auditd systemd
file - it will be at the top of the outputsudo systemctl cat auditd.service
sudo cp /usr/lib/systemd/system/auditd.service /etc/systemd/system/auditd.service
sudo vim /etc/systemd/system/auditd.service
Comment out
ExecStartPost=-/sbin/augenrules --load
Uncomment
ExecStartPost=-/sbin/auditctl -R /etc/audit/audit.rules
ESC :wq ENTER
Make the rules permanent
sudo vim /etc/audit/audit.rules
-a always,exit -S all -F pid=[PID] -k [your key] -a always,exit -F path=/home/cloud_user/test_file.txt -F perm=wa -k [your key] -a always,exit -S openat -F auid=[UID] -k [your key]
ESC :wq ENTER
Find the log entries in the log files with the key we've used
sudo ausearch -k [your key]
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.