2010-07-13 12:39:54 +00:00
|
|
|
policy_module(clamav, 1.8.1)
|
2010-05-03 19:01:35 +00:00
|
|
|
|
|
|
|
## <desc>
|
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
2010-09-22 10:07:37 +00:00
|
|
|
## <p>
|
|
|
|
## Allow clamd to use JIT compiler
|
|
|
|
## </p>
|
2010-05-03 19:01:35 +00:00
|
|
|
## </desc>
|
|
|
|
gen_tunable(clamd_use_jit, false)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
|
|
|
# Main clamd domain
|
|
|
|
type clamd_t;
|
|
|
|
type clamd_exec_t;
|
|
|
|
init_daemon_domain(clamd_t, clamd_exec_t)
|
|
|
|
|
|
|
|
# configuration files
|
|
|
|
type clamd_etc_t;
|
2009-07-21 14:10:31 +00:00
|
|
|
files_config_file(clamd_etc_t)
|
|
|
|
|
|
|
|
type clamd_initrc_exec_t;
|
|
|
|
init_script_file(clamd_initrc_exec_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# tmp files
|
|
|
|
type clamd_tmp_t;
|
|
|
|
files_tmp_file(clamd_tmp_t)
|
|
|
|
|
|
|
|
# log files
|
|
|
|
type clamd_var_log_t;
|
|
|
|
logging_log_file(clamd_var_log_t)
|
|
|
|
|
|
|
|
# var/lib files
|
|
|
|
type clamd_var_lib_t;
|
|
|
|
files_type(clamd_var_lib_t)
|
|
|
|
|
|
|
|
# pid files
|
|
|
|
type clamd_var_run_t;
|
|
|
|
files_pid_file(clamd_var_run_t)
|
2006-07-28 15:13:58 +00:00
|
|
|
typealias clamd_var_run_t alias clamd_sock_t;
|
2006-03-07 21:15:24 +00:00
|
|
|
|
2006-05-17 14:50:31 +00:00
|
|
|
type clamscan_t;
|
|
|
|
type clamscan_exec_t;
|
|
|
|
init_daemon_domain(clamscan_t, clamscan_exec_t)
|
|
|
|
|
2006-06-07 17:43:10 +00:00
|
|
|
# tmp files
|
|
|
|
type clamscan_tmp_t;
|
|
|
|
files_tmp_file(clamscan_tmp_t)
|
|
|
|
|
2006-03-07 21:15:24 +00:00
|
|
|
type freshclam_t;
|
|
|
|
type freshclam_exec_t;
|
|
|
|
init_daemon_domain(freshclam_t, freshclam_exec_t)
|
|
|
|
|
|
|
|
# log files
|
|
|
|
type freshclam_var_log_t;
|
|
|
|
logging_log_file(freshclam_var_log_t)
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# clamd local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow clamd_t self:capability { kill setgid setuid dac_override };
|
2010-05-03 19:01:35 +00:00
|
|
|
dontaudit clamd_t self:capability sys_tty_config;
|
2006-12-12 20:08:08 +00:00
|
|
|
allow clamd_t self:fifo_file rw_fifo_file_perms;
|
2009-07-21 14:10:31 +00:00
|
|
|
allow clamd_t self:unix_stream_socket { create_stream_socket_perms connectto };
|
2006-03-07 21:15:24 +00:00
|
|
|
allow clamd_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
allow clamd_t self:tcp_socket { listen accept };
|
|
|
|
|
|
|
|
# configuration files
|
2006-12-12 20:08:08 +00:00
|
|
|
allow clamd_t clamd_etc_t:dir list_dir_perms;
|
2008-07-23 21:38:39 +00:00
|
|
|
read_files_pattern(clamd_t, clamd_etc_t, clamd_etc_t)
|
|
|
|
read_lnk_files_pattern(clamd_t, clamd_etc_t, clamd_etc_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# tmp files
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(clamd_t, clamd_tmp_t, clamd_tmp_t)
|
|
|
|
manage_files_pattern(clamd_t, clamd_tmp_t, clamd_tmp_t)
|
|
|
|
files_tmp_filetrans(clamd_t, clamd_tmp_t, { file dir })
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# var/lib files for clamd
|
2010-08-26 13:41:21 +00:00
|
|
|
manage_sock_files_pattern(clamd_t, clamd_var_lib_t, clamd_var_lib_t)
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(clamd_t, clamd_var_lib_t, clamd_var_lib_t)
|
|
|
|
manage_files_pattern(clamd_t, clamd_var_lib_t, clamd_var_lib_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# log files
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(clamd_t, clamd_var_log_t, clamd_var_log_t)
|
|
|
|
manage_files_pattern(clamd_t, clamd_var_log_t, clamd_var_log_t)
|
|
|
|
logging_log_filetrans(clamd_t, clamd_var_log_t, { dir file })
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# pid file
|
2010-08-27 00:30:04 +00:00
|
|
|
manage_dirs_pattern(clamd_t, clamd_var_run_t, clamd_var_run_t)
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_files_pattern(clamd_t, clamd_var_run_t, clamd_var_run_t)
|
|
|
|
manage_sock_files_pattern(clamd_t, clamd_var_run_t, clamd_var_run_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
files_pid_filetrans(clamd_t, clamd_var_run_t, { sock_file file dir })
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
kernel_dontaudit_list_proc(clamd_t)
|
2006-12-04 20:10:56 +00:00
|
|
|
kernel_read_sysctl(clamd_t)
|
2007-09-05 14:48:21 +00:00
|
|
|
kernel_read_kernel_sysctls(clamd_t)
|
2009-07-21 14:10:31 +00:00
|
|
|
kernel_read_system_state(clamd_t)
|
|
|
|
|
|
|
|
corecmd_exec_shell(clamd_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
2007-06-27 15:23:21 +00:00
|
|
|
corenet_all_recvfrom_unlabeled(clamd_t)
|
|
|
|
corenet_all_recvfrom_netlabel(clamd_t)
|
2009-01-06 20:24:10 +00:00
|
|
|
corenet_tcp_sendrecv_generic_if(clamd_t)
|
2009-01-09 19:48:02 +00:00
|
|
|
corenet_tcp_sendrecv_generic_node(clamd_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
corenet_tcp_sendrecv_all_ports(clamd_t)
|
|
|
|
corenet_tcp_sendrecv_clamd_port(clamd_t)
|
2009-01-09 19:48:02 +00:00
|
|
|
corenet_tcp_bind_generic_node(clamd_t)
|
2006-05-30 19:46:34 +00:00
|
|
|
corenet_tcp_bind_clamd_port(clamd_t)
|
2009-07-21 14:10:31 +00:00
|
|
|
corenet_tcp_bind_generic_port(clamd_t)
|
|
|
|
corenet_tcp_connect_generic_port(clamd_t)
|
2006-05-30 19:46:34 +00:00
|
|
|
corenet_sendrecv_clamd_server_packets(clamd_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
dev_read_rand(clamd_t)
|
|
|
|
dev_read_urand(clamd_t)
|
|
|
|
|
|
|
|
domain_use_interactive_fds(clamd_t)
|
|
|
|
|
|
|
|
files_read_etc_files(clamd_t)
|
|
|
|
files_read_etc_runtime_files(clamd_t)
|
2006-06-07 17:43:10 +00:00
|
|
|
files_search_spool(clamd_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
2010-01-07 16:49:44 +00:00
|
|
|
auth_use_nsswitch(clamd_t)
|
|
|
|
|
2006-06-07 17:43:10 +00:00
|
|
|
logging_send_syslog_msg(clamd_t)
|
|
|
|
|
2006-03-07 21:15:24 +00:00
|
|
|
miscfiles_read_localization(clamd_t)
|
|
|
|
|
|
|
|
cron_use_fds(clamd_t)
|
|
|
|
cron_use_system_job_fds(clamd_t)
|
|
|
|
cron_rw_pipes(clamd_t)
|
|
|
|
|
2009-07-21 14:10:31 +00:00
|
|
|
mta_read_config(clamd_t)
|
|
|
|
mta_send_mail(clamd_t)
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-03-07 21:15:24 +00:00
|
|
|
amavis_read_lib_files(clamd_t)
|
2006-06-07 17:43:10 +00:00
|
|
|
amavis_read_spool_files(clamd_t)
|
2009-06-26 14:40:13 +00:00
|
|
|
amavis_spool_filetrans(clamd_t, clamd_var_run_t, sock_file)
|
2007-06-26 18:43:11 +00:00
|
|
|
amavis_create_pid_files(clamd_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
')
|
|
|
|
|
2009-07-21 14:10:31 +00:00
|
|
|
optional_policy(`
|
|
|
|
exim_read_spool_files(clamd_t)
|
|
|
|
')
|
|
|
|
|
2010-07-13 12:39:54 +00:00
|
|
|
tunable_policy(`clamd_use_jit',`
|
|
|
|
allow clamd_t self:process execmem;
|
2010-08-26 13:41:21 +00:00
|
|
|
allow clamscan_t self:process execmem;
|
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
2010-09-22 10:07:37 +00:00
|
|
|
',`
|
2010-07-13 12:39:54 +00:00
|
|
|
dontaudit clamd_t self:process execmem;
|
2010-08-26 13:41:21 +00:00
|
|
|
dontaudit clamscan_t self:process execmem;
|
2010-07-13 12:39:54 +00:00
|
|
|
')
|
|
|
|
|
2006-03-07 21:15:24 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Freshclam local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow freshclam_t self:capability { setgid setuid dac_override };
|
2006-12-12 20:08:08 +00:00
|
|
|
allow freshclam_t self:fifo_file rw_fifo_file_perms;
|
2006-03-07 21:15:24 +00:00
|
|
|
allow freshclam_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
allow freshclam_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
allow freshclam_t self:tcp_socket { listen accept };
|
|
|
|
|
|
|
|
# configuration files
|
2006-12-12 20:08:08 +00:00
|
|
|
allow freshclam_t clamd_etc_t:dir list_dir_perms;
|
2008-07-23 21:38:39 +00:00
|
|
|
read_files_pattern(freshclam_t, clamd_etc_t, clamd_etc_t)
|
|
|
|
read_lnk_files_pattern(freshclam_t, clamd_etc_t, clamd_etc_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# var/lib files together with clamd
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(freshclam_t, clamd_var_lib_t, clamd_var_lib_t)
|
|
|
|
manage_files_pattern(freshclam_t, clamd_var_lib_t, clamd_var_lib_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# pidfiles- var/run together with clamd
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_files_pattern(freshclam_t, clamd_var_run_t, clamd_var_run_t)
|
|
|
|
manage_sock_files_pattern(freshclam_t, clamd_var_run_t, clamd_var_run_t)
|
|
|
|
files_pid_filetrans(freshclam_t, clamd_var_run_t, file)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
# log files (own logfiles only)
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_files_pattern(freshclam_t, freshclam_var_log_t, freshclam_var_log_t)
|
2010-09-22 10:02:34 +00:00
|
|
|
allow freshclam_t freshclam_var_log_t:dir setattr_dir_perms;
|
2010-09-07 20:23:09 +00:00
|
|
|
read_files_pattern(freshclam_t, clamd_var_log_t, clamd_var_log_t)
|
2008-07-23 21:38:39 +00:00
|
|
|
logging_log_filetrans(freshclam_t, freshclam_var_log_t, file)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
kernel_read_kernel_sysctls(freshclam_t)
|
|
|
|
kernel_read_system_state(freshclam_t)
|
|
|
|
|
2010-09-07 20:23:09 +00:00
|
|
|
corecmd_exec_shell(freshclam_t)
|
|
|
|
corecmd_exec_bin(freshclam_t)
|
|
|
|
|
2007-06-27 15:23:21 +00:00
|
|
|
corenet_all_recvfrom_unlabeled(freshclam_t)
|
|
|
|
corenet_all_recvfrom_netlabel(freshclam_t)
|
2009-01-06 20:24:10 +00:00
|
|
|
corenet_tcp_sendrecv_generic_if(freshclam_t)
|
2009-01-09 19:48:02 +00:00
|
|
|
corenet_tcp_sendrecv_generic_node(freshclam_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
corenet_tcp_sendrecv_all_ports(freshclam_t)
|
|
|
|
corenet_tcp_sendrecv_clamd_port(freshclam_t)
|
|
|
|
corenet_tcp_connect_http_port(freshclam_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
corenet_tcp_connect_clamd_port(freshclam_t)
|
2006-05-30 19:46:34 +00:00
|
|
|
corenet_sendrecv_http_client_packets(freshclam_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
dev_read_rand(freshclam_t)
|
|
|
|
dev_read_urand(freshclam_t)
|
|
|
|
|
|
|
|
domain_use_interactive_fds(freshclam_t)
|
|
|
|
|
|
|
|
files_read_etc_files(freshclam_t)
|
|
|
|
files_read_etc_runtime_files(freshclam_t)
|
|
|
|
|
2010-01-07 16:49:44 +00:00
|
|
|
auth_use_nsswitch(freshclam_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
2010-05-03 19:01:35 +00:00
|
|
|
logging_send_syslog_msg(freshclam_t)
|
|
|
|
|
2010-01-07 16:49:44 +00:00
|
|
|
miscfiles_read_localization(freshclam_t)
|
2006-03-07 21:15:24 +00:00
|
|
|
|
|
|
|
clamav_stream_connect(freshclam_t)
|
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
userdom_stream_connect(freshclam_t)
|
|
|
|
|
2010-07-13 12:39:54 +00:00
|
|
|
tunable_policy(`clamd_use_jit',`
|
|
|
|
allow freshclam_t self:process execmem;
|
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
2010-09-22 10:07:37 +00:00
|
|
|
',`
|
2010-07-13 12:39:54 +00:00
|
|
|
dontaudit freshclam_t self:process execmem;
|
|
|
|
')
|
|
|
|
|
2010-09-22 09:23:25 +00:00
|
|
|
optional_policy(`
|
|
|
|
cron_system_entry(freshclam_t, freshclam_exec_t)
|
|
|
|
')
|
|
|
|
|
2006-05-17 14:50:31 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# clamscam local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow clamscan_t self:capability { setgid setuid dac_override };
|
|
|
|
allow clamscan_t self:fifo_file rw_file_perms;
|
|
|
|
allow clamscan_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
allow clamscan_t self:unix_dgram_socket create_socket_perms;
|
2009-07-21 14:10:31 +00:00
|
|
|
allow clamscan_t self:tcp_socket create_stream_socket_perms;
|
2006-05-17 14:50:31 +00:00
|
|
|
|
|
|
|
# configuration files
|
2006-12-12 20:08:08 +00:00
|
|
|
allow clamscan_t clamd_etc_t:dir list_dir_perms;
|
2008-07-23 21:38:39 +00:00
|
|
|
read_files_pattern(clamscan_t, clamd_etc_t, clamd_etc_t)
|
|
|
|
read_lnk_files_pattern(clamscan_t, clamd_etc_t, clamd_etc_t)
|
2006-05-17 14:50:31 +00:00
|
|
|
|
2006-06-07 17:43:10 +00:00
|
|
|
# tmp files
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(clamscan_t, clamscan_tmp_t, clamscan_tmp_t)
|
|
|
|
manage_files_pattern(clamscan_t, clamscan_tmp_t, clamscan_tmp_t)
|
|
|
|
files_tmp_filetrans(clamscan_t, clamscan_tmp_t, { file dir })
|
2006-06-07 17:43:10 +00:00
|
|
|
|
2006-05-17 14:50:31 +00:00
|
|
|
# var/lib files together with clamd
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_files_pattern(clamscan_t, clamd_var_lib_t, clamd_var_lib_t)
|
2006-12-12 20:08:08 +00:00
|
|
|
allow clamscan_t clamd_var_lib_t:dir list_dir_perms;
|
2006-05-17 14:50:31 +00:00
|
|
|
|
2009-07-21 14:10:31 +00:00
|
|
|
corenet_all_recvfrom_unlabeled(clamscan_t)
|
|
|
|
corenet_all_recvfrom_netlabel(clamscan_t)
|
|
|
|
corenet_tcp_sendrecv_generic_if(clamscan_t)
|
|
|
|
corenet_tcp_sendrecv_generic_node(clamscan_t)
|
|
|
|
corenet_tcp_sendrecv_all_ports(clamscan_t)
|
|
|
|
corenet_tcp_sendrecv_clamd_port(clamscan_t)
|
|
|
|
corenet_tcp_connect_clamd_port(clamscan_t)
|
|
|
|
|
2006-05-17 14:50:31 +00:00
|
|
|
kernel_read_kernel_sysctls(clamscan_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
kernel_read_system_state(clamscan_t)
|
2006-05-17 14:50:31 +00:00
|
|
|
|
|
|
|
files_read_etc_files(clamscan_t)
|
|
|
|
files_read_etc_runtime_files(clamscan_t)
|
|
|
|
files_search_var_lib(clamscan_t)
|
|
|
|
|
2007-09-05 14:48:21 +00:00
|
|
|
init_read_utmp(clamscan_t)
|
|
|
|
init_dontaudit_write_utmp(clamscan_t)
|
|
|
|
|
2006-05-17 14:50:31 +00:00
|
|
|
miscfiles_read_localization(clamscan_t)
|
|
|
|
miscfiles_read_public_files(clamscan_t)
|
|
|
|
|
|
|
|
clamav_stream_connect(clamscan_t)
|
|
|
|
|
2009-07-21 14:10:31 +00:00
|
|
|
mta_send_mail(clamscan_t)
|
|
|
|
|
2010-01-07 16:49:44 +00:00
|
|
|
optional_policy(`
|
|
|
|
amavis_read_spool_files(clamscan_t)
|
|
|
|
')
|
|
|
|
|
2006-05-17 14:50:31 +00:00
|
|
|
optional_policy(`
|
|
|
|
apache_read_sys_content(clamscan_t)
|
|
|
|
')
|