|
Chris PeBenito |
17de1b |
## <summary>ClamAV Virus Scanner</summary>
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Execute a domain transition to run clamd.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed to transition.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`clamav_domtrans',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type clamd_t, clamd_exec_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
0bfccd |
domtrans_pattern($1, clamd_exec_t, clamd_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Connect to run clamd.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed to connect.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`clamav_stream_connect',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
465510 |
type clamd_t, clamd_var_run_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
0bfccd |
stream_connect_pattern($1, clamd_var_run_t, clamd_var_run_t, clamd_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
ad0aea |
## Allow the specified domain to append
|
|
Chris PeBenito |
ad0aea |
## to clamav log files.
|
|
Chris PeBenito |
ad0aea |
## </summary>
|
|
Chris PeBenito |
ad0aea |
## <param name="domain">
|
|
Chris PeBenito |
ad0aea |
## <summary>
|
|
Chris PeBenito |
ad0aea |
## Domain allowed access.
|
|
Chris PeBenito |
ad0aea |
## </summary>
|
|
Chris PeBenito |
ad0aea |
## </param>
|
|
Chris PeBenito |
ad0aea |
#
|
|
Chris PeBenito |
ad0aea |
interface(`clamav_append_log',`
|
|
Chris PeBenito |
ad0aea |
gen_require(`
|
|
Chris PeBenito |
ad0aea |
type clamav_log_t;
|
|
Chris PeBenito |
ad0aea |
')
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
logging_search_logs($1)
|
|
Chris PeBenito |
ad0aea |
allow $1 clamav_log_t:dir list_dir_perms;
|
|
Chris PeBenito |
ad0aea |
append_files_pattern($1, clamav_log_t, clamav_log_t)
|
|
Chris PeBenito |
ad0aea |
')
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
########################################
|
|
Chris PeBenito |
ad0aea |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Read clamav configuration files.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`clamav_read_config',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type clamd_etc_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
files_search_etc($1)
|
|
Chris PeBenito |
c0868a |
allow $1 clamd_etc_t:file read_file_perms;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Search clamav libraries directories.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`clamav_search_lib',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type clamd_var_lib_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
files_search_var_lib($1)
|
|
Chris PeBenito |
17de1b |
allow $1 clamd_var_lib_t:dir search_dir_perms;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Execute a domain transition to run clamscan.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`clamav_domtrans_clamscan',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type clamscan_t, clamscan_exec_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
0bfccd |
domtrans_pattern($1, clamscan_exec_t, clamscan_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
########################################
|
|
Chris PeBenito |
ad0aea |
## <summary>
|
|
Chris PeBenito |
ad0aea |
## Execute clamscan without a transition.
|
|
Chris PeBenito |
ad0aea |
## </summary>
|
|
Chris PeBenito |
ad0aea |
## <param name="domain">
|
|
Chris PeBenito |
ad0aea |
## <summary>
|
|
Chris PeBenito |
ad0aea |
## Domain allowed access.
|
|
Chris PeBenito |
ad0aea |
## </summary>
|
|
Chris PeBenito |
ad0aea |
## </param>
|
|
Chris PeBenito |
ad0aea |
#
|
|
Chris PeBenito |
ad0aea |
interface(`clamav_exec_clamscan',`
|
|
Chris PeBenito |
ad0aea |
gen_require(`
|
|
Chris PeBenito |
ad0aea |
type clamscan_exec_t;
|
|
Chris PeBenito |
ad0aea |
')
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
can_exec($1, clamscan_exec_t)
|
|
Chris PeBenito |
ad0aea |
')
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
########################################
|
|
Chris PeBenito |
ad0aea |
## <summary>
|
|
Chris PeBenito |
4804cd |
## All of the rules required to administrate
|
|
Chris PeBenito |
ad0aea |
## an clamav environment
|
|
Chris PeBenito |
ad0aea |
## </summary>
|
|
Chris PeBenito |
ad0aea |
## <param name="domain">
|
|
Chris PeBenito |
ad0aea |
## <summary>
|
|
Chris PeBenito |
ad0aea |
## Domain allowed access.
|
|
Chris PeBenito |
ad0aea |
## </summary>
|
|
Chris PeBenito |
ad0aea |
## </param>
|
|
Chris PeBenito |
ad0aea |
## <param name="role">
|
|
Chris PeBenito |
ad0aea |
## <summary>
|
|
Chris PeBenito |
ad0aea |
## The role to be allowed to manage the clamav domain.
|
|
Chris PeBenito |
ad0aea |
## </summary>
|
|
Chris PeBenito |
ad0aea |
## </param>
|
|
Chris PeBenito |
ad0aea |
## <rolecap/>
|
|
Chris PeBenito |
ad0aea |
#
|
|
Chris PeBenito |
ad0aea |
interface(`clamav_admin',`
|
|
Chris PeBenito |
ad0aea |
gen_require(`
|
|
Chris PeBenito |
ad0aea |
type clamd_t, clamd_etc_t, clamd_tmp_t;
|
|
Chris PeBenito |
ad0aea |
type clamd_var_log_t, clamd_var_lib_t;
|
|
Chris PeBenito |
ad0aea |
type clamd_var_run_t, clamscan_t, clamscan_tmp_t;
|
|
Chris PeBenito |
ad0aea |
type clamd_initrc_exec_t;
|
|
Chris PeBenito |
ad0aea |
type freshclam_t, freshclam_var_log_t;
|
|
Chris PeBenito |
ad0aea |
')
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
allow $1 clamd_t:process { ptrace signal_perms };
|
|
Chris PeBenito |
ad0aea |
ps_process_pattern($1, clamd_t)
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
allow $1 clamscan_t:process { ptrace signal_perms };
|
|
Chris PeBenito |
ad0aea |
ps_process_pattern($1, clamscan_t)
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
allow $1 freshclam_t:process { ptrace signal_perms };
|
|
Chris PeBenito |
ad0aea |
ps_process_pattern($1, freshclam_t)
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
init_labeled_script_domtrans($1, clamd_initrc_exec_t)
|
|
Chris PeBenito |
ad0aea |
domain_system_change_exemption($1)
|
|
Chris PeBenito |
ad0aea |
role_transition $2 clamd_initrc_exec_t system_r;
|
|
Chris PeBenito |
ad0aea |
allow $2 system_r;
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
files_list_etc($1)
|
|
Chris PeBenito |
ad0aea |
admin_pattern($1, clamd_etc_t)
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
files_list_var_lib($1)
|
|
Chris PeBenito |
ad0aea |
admin_pattern($1, clamd_var_lib_t)
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
logging_list_logs($1)
|
|
Chris PeBenito |
ad0aea |
admin_pattern($1, clamd_var_log_t)
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
files_list_pids($1)
|
|
Chris PeBenito |
ad0aea |
admin_pattern($1, clamd_var_run_t)
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
files_list_tmp($1)
|
|
Chris PeBenito |
ad0aea |
admin_pattern($1, clamd_tmp_t)
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
admin_pattern($1, clamscan_tmp_t)
|
|
Chris PeBenito |
ad0aea |
|
|
Chris PeBenito |
ad0aea |
admin_pattern($1, freshclam_var_log_t)
|
|
Chris PeBenito |
ad0aea |
')
|