Chris PeBenito 17de1b7
Chris PeBenito 827060c
policy_module(files, 1.12.4)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
########################################
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# Declarations
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
attribute file_type;
Chris PeBenito 17de1b7
attribute files_unconfined_type;
Chris PeBenito 17de1b7
attribute lockfile;
Chris PeBenito 17de1b7
attribute mountpoint;
Chris PeBenito 17de1b7
attribute pidfile;
Craig Grube e877913
attribute configfile;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
# For labeling types that are to be polyinstantiated
Chris PeBenito 17de1b7
attribute polydir;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
# And for labeling the parent directories of those polyinstantiated directories
Chris PeBenito 17de1b7
# This is necessary for remounting the original in the parent to give
Chris PeBenito 17de1b7
# security aware apps access
Chris PeBenito 17de1b7
attribute polyparent;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
# And labeling for the member directories
Chris PeBenito 17de1b7
attribute polymember;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
# sensitive security files whose accesses should
Chris PeBenito 17de1b7
# not be dontaudited for uses
Chris PeBenito 17de1b7
attribute security_file_type;
Chris PeBenito 3338f23
# and its opposite
Chris PeBenito 3338f23
attribute non_security_file_type;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
attribute tmpfile;
Chris PeBenito 17de1b7
attribute tmpfsfile;
Chris PeBenito 17de1b7
Chris PeBenito bbb7cc8
# this attribute is not currently used and will be removed in the future.
Chris PeBenito bbb7cc8
# unfortunately, this attribute can not be removed yet because it may cause
Chris PeBenito bbb7cc8
# some policies to fail to link if it is still required.
Chris PeBenito 17de1b7
attribute usercanread;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# boot_t is the type for files in /boot
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type boot_t;
Chris PeBenito 17de1b7
files_mountpoint(boot_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
# default_t is the default type for files that do not
Chris PeBenito 17de1b7
# match any specification in the file_contexts configuration
Chris PeBenito 17de1b7
# other than the generic /.* specification.
Chris PeBenito 17de1b7
type default_t;
Chris PeBenito 17de1b7
files_mountpoint(default_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# etc_t is the type of the system etc directories.
Chris PeBenito 17de1b7
#
Chris PeBenito 910b1d8
type etc_t, configfile;
Chris PeBenito 17de1b7
files_type(etc_t)
Chris PeBenito 6b19be3
# compatibility aliases for removed types:
Chris PeBenito 6b19be3
typealias etc_t alias automount_etc_t;
Chris PeBenito 788d88c
typealias etc_t alias snmpd_etc_t;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# etc_runtime_t is the type of various
Chris PeBenito 17de1b7
# files in /etc that are automatically
Chris PeBenito 17de1b7
# generated during initialization.
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type etc_runtime_t;
Chris PeBenito 17de1b7
files_type(etc_runtime_t)
Chris PeBenito 693d4ae
#Temporarily in policy until FC5 dissappears
Chris PeBenito 693d4ae
typealias etc_runtime_t alias firstboot_rw_t;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# file_t is the default type of a file that has not yet been
Chris PeBenito 17de1b7
# assigned an extended attribute (EA) value (when using a filesystem
Chris PeBenito 17de1b7
# that supports EAs).
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type file_t;
Chris PeBenito 17de1b7
files_mountpoint(file_t)
Chris PeBenito 17de1b7
kernel_rootfs_mountpoint(file_t)
Chris PeBenito 17de1b7
sid file gen_context(system_u:object_r:file_t,s0)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# home_root_t is the type for the directory where user home directories
Chris PeBenito 17de1b7
# are created
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type home_root_t;
Chris PeBenito 17de1b7
files_mountpoint(home_root_t)
Chris PeBenito 17de1b7
files_poly_parent(home_root_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# lost_found_t is the type for the lost+found directories.
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type lost_found_t;
Chris PeBenito 17de1b7
files_type(lost_found_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# mnt_t is the type for mount points such as /mnt/cdrom
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type mnt_t;
Chris PeBenito 17de1b7
files_mountpoint(mnt_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# modules_object_t is the type for kernel modules
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type modules_object_t;
Chris PeBenito 17de1b7
files_type(modules_object_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
type no_access_t;
Chris PeBenito 17de1b7
files_type(no_access_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
type poly_t;
Chris PeBenito 17de1b7
files_type(poly_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
type readable_t;
Chris PeBenito 17de1b7
files_type(readable_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# root_t is the type for rootfs and the root directory.
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type root_t;
Chris PeBenito 17de1b7
files_mountpoint(root_t)
Chris PeBenito 17de1b7
files_poly_parent(root_t)
Chris PeBenito 17de1b7
kernel_rootfs_mountpoint(root_t)
Chris PeBenito 17de1b7
genfscon rootfs / gen_context(system_u:object_r:root_t,s0)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# src_t is the type of files in the system src directories.
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type src_t;
Chris PeBenito 17de1b7
files_mountpoint(src_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# system_map_t is for the system.map files in /boot
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type system_map_t;
Chris PeBenito 17de1b7
files_type(system_map_t)
Chris PeBenito 037fc0f
genfscon proc /kallsyms gen_context(system_u:object_r:system_map_t,s0)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# tmp_t is the type of the temporary directories
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type tmp_t;
Chris PeBenito 17de1b7
files_tmp_file(tmp_t)
Chris PeBenito 17de1b7
files_mountpoint(tmp_t)
Chris PeBenito 17de1b7
files_poly(tmp_t)
Chris PeBenito 17de1b7
files_poly_parent(tmp_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# usr_t is the type for /usr.
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type usr_t;
Chris PeBenito 17de1b7
files_mountpoint(usr_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# var_t is the type of /var
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type var_t;
Chris PeBenito 17de1b7
files_mountpoint(var_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# var_lib_t is the type of /var/lib
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type var_lib_t;
Chris PeBenito 17de1b7
files_mountpoint(var_lib_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# var_lock_t is tye type of /var/lock
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type var_lock_t;
Chris PeBenito 17de1b7
files_lock_file(var_lock_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# var_run_t is the type of /var/run, usually
Chris PeBenito 17de1b7
# used for pid and other runtime files.
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type var_run_t;
Chris PeBenito 17de1b7
files_pid_file(var_run_t)
Chris PeBenito 14c0edc
files_mountpoint(var_run_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# var_spool_t is the type of /var/spool
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
type var_spool_t;
Chris PeBenito 17de1b7
files_tmp_file(var_spool_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
########################################
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# Rules for all file types
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
allow file_type self:filesystem associate;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
fs_associate(file_type)
Chris PeBenito 17de1b7
fs_associate_noxattr(file_type)
Chris PeBenito 350b6ab
fs_associate_tmpfs(file_type)
Chris PeBenito 495df41
fs_associate_ramfs(file_type)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
########################################
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# Rules for all tmp file types
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
Chris PeBenito a65fd90
allow file_type tmp_t:filesystem associate;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
fs_associate_tmpfs(tmpfile)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
########################################
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# Rules for all tmpfs file types
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
fs_associate_tmpfs(tmpfsfile)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
########################################
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# Unconfined access to this module
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
# Create/access any file in a labeled filesystem;
Chris PeBenito 17de1b7
allow files_unconfined_type file_type:{ file chr_file } ~execmod;
Chris PeBenito 17de1b7
allow files_unconfined_type file_type:{ dir lnk_file sock_file fifo_file blk_file } *;
Chris PeBenito 17de1b7
Chris PeBenito dccbb80
# Mount/unmount any filesystem with the context= option.
Chris PeBenito 17de1b7
allow files_unconfined_type file_type:filesystem *;
Chris PeBenito 17de1b7
Chris PeBenito 350b6ab
tunable_policy(`allow_execmod',`
Chris PeBenito 350b6ab
	allow files_unconfined_type file_type:file execmod;
Chris PeBenito 17de1b7
')