Courseiva
System SecurityhardMultiple ChoiceObjective-mapped

LPIC-2 System Security Practice Question

A financial institution uses a Linux server with a custom application that runs as the 'appuser' and writes logs to /var/log/app/. The security team recently detected that the application is vulnerable to a local privilege escalation via log injection. To mitigate, they decide to implement mandatory access control (MAC) using SELinux. The system is CentOS 7 with SELinux in enforcing mode. The current context of /var/log/app is 'unconfined_u:object_r:var_log_t:s0'. The application should only be allowed to write to logs in that directory, and no other processes should modify them. Which SELinux policy change should be made?

⚠ Common exam trap

It's easy for candidates to assume the existing 'var_log_t' type is sufficient and that 'chcon' or 'audit2allow' can fix the issue, but they miss the need for a dedicated type and domain transition to enforce exclusive write access for the application.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Create a custom SELinux policy module that defines a new type for the log directory and transitions for the application domain.

The application needs a dedicated SELinux type for its log directory and a domain transition so that only the 'appuser' process running in the 'app_t' domain can write to that directory. Creating a custom policy module with a new type (e.g., 'app_log_t') and a file transition rule ensures that other processes (even those with 'var_log_t' access) cannot modify the logs, meeting the strict confinement requirement.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use 'semanage permissive -a app_t' to put the application domain in permissive mode.

    Why it's wrong here

    This would allow all actions for that domain, including potential exploits.

  • Create a custom SELinux policy module that defines a new type for the log directory and transitions for the application domain.

    Why this is correct

    A targeted policy ensures least privilege and persistent enforcement.

  • Run 'chcon -t var_log_t /var/log/app' to set the correct context.

    Why it's wrong here

    The context is already var_log_t; chcon is not persistent and doesn't confine the application.

  • Use 'audit2allow' to create a local policy module based on current denials.

    Why it's wrong here

    This might allow too much and is reactive rather than proactive.

Quick reference

Access Control Model Comparison

ModelAcronymWho Controls Access?Best For
Discretionary Access ControlDACResource ownerSmall teams, file shares
Mandatory Access ControlMACSystem / security labelsClassified govt / military
Role-Based Access ControlRBACAdministrator (via roles)Enterprise environments
Attribute-Based Access ControlABACPolicy engine (user + resource attributes)Fine-grained, dynamic policies
Rule-Based Access ControlRuBACSystem rules / ACLsFirewall rules, network ACLs

About these practice questions

This LPIC-2 question is part of Courseiva's 507-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LPIC-2 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-2 exam.