From Fedora Project Wiki

No edit summary
No edit summary
Line 1: Line 1:
{{QA/Testcase_policycoreutils_semanage
{{QA/Test_Case
|description=This test case tests semanage basic functionalities (context addition/removal, listing).
|description=This test case tests semanage basic functionalities (context addition/removal, listing).
|setup=Ensure that {{package|policycoreutils}} package is installed.
|setup=Ensure that {{package|policycoreutils}} package is installed.

Revision as of 14:14, 1 August 2016

Description

This test case tests semanage basic functionalities (context addition/removal, listing).

Setup

Ensure that policycoreutils package is installed.

How to test

  1. Create test file touch /tmp/test
  2. Check test file context ls -Z /tmp/test. Result should be
    unconfined_u:object_r:user_tmp_t:s0 /tmp/test
  1. Add new context for the test file semanage fcontext -a -t user_home_t "/tmp/test"
  2. List local customisations semanage fcontext -l -C
    /tmp/test    all files    system_u:object_r:user_home_t:s0
  1. Apply new context restorecon /tmp/test
  2. Check that the context has changed ls -Z /tmp/test
    unconfined_u:object_r:user_home_t:s0 /tmp/test
  1. Remove custom context (revert to default) semanage fcontext -d -t user_home_t "/tmp/test"
  2. Last action should result in the following warning:
restorecon:  Warning no default label for /tmp/test
  1. Remove test file rm -rf /tmp/test

Expected Results

  1. All commands are executed successfully
  2. Context of the test file matches prescribed values