Rotate Between_3 SELinux Modes

30 minutes
  • 3 Learning Objectives

About this Hands-on Lab

The goal of this lab is to change between the three SELinux modes: enforcing, permissive, and disabled. You will begin with the enforcing mode being active first, and then you will need to switch to permissive mode. After that, you will switch to disabled mode and then back to enforcing mode again. When rotating between modes, you can do a rotation of modes for the current session or a permanent mode change. An example of a permanent change would be when you go into a configuration file and you write permissive instead of enforcing or instead of permissive you write disabled. The goal is to set SELinux to permissive mode both for persistent reboot and for the session without a system reboot. After that, set the mode to disabled for both the persistent reboot and for the session with a system reboot. Lastly, change back to enforcing mode for both the reboot and the session.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Change SELinux Status from Enforcing to Permissive
  1. Open the configuration file for SELinux.
    1. In the file, delete SELINUX=enforcing and write SELINUX=permissive.
    2. Save and exit the file by pressing Escape followed by :wq!.
    3. Press Enter.
    4. Reload the configuration file in permissive mode.
Change SELinux Status from Permissive to Disabled
  1. Open the configuration file for SELinux.
  2. In the file, delete SELINUX=permissive and write SELINUX=disabled.
  3. Save and exit the file by pressing Escape followed by :wq!.
  4. Press Enter.
  5. Reboot SELinux.
Change SELinux Status from Disabled to Enforcing
  1. Open the configuration file for SELinux.
  2. In the file, delete SELINUX=disabled and write SELINUX=enforcing.
  3. Save and exit the file by pressing Escape followed by :wq!.
  4. Press Enter.
  5. Reboot SELinux.

Additional Resources

The initial SSH port is 61613 and that is the port you will use to initially connect to server via SSH.

SELinux has 3 modes of operation: enforcing, permissive and disabled. In enforcing mode, it will enforce all the rules and all the policies and it will perform denial. In permissive mode, it will generate log files and log all the potential denials, but it will not deny anything. If you set it to disabled mode, it will be disabled and be exactly nothing. Keep in mind that it is possible to rotate between permissive and enforcing modes while the system is up and running. If you wish to set it to disabled mode, you will be required to reboot the system. You are required to rotate between 3 states of SELinux: from enforcing to permissive, from permissive to disabled, and then from disabled back to enforcing.

What are Hands-on Labs

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.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?