- Lab
- A Cloud Guru
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.
Path 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]
What's a lab?
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.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.