Chris PeBenito e181fe
Chris PeBenito 123a99
policy_module(files,1.2.12)
Chris PeBenito 960373
Chris PeBenito fd89e1
########################################
Chris PeBenito fd89e1
#
Chris PeBenito fd89e1
# Declarations
Chris PeBenito fd89e1
#
Chris PeBenito fd89e1
Chris PeBenito b4cd15
attribute file_type;
Chris PeBenito b518fc
attribute files_unconfined_type;
Chris PeBenito b4cd15
attribute lockfile;
Chris PeBenito 46410f
attribute mountpoint;
Chris PeBenito b4cd15
attribute pidfile;
Chris PeBenito a1fcff
Chris PeBenito a1fcff
# For labeling types that are to be polyinstantiated
Chris PeBenito a1fcff
attribute polydir;
Chris PeBenito a1fcff
Chris PeBenito a1fcff
# And for labeling the parent directories of those polyinstantiated directories
Chris PeBenito a1fcff
# This is necessary for remounting the original in the parent to give
Chris PeBenito a1fcff
# security aware apps access
Chris PeBenito a1fcff
attribute polyparent;
Chris PeBenito a1fcff
Chris PeBenito a1fcff
# And labeling for the member directories
Chris PeBenito a1fcff
attribute polymember;
Chris PeBenito a1fcff
Chris PeBenito a2868f
# sensitive security files whose accesses should
Chris PeBenito a2868f
# not be dontaudited for uses
Chris PeBenito a2868f
attribute security_file_type;
Chris PeBenito a2868f
Chris PeBenito b4cd15
attribute tmpfile;
Chris PeBenito 46410f
attribute tmpfsfile;
Chris PeBenito b4cd15
Chris PeBenito a65611
# this is a hack and should be changed
Chris PeBenito a65611
attribute usercanread;
Chris PeBenito a65611
Chris PeBenito 1c1ac6
#
Chris PeBenito 1c1ac6
# boot_t is the type for files in /boot
Chris PeBenito 1c1ac6
#
Chris PeBenito 1c1ac6
type boot_t;
Chris PeBenito 1c1ac6
files_mountpoint(boot_t)
Chris PeBenito 1c1ac6
Chris PeBenito b4cd15
# default_t is the default type for files that do not
Chris PeBenito b4cd15
# match any specification in the file_contexts configuration
Chris PeBenito b4cd15
# other than the generic /.* specification.
Chris PeBenito a65611
type default_t;
Chris PeBenito a65611
files_mountpoint(default_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# etc_t is the type of the system etc directories.
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type etc_t;
Chris PeBenito a65611
files_type(etc_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# etc_runtime_t is the type of various
Chris PeBenito b4cd15
# files in /etc that are automatically
Chris PeBenito b4cd15
# generated during initialization.
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type etc_runtime_t;
Chris PeBenito a65611
files_type(etc_runtime_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# file_t is the default type of a file that has not yet been
Chris PeBenito b4cd15
# assigned an extended attribute (EA) value (when using a filesystem
Chris PeBenito b4cd15
# that supports EAs).
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type file_t;
Chris PeBenito a65611
files_mountpoint(file_t)
Chris PeBenito 0fd9dc
kernel_rootfs_mountpoint(file_t)
Chris PeBenito e02c61
sid file gen_context(system_u:object_r:file_t,s0)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# home_root_t is the type for the directory where user home directories
Chris PeBenito b4cd15
# are created
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type home_root_t;
Chris PeBenito a65611
files_mountpoint(home_root_t)
Chris PeBenito 0f27d9
files_poly_parent(home_root_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# lost_found_t is the type for the lost+found directories.
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type lost_found_t;
Chris PeBenito a65611
files_type(lost_found_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# mnt_t is the type for mount points such as /mnt/cdrom
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type mnt_t;
Chris PeBenito a65611
files_mountpoint(mnt_t)
Chris PeBenito b4cd15
Chris PeBenito 1c1ac6
#
Chris PeBenito 1c1ac6
# modules_object_t is the type for kernel modules
Chris PeBenito 1c1ac6
#
Chris PeBenito 1c1ac6
type modules_object_t;
Chris PeBenito 1c1ac6
files_type(modules_object_t)
Chris PeBenito 1c1ac6
Chris PeBenito a65611
type no_access_t;
Chris PeBenito a65611
files_type(no_access_t)
Chris PeBenito 219bcf
Chris PeBenito a65611
type poly_t;
Chris PeBenito a65611
files_type(poly_t)
Chris PeBenito 219bcf
Chris PeBenito a65611
type readable_t;
Chris PeBenito a65611
files_type(readable_t)
Chris PeBenito 219bcf
Chris PeBenito b4cd15
#
Chris PeBenito a2d824
# root_t is the type for rootfs and the root directory.
Chris PeBenito a2d824
#
Chris PeBenito a65611
type root_t;
Chris PeBenito a65611
files_mountpoint(root_t)
Chris PeBenito 0f27d9
files_poly_parent(root_t)
Chris PeBenito 0fd9dc
kernel_rootfs_mountpoint(root_t)
Chris PeBenito e02c61
genfscon rootfs / gen_context(system_u:object_r:root_t,s0)
Chris PeBenito a2d824
Chris PeBenito a2d824
#
Chris PeBenito b4cd15
# src_t is the type of files in the system src directories.
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type src_t;
Chris PeBenito a65611
files_mountpoint(src_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito 1c1ac6
# system_map_t is for the system.map files in /boot
Chris PeBenito 1c1ac6
#
Chris PeBenito 1c1ac6
type system_map_t;
Chris PeBenito 1c1ac6
files_type(system_map_t)
Chris PeBenito 1c1ac6
Chris PeBenito 1c1ac6
#
Chris PeBenito b4cd15
# tmp_t is the type of the temporary directories
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type tmp_t;
Chris PeBenito c3cf66
files_tmp_file(tmp_t)
Chris PeBenito a65611
files_mountpoint(tmp_t)
Chris PeBenito a65611
files_poly(tmp_t)
Chris PeBenito 0f27d9
files_poly_parent(tmp_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# usr_t is the type for /usr.
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type usr_t;
Chris PeBenito a65611
files_mountpoint(usr_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# var_t is the type of /var
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type var_t;
Chris PeBenito a65611
files_mountpoint(var_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# var_lib_t is the type of /var/lib
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type var_lib_t;
Chris PeBenito a65611
files_mountpoint(var_lib_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# var_lock_t is tye type of /var/lock
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type var_lock_t;
Chris PeBenito a65611
files_lock_file(var_lock_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# var_run_t is the type of /var/run, usually
Chris PeBenito b4cd15
# used for pid and other runtime files.
Chris PeBenito b4cd15
#
Chris PeBenito a65611
type var_run_t;
Chris PeBenito a65611
files_pid_file(var_run_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# var_spool_t is the type of /var/spool
Chris PeBenito b4cd15
#
Chris PeBenito c3cf66
type var_spool_t;
Chris PeBenito c3cf66
files_tmp_file(var_spool_t)
Chris PeBenito a65611
Chris PeBenito a65611
########################################
Chris PeBenito a65611
#
Chris PeBenito a65611
# Rules for all file types
Chris PeBenito a65611
#
Chris PeBenito a65611
Chris PeBenito a65611
allow file_type self:filesystem associate;
Chris PeBenito a65611
Chris PeBenito a65611
fs_associate(file_type)
Chris PeBenito a65611
fs_associate_noxattr(file_type)
Chris PeBenito a65611
Chris PeBenito 165b42
ifdef(`targeted_policy', `
Chris PeBenito 165b42
	fs_associate_tmpfs(file_type)
Chris PeBenito 165b42
')
Chris PeBenito 165b42
Chris PeBenito a65611
########################################
Chris PeBenito a65611
#
Chris PeBenito a65611
# Rules for all tmp file types
Chris PeBenito a65611
#
Chris PeBenito a65611
Chris PeBenito a65611
allow tmpfile tmp_t:filesystem associate;
Chris PeBenito a65611
Chris PeBenito a65611
fs_associate_tmpfs(tmpfile)
Chris PeBenito a65611
Chris PeBenito a65611
########################################
Chris PeBenito a65611
#
Chris PeBenito a65611
# Rules for all tmpfs file types
Chris PeBenito a65611
#
Chris PeBenito a65611
Chris PeBenito a65611
fs_associate_tmpfs(tmpfsfile)
Chris PeBenito b518fc
Chris PeBenito b518fc
########################################
Chris PeBenito b518fc
#
Chris PeBenito b518fc
# Unconfined access to this module
Chris PeBenito b518fc
#
Chris PeBenito b518fc
Chris PeBenito b518fc
# Create/access any file in a labeled filesystem;
Chris PeBenito b518fc
allow files_unconfined_type file_type:{ file chr_file } ~execmod;
Chris PeBenito b518fc
allow files_unconfined_type file_type:{ dir lnk_file sock_file fifo_file blk_file } *;
Chris PeBenito b518fc
Chris PeBenito b518fc
# Mount/unmount any filesystem with the context= option. 
Chris PeBenito b518fc
allow files_unconfined_type file_type:filesystem *;
Chris PeBenito b518fc
Chris PeBenito b518fc
ifdef(`targeted_policy',`
Chris PeBenito b518fc
	tunable_policy(`allow_execmod',`
Chris PeBenito b518fc
		allow files_unconfined_type file_type:file execmod;
Chris PeBenito b518fc
	')
Chris PeBenito b518fc
')