Question 160
After completing this practical task on a local virtualization classroom: A temporary `chcon` label change makes a lab web file work, but `restorecon` later reverts it and the outage returns. Which operational safeguard helps keep the result correct and safe?
Explanation
Correct Answer
Use policy-backed fcontext mappings for nonstandard service directories. This guards against recurrence of: `chcon` changes an inode label temporarily without updating the default file context database. Confirm the lab's final state by: `matchpathcon` and `ls -Z` agree after relabeling and a reboot.
Incorrect Answers
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: `chcon` changes an inode label temporarily without updating the default file context database.
Provision and rotate private keys under managed mode and ownership controls. That control is best suited to a separate scenario: A private SSH key is world-readable, causing security risk and sometimes authentication refusal. It is not the best safeguard for the current mechanism: `chcon` changes an inode label temporarily without updating the default file context database.
Check runtime and configured SELinux modes after policy changes. That control is best suited to a separate scenario: A training VM must boot with SELinux enforcing but `/etc/selinux/config` is set to permissive. It is not the best safeguard for the current mechanism: `chcon` changes an inode label temporarily without updating the default file context database.