selinux-policy/policy/modules/apps/tvtime.if
2006-07-12 20:32:27 +00:00

149 lines
4.7 KiB
Plaintext

## <summary> tvtime - a high quality television application </summary>
#######################################
## <summary>
## The per user domain template for the tvtime module.
## </summary>
## <desc>
## <p>
## This template creates a derived domains which are used
## for tvtime.
## </p>
## <p>
## This template is invoked automatically for each user, and
## generally does not need to be invoked directly
## by policy writers.
## </p>
## </desc>
## <param name="userdomain_prefix">
## <summary>
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </summary>
## </param>
## <param name="user_domain">
## <summary>
## The type of the user domain.
## </summary>
## </param>
## <param name="user_role">
## <summary>
## The role associated with the user domain.
## </summary>
## </param>
#
template(`tvtime_per_userdomain_template',`
########################################
#
# Declarations
#
type $1_tvtime_t;
domain_type($1_tvtime_t)
domain_entry_file($1_tvtime_t,tvtime_exec_t)
role $3 types $1_tvtime_t;
type $1_tvtime_home_t alias $1_tvtime_rw_t;
userdom_user_home_content($1,$1_tvtime_home_t)
files_poly_member($1_tvtime_home_t)
type $1_tvtime_tmp_t;
files_tmp_file($1_tvtime_tmp_t)
type $1_tvtime_tmpfs_t;
files_tmpfs_file($1_tvtime_tmpfs_t)
########################################
#
# Local policy
#
allow $1_tvtime_t self:capability { setuid sys_nice sys_resource };
allow $1_tvtime_t self:process setsched;
allow $1_tvtime_t self:unix_dgram_socket rw_socket_perms;
allow $1_tvtime_t self:unix_stream_socket rw_stream_socket_perms;
# X access, Home files
allow $1_tvtime_t $1_tvtime_home_t:dir manage_dir_perms;
allow $1_tvtime_t $1_tvtime_home_t:file manage_file_perms;
allow $1_tvtime_t $1_tvtime_home_t:lnk_file create_lnk_perms;
type_transition $1_tvtime_t $1_home_dir_t:dir $1_tvtime_home_t;
userdom_user_home_dir_filetrans($1,$1_tvtime_t,$1_tvtime_home_t,dir)
allow $1_tvtime_t $1_tvtime_tmp_t:dir create_dir_perms;
allow $1_tvtime_t $1_tvtime_tmp_t:file create_file_perms;
files_tmp_filetrans($1_tvtime_t, $1_tvtime_tmp_t, { file dir fifo_file })
allow $1_tvtime_t $1_tvtime_tmpfs_t:dir { read getattr lock search ioctl add_name remove_name write };
allow $1_tvtime_t $1_tvtime_tmpfs_t:file { create ioctl read getattr lock write setattr append link unlink rename };
allow $1_tvtime_t $1_tvtime_tmpfs_t:lnk_file { create read getattr setattr link unlink rename };
allow $1_tvtime_t $1_tvtime_tmpfs_t:sock_file { create ioctl read getattr lock write setattr append link unlink rename };
allow $1_tvtime_t $1_tvtime_tmpfs_t:fifo_file { create ioctl read getattr lock write setattr append link unlink rename };
fs_tmpfs_filetrans($1_tvtime_t,$1_tvtime_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
# Type transition
domain_auto_trans($2, tvtime_exec_t, $1_tvtime_t)
allow $2 $1_tvtime_t:fd use;
allow $1_tvtime_t $2:fd use;
allow $1_tvtime_t $2:fifo_file rw_file_perms;
allow $1_tvtime_t $2:process sigchld;
# X access, Home files
allow $2 $1_tvtime_home_t:dir manage_dir_perms;
allow $2 $1_tvtime_home_t:file manage_file_perms;
allow $2 $1_tvtime_home_t:lnk_file create_lnk_perms;
allow $2 $1_tvtime_home_t:{ dir file lnk_file } { relabelfrom relabelto };
# Allow the user domain to signal/ps.
allow $2 $1_tvtime_t:dir { search getattr read };
allow $2 $1_tvtime_t:{ file lnk_file } { read getattr };
allow $2 $1_tvtime_t:process getattr;
# We need to suppress this denial because procps tries to access
# /proc/pid/environ and this now triggers a ptrace check in recent kernels
# (2.4 and 2.6). Might want to change procps to not do this, or only if
# running in a privileged domain.
dontaudit $2 $1_tvtime_t:process ptrace;
allow $2 $1_tvtime_t:process signal_perms;
kernel_read_all_sysctls($1_tvtime_t)
kernel_get_sysvipc_info($1_tvtime_t)
dev_read_urand($1_tvtime_t)
dev_read_realtime_clock($1_tvtime_t)
dev_read_sound($1_tvtime_t)
files_read_usr_files($1_tvtime_t)
files_search_pids($1_tvtime_t)
# Read /etc/tvtime
files_read_etc_files($1_tvtime_t)
# X access, Home files
fs_search_auto_mountpoints($1_tvtime_t)
libs_use_ld_so($1_tvtime_t)
libs_use_shared_libs($1_tvtime_t)
miscfiles_read_localization($1_tvtime_t)
miscfiles_read_fonts($1_tvtime_t)
userdom_use_user_terminals($1,$1_tvtime_t)
userdom_read_user_home_content_files($1,$1_tvtime_t)
# X access, Home files
tunable_policy(`use_nfs_home_dirs',`
fs_manage_nfs_dirs($1_tvtime_t)
fs_manage_nfs_files($1_tvtime_t)
fs_manage_nfs_symlinks($1_tvtime_t)
')
tunable_policy(`use_samba_home_dirs',`
fs_manage_cifs_dirs($1_tvtime_t)
fs_manage_cifs_files($1_tvtime_t)
fs_manage_cifs_symlinks($1_tvtime_t)
')
optional_policy(`
xserver_user_client_template($1,$1_tvtime_t,$1_tvtime_tmpfs_t)
')
')