|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
465510 |
policy_module(clamav,1.0.5)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Declarations
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Main clamd domain
|
|
Chris PeBenito |
17de1b |
type clamd_t;
|
|
Chris PeBenito |
17de1b |
type clamd_exec_t;
|
|
Chris PeBenito |
17de1b |
init_daemon_domain(clamd_t, clamd_exec_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# configuration files
|
|
Chris PeBenito |
17de1b |
type clamd_etc_t;
|
|
Chris PeBenito |
17de1b |
files_type(clamd_etc_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# tmp files
|
|
Chris PeBenito |
17de1b |
type clamd_tmp_t;
|
|
Chris PeBenito |
17de1b |
files_tmp_file(clamd_tmp_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# log files
|
|
Chris PeBenito |
17de1b |
type clamd_var_log_t;
|
|
Chris PeBenito |
17de1b |
logging_log_file(clamd_var_log_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# var/lib files
|
|
Chris PeBenito |
17de1b |
type clamd_var_lib_t;
|
|
Chris PeBenito |
17de1b |
files_type(clamd_var_lib_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# pid files
|
|
Chris PeBenito |
17de1b |
type clamd_var_run_t;
|
|
Chris PeBenito |
17de1b |
files_pid_file(clamd_var_run_t)
|
|
Chris PeBenito |
465510 |
typealias clamd_var_run_t alias clamd_sock_t;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
type clamscan_t;
|
|
Chris PeBenito |
17de1b |
type clamscan_exec_t;
|
|
Chris PeBenito |
17de1b |
init_daemon_domain(clamscan_t, clamscan_exec_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# tmp files
|
|
Chris PeBenito |
17de1b |
type clamscan_tmp_t;
|
|
Chris PeBenito |
17de1b |
files_tmp_file(clamscan_tmp_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
type freshclam_t;
|
|
Chris PeBenito |
17de1b |
type freshclam_exec_t;
|
|
Chris PeBenito |
17de1b |
init_daemon_domain(freshclam_t, freshclam_exec_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# log files
|
|
Chris PeBenito |
17de1b |
type freshclam_var_log_t;
|
|
Chris PeBenito |
17de1b |
logging_log_file(freshclam_var_log_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# clamd local policy
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow clamd_t self:capability { kill setgid setuid dac_override };
|
|
Chris PeBenito |
17de1b |
allow clamd_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
17de1b |
allow clamd_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
17de1b |
allow clamd_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
17de1b |
allow clamd_t self:tcp_socket { listen accept };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# configuration files
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_etc_t:dir r_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_etc_t:file r_file_perms;
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_etc_t:lnk_file { getattr read };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# tmp files
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_tmp_t:file create_file_perms;
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_tmp_t:dir create_dir_perms;
|
|
Chris PeBenito |
17de1b |
files_tmp_filetrans(clamd_t,clamd_tmp_t,{ file dir })
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# var/lib files for clamd
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_var_lib_t:file create_file_perms;
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_var_lib_t:dir create_dir_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# log files
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_var_log_t:file create_file_perms;
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_var_log_t:dir { rw_dir_perms setattr };
|
|
Chris PeBenito |
17de1b |
logging_log_filetrans(clamd_t,clamd_var_log_t,file)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# pid file
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_var_run_t:file manage_file_perms;
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_var_run_t:sock_file manage_file_perms;
|
|
Chris PeBenito |
17de1b |
allow clamd_t clamd_var_run_t:dir rw_dir_perms;
|
|
Chris PeBenito |
17de1b |
files_pid_filetrans(clamd_t,clamd_var_run_t,file)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
kernel_dontaudit_list_proc(clamd_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
corenet_non_ipsec_sendrecv(clamd_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_if(clamd_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_nodes(clamd_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_ports(clamd_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_clamd_port(clamd_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_bind_all_nodes(clamd_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_bind_clamd_port(clamd_t)
|
|
Chris PeBenito |
17de1b |
corenet_sendrecv_clamd_server_packets(clamd_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
dev_read_rand(clamd_t)
|
|
Chris PeBenito |
17de1b |
dev_read_urand(clamd_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
domain_use_interactive_fds(clamd_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
files_read_etc_files(clamd_t)
|
|
Chris PeBenito |
17de1b |
files_read_etc_runtime_files(clamd_t)
|
|
Chris PeBenito |
17de1b |
files_search_spool(clamd_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
init_use_fds(clamd_t)
|
|
Chris PeBenito |
17de1b |
init_use_script_ptys(clamd_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
libs_use_ld_so(clamd_t)
|
|
Chris PeBenito |
17de1b |
libs_use_shared_libs(clamd_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
logging_send_syslog_msg(clamd_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
miscfiles_read_localization(clamd_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
sysnet_dns_name_resolve(clamd_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
cron_use_fds(clamd_t)
|
|
Chris PeBenito |
17de1b |
cron_use_system_job_fds(clamd_t)
|
|
Chris PeBenito |
17de1b |
cron_rw_pipes(clamd_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
ifdef(`targeted_policy',`
|
|
Chris PeBenito |
17de1b |
term_dontaudit_use_generic_ptys(clamd_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
amavis_read_lib_files(clamd_t)
|
|
Chris PeBenito |
17de1b |
amavis_read_spool_files(clamd_t)
|
|
Chris PeBenito |
17de1b |
amavis_spool_filetrans(clamd_t,clamd_var_run_t,sock_file)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Freshclam local policy
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow freshclam_t self:capability { setgid setuid dac_override };
|
|
Chris PeBenito |
17de1b |
allow freshclam_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
17de1b |
allow freshclam_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
17de1b |
allow freshclam_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
17de1b |
allow freshclam_t self:tcp_socket { listen accept };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# configuration files
|
|
Chris PeBenito |
17de1b |
allow freshclam_t clamd_etc_t:dir r_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow freshclam_t clamd_etc_t:file r_file_perms;
|
|
Chris PeBenito |
17de1b |
allow freshclam_t clamd_etc_t:lnk_file { getattr read };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# var/lib files together with clamd
|
|
Chris PeBenito |
17de1b |
allow freshclam_t clamd_var_lib_t:file create_file_perms;
|
|
Chris PeBenito |
17de1b |
allow freshclam_t clamd_var_lib_t:dir create_dir_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# pidfiles- var/run together with clamd
|
|
Chris PeBenito |
17de1b |
allow freshclam_t clamd_var_run_t:file manage_file_perms;
|
|
Chris PeBenito |
17de1b |
allow freshclam_t clamd_var_run_t:sock_file manage_file_perms;
|
|
Chris PeBenito |
17de1b |
allow freshclam_t clamd_var_run_t:dir rw_dir_perms;
|
|
Chris PeBenito |
17de1b |
files_pid_filetrans(freshclam_t,clamd_var_run_t,file)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# log files (own logfiles only)
|
|
Chris PeBenito |
17de1b |
allow freshclam_t freshclam_var_log_t:file create_file_perms;
|
|
Chris PeBenito |
17de1b |
allow freshclam_t freshclam_var_log_t:dir { rw_dir_perms setattr };
|
|
Chris PeBenito |
17de1b |
allow freshclam_t clamd_var_log_t:dir search;
|
|
Chris PeBenito |
17de1b |
logging_log_filetrans(freshclam_t,freshclam_var_log_t,file)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
corenet_non_ipsec_sendrecv(freshclam_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_if(freshclam_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_nodes(freshclam_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_ports(freshclam_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_clamd_port(freshclam_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_connect_http_port(freshclam_t)
|
|
Chris PeBenito |
17de1b |
corenet_sendrecv_http_client_packets(freshclam_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
dev_read_rand(freshclam_t)
|
|
Chris PeBenito |
17de1b |
dev_read_urand(freshclam_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
domain_use_interactive_fds(freshclam_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
files_read_etc_files(freshclam_t)
|
|
Chris PeBenito |
17de1b |
files_read_etc_runtime_files(freshclam_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
init_use_fds(freshclam_t)
|
|
Chris PeBenito |
17de1b |
init_use_script_ptys(freshclam_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
libs_use_ld_so(freshclam_t)
|
|
Chris PeBenito |
17de1b |
libs_use_shared_libs(freshclam_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
miscfiles_read_localization(freshclam_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
sysnet_dns_name_resolve(freshclam_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
clamav_stream_connect(freshclam_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
cron_use_fds(freshclam_t)
|
|
Chris PeBenito |
17de1b |
cron_use_system_job_fds(freshclam_t)
|
|
Chris PeBenito |
17de1b |
cron_rw_pipes(freshclam_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# clamscam local policy
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow clamscan_t self:capability { setgid setuid dac_override };
|
|
Chris PeBenito |
17de1b |
allow clamscan_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
17de1b |
allow clamscan_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
17de1b |
allow clamscan_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
17de1b |
allow clamscan_t self:tcp_socket { listen accept };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# configuration files
|
|
Chris PeBenito |
17de1b |
allow clamscan_t clamd_etc_t:dir r_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow clamscan_t clamd_etc_t:file r_file_perms;
|
|
Chris PeBenito |
17de1b |
allow clamscan_t clamd_etc_t:lnk_file { getattr read };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# tmp files
|
|
Chris PeBenito |
17de1b |
allow clamscan_t clamscan_tmp_t:file manage_file_perms;
|
|
Chris PeBenito |
17de1b |
allow clamscan_t clamscan_tmp_t:dir manage_dir_perms;
|
|
Chris PeBenito |
17de1b |
files_tmp_filetrans(clamscan_t,clamscan_tmp_t,{ file dir })
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# var/lib files together with clamd
|
|
Chris PeBenito |
17de1b |
allow clamscan_t clamd_var_lib_t:file r_file_perms;
|
|
Chris PeBenito |
17de1b |
allow clamscan_t clamd_var_lib_t:dir r_dir_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
kernel_read_kernel_sysctls(clamscan_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
files_read_etc_files(clamscan_t)
|
|
Chris PeBenito |
17de1b |
files_read_etc_runtime_files(clamscan_t)
|
|
Chris PeBenito |
17de1b |
files_search_var_lib(clamscan_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
libs_use_ld_so(clamscan_t)
|
|
Chris PeBenito |
17de1b |
libs_use_shared_libs(clamscan_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
miscfiles_read_localization(clamscan_t)
|
|
Chris PeBenito |
17de1b |
miscfiles_read_public_files(clamscan_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
clamav_stream_connect(clamscan_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
apache_read_sys_content(clamscan_t)
|
|
Chris PeBenito |
17de1b |
')
|