|
|
1ec3d1a |
## <summary>ClamAV Virus Scanner</summary>
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Execute a domain transition to run clamd.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed to transition.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`clamav_domtrans',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type clamd_t, clamd_exec_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
domtrans_pattern($1, clamd_exec_t, clamd_t)
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Connect to run clamd.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed access.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`clamav_stream_connect',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type clamd_t, clamd_var_run_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
files_search_pids($1)
|
|
|
1ec3d1a |
stream_connect_pattern($1, clamd_var_run_t, clamd_var_run_t, clamd_t)
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Allow the specified domain to append
|
|
|
1ec3d1a |
## to clamav log files.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed access.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`clamav_append_log',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type clamd_var_log_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
logging_search_logs($1)
|
|
|
1ec3d1a |
allow $1 clamd_var_log_t:dir list_dir_perms;
|
|
|
1ec3d1a |
append_files_pattern($1, clamd_var_log_t, clamd_var_log_t)
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Read clamav configuration files.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed access.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`clamav_read_config',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type clamd_etc_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
files_search_etc($1)
|
|
|
1ec3d1a |
allow $1 clamd_etc_t:file read_file_perms;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Search clamav libraries directories.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed access.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`clamav_search_lib',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type clamd_var_lib_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
files_search_var_lib($1)
|
|
|
1ec3d1a |
allow $1 clamd_var_lib_t:dir search_dir_perms;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Execute a domain transition to run clamscan.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed to transition.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`clamav_domtrans_clamscan',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type clamscan_t, clamscan_exec_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
domtrans_pattern($1, clamscan_exec_t, clamscan_t)
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Execute clamscan without a transition.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed access.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`clamav_exec_clamscan',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type clamscan_exec_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
can_exec($1, clamscan_exec_t)
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Manage clamd pid content.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed access.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`clamav_manage_clamd_pid',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type clamd_var_run_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
manage_dirs_pattern($1, clamd_var_run_t, clamd_var_run_t)
|
|
|
1ec3d1a |
manage_files_pattern($1, clamd_var_run_t, clamd_var_run_t)
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
#######################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
bb86d3d |
## Read clamd state files.
|
|
|
bb86d3d |
## </summary>
|
|
|
bb86d3d |
## <param name="domain">
|
|
|
bb86d3d |
## <summary>
|
|
|
bb86d3d |
## Domain allowed access.
|
|
|
bb86d3d |
## </summary>
|
|
|
bb86d3d |
## </param>
|
|
|
bb86d3d |
#
|
|
|
bb86d3d |
interface(`clamav_read_state_clamd',`
|
|
|
bb86d3d |
gen_require(`
|
|
|
bb86d3d |
type clamd_t;
|
|
|
bb86d3d |
')
|
|
|
bb86d3d |
|
|
|
bb86d3d |
kernel_search_proc($1)
|
|
|
bb86d3d |
ps_process_pattern($1, clamd_t)
|
|
|
bb86d3d |
')
|
|
|
bb86d3d |
|
|
|
bb86d3d |
#######################################
|
|
|
bb86d3d |
## <summary>
|
|
|
1ec3d1a |
## Execute clamd server in the clamd domain.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed to transition.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`clamd_systemctl',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type clamd_t;
|
|
|
1ec3d1a |
type clamd_unit_file_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
systemd_exec_systemctl($1)
|
|
|
1ec3d1a |
systemd_read_fifo_file_passwd_run($1)
|
|
|
1ec3d1a |
allow $1 clamd_unit_file_t:file read_file_perms;
|
|
|
1ec3d1a |
allow $1 clamd_unit_file_t:service manage_service_perms;
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
ps_process_pattern($1, clamd_t)
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## All of the rules required to administrate
|
|
|
1ec3d1a |
## an clamav environment
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed access.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
## <param name="role">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## The role to be allowed to manage the clamav domain.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
## <rolecap/>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`clamav_admin',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type clamd_t, clamd_etc_t, clamd_tmp_t;
|
|
|
1ec3d1a |
type clamd_var_log_t, clamd_var_lib_t, clamd_var_run_t;
|
|
|
1ec3d1a |
type clamscan_t, clamscan_tmp_t, clamd_initrc_exec_t;
|
|
|
1ec3d1a |
type freshclam_t, freshclam_var_log_t;
|
|
|
1ec3d1a |
type clamd_unit_file_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
allow $1 clamd_t:process signal_perms;
|
|
|
1ec3d1a |
ps_process_pattern($1, clamd_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
tunable_policy(`deny_ptrace',`',`
|
|
|
1ec3d1a |
allow $1 clamd_t:process ptrace;
|
|
|
1ec3d1a |
allow $1 clamscan_t:process ptrace;
|
|
|
1ec3d1a |
allow $1 freshclam_t:process ptrace;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
allow $1 clamscan_t:process signal_perms;
|
|
|
1ec3d1a |
ps_process_pattern($1, clamscan_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
allow $1 freshclam_t:process signal_perms;
|
|
|
1ec3d1a |
ps_process_pattern($1, freshclam_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
init_labeled_script_domtrans($1, clamd_initrc_exec_t)
|
|
|
1ec3d1a |
domain_system_change_exemption($1)
|
|
|
1ec3d1a |
role_transition $2 clamd_initrc_exec_t system_r;
|
|
|
1ec3d1a |
allow $2 system_r;
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
clamd_systemctl($1)
|
|
|
1ec3d1a |
admin_pattern($1, clamd_unit_file_t)
|
|
|
1ec3d1a |
allow $1 clamd_unit_file_t:service all_service_perms;
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
files_list_etc($1)
|
|
|
1ec3d1a |
admin_pattern($1, clamd_etc_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
files_list_var_lib($1)
|
|
|
1ec3d1a |
admin_pattern($1, clamd_var_lib_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
logging_list_logs($1)
|
|
|
1ec3d1a |
admin_pattern($1, clamd_var_log_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
files_list_pids($1)
|
|
|
1ec3d1a |
admin_pattern($1, clamd_var_run_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
files_list_tmp($1)
|
|
|
1ec3d1a |
admin_pattern($1, clamd_tmp_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
admin_pattern($1, clamscan_tmp_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
admin_pattern($1, freshclam_var_log_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
optional_policy(`
|
|
|
1ec3d1a |
systemd_passwd_agent_exec($1)
|
|
|
1ec3d1a |
systemd_read_fifo_file_passwd_run($1)
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
')
|