Question 120
Following lab verification, document the preventive or persistence-oriented procedure for: A web service moved to `/srv/custom-web` encounters SELinux denials because content copied from a home directory carries the wrong label. Which practice is most suitable?
Explanation
Correct Answer
Persist custom path mapping in SELinux fcontext policy, not one-off `chcon` changes. This guards against recurrence of: DAC permissions can be correct while SELinux type enforcement still denies access. Confirm the lab's final state by: `ls -Z /srv/custom-web/index.html` reports the expected content type and the service reads the file.
Incorrect Answers
Set a restrictive umask in service startup or trusted shell policy for secret handling. That control is best suited to a separate scenario: A shell session creates files with default modes exposing group-readable secrets to unrelated users. It is not the best safeguard for the current mechanism: DAC permissions can be correct while SELinux type enforcement still denies access.
Audit filesystem permissions on configuration files after each deployment. That control is best suited to a separate scenario: A user accidentally gives write permission to everyone on an application's configuration file. It is not the best safeguard for the current mechanism: DAC permissions can be correct while SELinux type enforcement still denies access.
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: DAC permissions can be correct while SELinux type enforcement still denies access.