Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon

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.

Google Cloud Platform icon

Path Info

Clock icon Intermediate
Clock icon 1h 0m
Clock icon Mar 06, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Log System Calls of a Process -

    Get Process ID

    ps aux | grep sysCalls
    sudo auditctl -a always,exit -S all -F pid=[PID] -k [your key]
  2. 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]
  3. Challenge

    Log Open Files by cloud_user

    sudo auditctl -a always,exit -S openat -F auid=[UID] -k [your key]
  4. 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 output

    sudo 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


    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]

    Find the log entries in the log files with the key we've used

    sudo ausearch -k [your key]

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

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.

Start learning by doing today

View Plans