6.6. Increasing file sensitivity levels in MLS
By default, Multi-Level Security (MLS) users cannot increase file sensitivity levels. However, the security administrator (secadm_r) can change this default behavior to allow users to increase the sensitivity of files by adding the local module mlsfilewrite to the system’s SELinux policy. Then, users assigned to the SELinux type defined in the policy module can increase file classification levels by modifying the file. Any time a user modifies a file, the file’s sensitivity level increases to the lower value of the user’s current security range.
The security administrator, when logged in as a user assigned to the secadm_r role, can change the security levels of files by using the chcon -l s0 /path/to/file command. For more information, see Changing file sensitivity in MLS.
Prerequisites
-
The SELinux policy is set to
mls. -
SELinux mode is set to
enforcing. -
The
policycoreutils-python-utilspackage is installed. -
The
mlsfilewritelocal module is installed in the SELinux MLS policy. You are logged in as a user in MLS which is:
-
Assigned to a defined security range. This example shows a user with a security range
s0-s2. -
Assigned to the same SELinux type defined in the
mlsfilewritemodule. This example requires the(typeattributeset mlsfilewrite (user_t))module.
-
Assigned to a defined security range. This example shows a user with a security range
Procedure
Optional: Display the security context of the current user:
$ id -Z user_u:user_r:user_t:s0-s2Change the lower level of the user’s MLS clearance range to the level which you want to assign to the file:
$ newrole -l s1-s2Optional: Display the security context of the current user:
$ id -Z user_u:user_r:user_t:s1-s2Optional: Display the security context of the file:
$ ls -Z /path/to/file user_u:object_r:user_home_t:s0 /path/to/fileChange the file’s sensitivity level to the lower level of the user’s clearance range by modifying the file:
$ touch /path/to/file중요The classification level reverts to the default value if the
restoreconcommand is used on the system.Optional: Exit the shell to return to the user’s previous security range:
$ exit
Verification
Display the security context of the file:
$ ls -Z /path/to/file user_u:object_r:user_home_t:s1 /path/to/file