Chris PeBenito 4ec694
## <summary>Policy for cdrecord</summary>
Chris PeBenito 4ec694
Chris PeBenito 4ec694
#######################################
Chris PeBenito 4ec694
## <summary>
Chris PeBenito 4ec694
##	The per user domain template for the cdrecord module.
Chris PeBenito 4ec694
## </summary>
Chris PeBenito 4ec694
## <desc>
Chris PeBenito 4ec694
##	

Chris PeBenito 4ec694
##	This template creates derived domains which are used
Chris PeBenito 4ec694
##	for cdrecord.
Chris PeBenito 4ec694
##	

Chris PeBenito 4ec694
##	

Chris PeBenito 4ec694
##	This template is invoked automatically for each user, and
Chris PeBenito 4ec694
##	generally does not need to be invoked directly
Chris PeBenito 4ec694
##	by policy writers.
Chris PeBenito 4ec694
##	

Chris PeBenito 4ec694
## </desc>
Chris PeBenito 4ec694
## <param name="userdomain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 4ec694
##	The prefix of the user domain (e.g., user
Chris PeBenito 4ec694
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 4ec694
## </param>
Chris PeBenito 4ec694
## <param name="user_domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 4ec694
##	The type of the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 4ec694
## </param>
Chris PeBenito 4ec694
## <param name="user_role">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 4ec694
##	The role associated with the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 4ec694
## </param>
Chris PeBenito 4ec694
#
Chris PeBenito 4ec694
template(`cdrecord_per_userdomain_template', `
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	gen_require(`
Chris PeBenito 4ec694
		type cdrecord_exec_t;
Chris PeBenito 4ec694
	')
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	########################################
Chris PeBenito 4ec694
	#
Chris PeBenito 4ec694
	# Declarations
Chris PeBenito 4ec694
	#
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	type $1_cdrecord_t;
Chris PeBenito 4ec694
	domain_type($1_cdrecord_t)
Chris PeBenito 4ec694
	domain_entry_file($1_cdrecord_t,cdrecord_exec_t)
Chris PeBenito 4ec694
	role $3 types $1_cdrecord_t;
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	########################################
Chris PeBenito 4ec694
	#
Chris PeBenito 4ec694
	# Local policy
Chris PeBenito 4ec694
	#
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	allow $1_cdrecord_t self:capability { ipc_lock sys_nice setuid dac_override sys_rawio };
Chris PeBenito 4ec694
	allow $1_cdrecord_t self:process { getsched setsched sigkill };
Chris PeBenito 4ec694
	allow $1_cdrecord_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 4ec694
	allow $1_cdrecord_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	allow $1_cdrecord_t $2:unix_stream_socket { getattr read write ioctl };
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	# allow ps to show cdrecord and allow the user to kill it 
Chris PeBenito 4ec694
	allow $2 $1_cdrecord_t:dir { search getattr read };
Chris PeBenito 4ec694
	allow $2 $1_cdrecord_t:{ file lnk_file } { read getattr };
Chris PeBenito 4ec694
	allow $2 $1_cdrecord_t:process getattr;
Chris PeBenito 4ec694
	#We need to suppress this denial because procps
Chris PeBenito 4ec694
	#tries to access /proc/pid/environ and this now
Chris PeBenito 4ec694
	#triggers a ptrace check in recent kernels
Chris PeBenito 4ec694
	# (2.4 and 2.6). Might want to change procps
Chris PeBenito 4ec694
	#to not do this, or only if running in a privileged domain.
Chris PeBenito 4ec694
	dontaudit $2 $1_cdrecord_t:process ptrace;
Chris PeBenito 4ec694
	allow $2 $1_cdrecord_t:process signal;
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	# Transition from the user domain to the derived domain.
Chris PeBenito 4ec694
	domain_auto_trans($2, cdrecord_exec_t, $1_cdrecord_t)
Chris PeBenito 4ec694
	allow $2 $1_cdrecord_t:fd use;
Chris PeBenito 4ec694
	allow $1_cdrecord_t $2:fd use;
Chris PeBenito 4ec694
	allow $1_cdrecord_t $2:fifo_file rw_file_perms;
Chris PeBenito 4ec694
	allow $1_cdrecord_t $2:process sigchld;
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	# allow searching for cdrom-drive
Chris PeBenito 4ec694
	dev_list_all_dev_nodes($1_cdrecord_t) 
Chris PeBenito 4ec694
	
Chris PeBenito 15722e
	domain_interactive_fd($1_cdrecord_t)
Chris PeBenito 15722e
	domain_use_interactive_fds($1_cdrecord_t)
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	files_read_etc_files($1_cdrecord_t)
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	term_use_controlling_term($1_cdrecord_t)
Chris PeBenito 4ec694
	term_list_ptys($1_cdrecord_t)
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	# allow cdrecord to write the CD
Chris PeBenito 4ec694
	storage_raw_write_removable_device($1_cdrecord_t)
Chris PeBenito 4ec694
	storage_write_scsi_generic($1_cdrecord_t)
Chris PeBenito 4ec694
	
Chris PeBenito 4ec694
	libs_use_ld_so($1_cdrecord_t)
Chris PeBenito 4ec694
	libs_use_shared_libs($1_cdrecord_t)
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	logging_send_syslog_msg($1_cdrecord_t)
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	miscfiles_read_localization($1_cdrecord_t)
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	# write to the user domain tty.
Chris PeBenito 4ec694
	userdom_use_user_terminals($1,$1_cdrecord_t)
Chris PeBenito 4ec694
	userdom_use_user_terminals($1,$2)
Chris PeBenito 4ec694
Chris PeBenito 103fe2
	userdom_read_user_home_content_files($1,$1_cdrecord_t)
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	# Handle nfs home dirs
Chris PeBenito 4ec694
	tunable_policy(`cdrecord_read_content && use_nfs_home_dirs',`
Chris PeBenito 4ec694
		fs_list_auto_mountpoints($1_cdrecord_t)
Chris PeBenito 4ec694
		files_list_home($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_read_nfs_files($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_read_nfs_symlinks($1_cdrecord_t)
Chris PeBenito 4ec694
	
Chris PeBenito 4ec694
	',`
Chris PeBenito 4ec694
		files_dontaudit_list_home($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_dontaudit_list_auto_mountpoints($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_dontaudit_read_nfs_files($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_dontaudit_list_nfs($1_cdrecord_t)
Chris PeBenito 4ec694
	')
Chris PeBenito 4ec694
	# Handle samba home dirs
Chris PeBenito 4ec694
	tunable_policy(`cdrecord_read_content && use_samba_home_dirs',`
Chris PeBenito 4ec694
		fs_list_auto_mountpoints($1_cdrecord_t)
Chris PeBenito 4ec694
		files_list_home($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_read_cifs_files($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_read_cifs_symlinks($1_cdrecord_t)
Chris PeBenito 4ec694
	',`
Chris PeBenito 4ec694
		files_dontaudit_list_home($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_dontaudit_list_auto_mountpoints($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_dontaudit_read_cifs_files($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_dontaudit_list_cifs($1_cdrecord_t)
Chris PeBenito 4ec694
	')
Chris PeBenito 4ec694
	
Chris PeBenito 4ec694
	# Handle removable media, /tmp, and /home
Chris PeBenito 4ec694
	tunable_policy(`cdrecord_read_content',`
Chris PeBenito 4ec694
		userdom_list_user_tmp($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_read_user_tmp_files($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_read_user_tmp_symlinks($1,$1_cdrecord_t)
Chris PeBenito 103fe2
		userdom_search_user_home_dirs($1,$1_cdrecord_t)
Chris PeBenito 103fe2
		userdom_read_user_home_content_files($1,$1_cdrecord_t)
Chris PeBenito 103fe2
		userdom_read_user_home_content_symlinks($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		
Chris PeBenito 4ec694
		ifdef(`enable_mls',`
Chris PeBenito 4ec694
		',`
Chris PeBenito 4d851f
			fs_search_removable($1_cdrecord_t)
Chris PeBenito 4ec694
			fs_read_removable_files($1_cdrecord_t)
Chris PeBenito 4ec694
			fs_read_removable_symlinks($1_cdrecord_t)
Chris PeBenito 4ec694
		')
Chris PeBenito 4ec694
	',`
Chris PeBenito 4ec694
		files_dontaudit_list_tmp($1_cdrecord_t)
Chris PeBenito 4ec694
		files_dontaudit_list_home($1_cdrecord_t)
Chris PeBenito 4d851f
		fs_dontaudit_list_removable($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_donaudit_read_removable_files($1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_dontaudit_list_user_tmp($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_dontaudit_read_user_tmp_files($1,$1_cdrecord_t)
Chris PeBenito 103fe2
		userdom_dontaudit_list_user_home_dirs($1,$1_cdrecord_t)
Chris PeBenito 103fe2
		userdom_dontaudit_read_user_home_content_files($1,$1_cdrecord_t)
Chris PeBenito 4ec694
	')
Chris PeBenito 4ec694
	
Chris PeBenito 4ec694
	# Handle default_t content
Chris PeBenito 4ec694
	tunable_policy(`cdrecord_read_content && read_default_t',`
Chris PeBenito 4ec694
		files_list_default($1_cdrecord_t)
Chris PeBenito 4ec694
		files_read_default_files($1_cdrecord_t)
Chris PeBenito 4ec694
		files_read_default_symlinks($1_cdrecord_t)
Chris PeBenito 4ec694
	',`
Chris PeBenito 4ec694
		files_dontaudit_read_default_files($1_cdrecord_t)
Chris PeBenito 4ec694
		files_dontaudit_list_default($1_cdrecord_t)
Chris PeBenito 4ec694
	')
Chris PeBenito 4ec694
	
Chris PeBenito 4ec694
	# Handle untrusted content
Chris PeBenito 4ec694
	tunable_policy(`cdrecord_read_content && read_untrusted_content',`
Chris PeBenito 4ec694
		files_list_tmp($1_cdrecord_t)
Chris PeBenito 4ec694
		files_list_home($1_cdrecord_t)
Chris PeBenito 103fe2
		userdom_search_user_home_dirs($1,$1_cdrecord_t)
Chris PeBenito 4ec694
Chris PeBenito 4ec694
		userdom_list_user_untrusted_content($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_read_user_untrusted_content_files($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_read_user_untrusted_content_symlinks($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_list_user_tmp_untrusted_content($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_read_user_tmp_untrusted_content_files($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_read_user_tmp_untrusted_content_symlinks($1,$1_cdrecord_t)
Chris PeBenito 4ec694
	',`
Chris PeBenito 4ec694
		files_dontaudit_list_tmp($1_cdrecord_t)
Chris PeBenito 4ec694
		files_dontaudit_list_home($1_cdrecord_t)
Chris PeBenito 103fe2
		userdom_dontaudit_list_user_home_dirs($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_dontaudit_list_user_untrusted_content($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_dontaudit_read_user_untrusted_content_files($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_dontaudit_list_user_tmp_untrusted_content($1,$1_cdrecord_t)
Chris PeBenito 4ec694
		userdom_dontaudit_read_user_tmp_untrusted_content_files($1,$1_cdrecord_t)
Chris PeBenito 4ec694
	')
Chris PeBenito 4ec694
Chris PeBenito 4ec694
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito 4ec694
		files_search_mnt($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_read_nfs_files($1_cdrecord_t)
Chris PeBenito 4ec694
		fs_read_nfs_symlinks($1_cdrecord_t)
Chris PeBenito 4ec694
	')
Chris PeBenito 4ec694
	
Chris PeBenito 4ec694
	ifdef(`TODO',`
Chris PeBenito 4ec694
		can_resmgrd_connect($1_cdrecord_t)
Chris PeBenito 4ec694
	')
Chris PeBenito 4ec694
')