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