Question 400
After completing this practical task on a local virtualization classroom: A protected lab directory was copied from `/home` and now has inappropriate user-home SELinux contexts under `/var/www/html`. Which operational safeguard helps keep the result correct and safe?
Explanation
Correct Answer
Reapply default file contexts after moving service data into standard labeled directories. This guards against recurrence of: Copy operations may preserve source SELinux labels that are incorrect for the destination path. Confirm the lab's final state by: `ls -Z` shows suitable web content labels and Apache accesses the files under the approved mode.
Incorrect Answers
Test positive and negative access after SSH authorization changes. That control is best suited to a separate scenario: A server's `sshd` service is enabled but remote login fails because host key authentication was never established for the test user. It is not the best safeguard for the current mechanism: Copy operations may preserve source SELinux labels that are incorrect for the destination path.
Check existing assignments before modifying SELinux port labels. That control is best suited to a separate scenario: An existing TCP port is assigned to the wrong SELinux port type and `semanage port -a` fails because the port already exists. It is not the best safeguard for the current mechanism: Copy operations may preserve source SELinux labels that are incorrect for the destination path.
Use persistent Boolean changes only when justified and test their effects after restart. That control is best suited to a separate scenario: A trainee enables an SELinux Boolean with `setsebool` but loses the change after restart. It is not the best safeguard for the current mechanism: Copy operations may preserve source SELinux labels that are incorrect for the destination path.