Blob Blame History Raw
## <summary>ClamAV Virus Scanner</summary>

########################################
## <summary>
##	Execute a domain transition to run clamd.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed to transition.
##	</summary>
## </param>
#
interface(`clamav_domtrans',`
	gen_require(`
		type clamd_t, clamd_exec_t;
	')

	domain_auto_trans($1,clamd_exec_t,clamd_t)

	allow $1 clamd_t:fd use;
	allow clamd_t $1:fd use;
	allow clamd_t $1:fifo_file rw_file_perms;
	allow clamd_t $1:process sigchld;
')

########################################
## <summary>
##	Connect to run clamd.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed to connect.
##	</summary>
## </param>
#
interface(`clamav_stream_connect',`
	gen_require(`
		type clamd_t, clamd_sock_t, clamd_var_run_t;
	')

	allow $1 clamd_var_run_t:dir search;
	allow $1 clamd_sock_t:sock_file write;
	allow $1 clamd_t:unix_stream_socket connectto;
')

########################################
## <summary>
##	Read clamav configuration files.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`clamav_read_config',`
	gen_require(`
		type clamd_etc_t;
	')

	files_search_etc($1)
	allow $1 clamd_etc_t:file r_file_perms;
')

########################################
## <summary>
##	Search clamav libraries directories.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`clamav_search_lib',`
	gen_require(`
		type clamd_var_lib_t;
	')

	files_search_var_lib($1)
	allow $1 clamd_var_lib_t:dir search_dir_perms;
')

########################################
## <summary>
##	Execute a domain transition to run clamscan.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`clamav_domtrans_clamscan',`
	gen_require(`
		type clamscan_t, clamscan_exec_t;
	')

	domain_auto_trans($1,clamscan_exec_t,clamscan_t)

	allow clamscan_t $1:fd use;
	allow clamscan_t $1:fifo_file rw_file_perms;
	allow clamscan_t $1:process sigchld;
')