Lab Activity

SELinux Basics

Learn fundamental SELinux concepts, modes, and commands to manage security contexts and enforce access controls.

About This Lab

SELinux (Security-Enhanced Linux) is a mandatory access control (MAC) system implemented in the Linux kernel. It provides an additional layer of security by enforcing strict access controls, making your system more resistant to malicious activity. This hands-on lab introduces SELinux basics on Red Hat Enterprise Linux (RHEL) 9, helping beginners understand and interact with SELinux effectively.

What You Will Learn

This lab will guide you through:

  • Understanding the purpose and importance of SELinux in system security.
  • Checking the current SELinux status and mode using commands like  sestatus  and  getenforce.
  • Switching between  EnforcingPermissive, and  Disabled  modes temporarily using the  setenforce  command.
  • Exploring SELinux configuration files to set the default enforcement mode on system boot.
  • Applying SELinux contexts to files and directories, and resetting them to defaults.

Why Learn SELinux?

As security threats evolve, a robust access control mechanism is critical to protect sensitive systems. SELinux plays a crucial role in hardening Linux systems, especially in environments like enterprise servers, cloud platforms, and containerized applications. Understanding SELinux is a key skill for any Linux administrator or cybersecurity professional.

Who Should Take This Lab?

This lab is ideal for:

  • Beginners new to Linux system administration.
  • Cybersecurity professionals looking to enhance their understanding of SELinux.
  • Students preparing for certifications like Red Hat Certified System Administrator (RHCSA).

Prerequisites

Before starting this lab, ensure you have:

  • Access to a Linux system running RHEL 9 or a compatible distribution.
  • Basic knowledge of Linux command-line operations.
  • Sudo or root privileges for executing commands.

Lab Highlights

Key steps you will perform in this lab include:

  1. Verifying SELinux installation and status.
  2. Temporarily changing SELinux enforcement modes.
  3. Editing SELinux configuration files to set default modes.
  4. Resetting SELinux contexts using commands like  restorecon.

This lab provides a foundational understanding, preparing you for more advanced SELinux operations.

© RHCSA GURU, Singapore