From 2e9cd95e07898a4c2f842be77ec01842feecc9f6 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: May 02 2006 19:42:04 +0000 Subject: add oav, bug 1536 --- diff --git a/refpolicy/Changelog b/refpolicy/Changelog index 6b828eb..2135048 100644 --- a/refpolicy/Changelog +++ b/refpolicy/Changelog @@ -64,6 +64,7 @@ nessus nsd ntop + oav openca openvpn (Petre Rodan) perdition diff --git a/refpolicy/policy/modules/services/oav.fc b/refpolicy/policy/modules/services/oav.fc new file mode 100644 index 0000000..0a66474 --- /dev/null +++ b/refpolicy/policy/modules/services/oav.fc @@ -0,0 +1,9 @@ +/etc/oav-update(/.*)? gen_context(system_u:object_r:oav_update_etc_t,s0) +/etc/scannerdaemon/scannerdaemon\.conf -- gen_context(system_u:object_r:scannerdaemon_etc_t,s0) + +/usr/sbin/oav-update -- gen_context(system_u:object_r:oav_update_exec_t,s0) +/usr/sbin/scannerdaemon -- gen_context(system_u:object_r:scannerdaemon_exec_t,s0) + +/var/lib/oav-virussignatures -- gen_context(system_u:object_r:oav_update_var_lib_t,s0) +/var/lib/oav-update(/.*)? gen_context(system_u:object_r:oav_update_var_lib_t,s0) +/var/log/scannerdaemon\.log -- gen_context(system_u:object_r:scannerdaemon_log_t,s0) diff --git a/refpolicy/policy/modules/services/oav.if b/refpolicy/policy/modules/services/oav.if new file mode 100644 index 0000000..122b069 --- /dev/null +++ b/refpolicy/policy/modules/services/oav.if @@ -0,0 +1,56 @@ +## Open AntiVirus scannerdaemon and signature update + +######################################## +## +## Execute oav_update in the oav_update domain. +## +## +## +## Domain allowed access. +## +## +# +interface(`oav_domtrans_update',` + gen_require(` + type oav_update_t, oav_update_exec_t; + ') + + corecmd_search_sbin($1) + domain_auto_trans($1,oav_update_exec_t,oav_update_t) + + allow $1 oav_update_t:fd use; + allow oav_update_t $1:fd use; + allow oav_update_t $1:fifo_file rw_file_perms; + allow oav_update_t $1:process sigchld; +') + +######################################## +## +## Execute oav_update in the oav_update domain, and +## allow the specified role the oav_update domain. +## +## +## +## Domain allowed access. +## +## +## +## +## The role to be allowed the oav_update domain. +## +## +## +## +## The type of the terminal allow the oav_update domain to use. +## +## +# +interface(`oav_run_update',` + gen_require(` + type oav_update_t; + ') + + oav_domtrans_update($1) + role $2 types oav_update_t; + allow oav_update_t $3:chr_file rw_term_perms; +') diff --git a/refpolicy/policy/modules/services/oav.te b/refpolicy/policy/modules/services/oav.te new file mode 100644 index 0000000..e07a8b0 --- /dev/null +++ b/refpolicy/policy/modules/services/oav.te @@ -0,0 +1,172 @@ + +policy_module(oav,1.0.0) + +######################################## +# +# Declarations +# + +type oav_update_t; +type oav_update_exec_t; +domain_type(oav_update_t) +domain_entry_file(oav_update_t,oav_update_exec_t) + +# cjp: may be collapsable to etc_t +type oav_update_etc_t; +files_type(oav_update_etc_t) + +type oav_update_var_lib_t; +files_type(oav_update_var_lib_t) + +type scannerdaemon_t; +type scannerdaemon_exec_t; +init_daemon_domain(scannerdaemon_t,scannerdaemon_exec_t) + +type scannerdaemon_etc_t; +files_type(scannerdaemon_etc_t) + +type scannerdaemon_log_t; +logging_log_file(scannerdaemon_log_t) + +type scannerdaemon_var_run_t; +files_pid_file(scannerdaemon_var_run_t) + +######################################## +# +# OAV update local policy +# + +allow oav_update_t self:tcp_socket create_stream_socket_perms; +allow oav_update_t self:udp_socket create_socket_perms; + +# Can read /etc/oav-update/* files +allow oav_update_t oav_update_etc_t:dir r_dir_perms; +allow oav_update_t oav_update_etc_t:file r_file_perms; + +# Can read /var/lib/oav-update/current +allow oav_update_t oav_update_var_lib_t:dir manage_dir_perms; +allow oav_update_t oav_update_var_lib_t:file manage_file_perms; +allow oav_update_t oav_update_var_lib_t:lnk_file r_file_perms; + +corecmd_exec_all_executables(oav_update_t) + +corenet_tcp_sendrecv_generic_if(oav_update_t) +corenet_udp_sendrecv_generic_if(oav_update_t) +corenet_raw_sendrecv_generic_if(oav_update_t) +corenet_tcp_sendrecv_all_nodes(oav_update_t) +corenet_udp_sendrecv_all_nodes(oav_update_t) +corenet_raw_sendrecv_all_nodes(oav_update_t) +corenet_tcp_sendrecv_all_ports(oav_update_t) +corenet_udp_sendrecv_all_ports(oav_update_t) +corenet_non_ipsec_sendrecv(oav_update_t) +corenet_tcp_bind_all_nodes(oav_update_t) +corenet_udp_bind_all_nodes(oav_update_t) + +files_exec_etc_files(oav_update_t) + +libs_use_ld_so(oav_update_t) +libs_use_shared_libs(oav_update_t) +libs_exec_ld_so(oav_update_t) +libs_exec_lib_files(oav_update_t) +libs_use_ld_so(oav_update_t) +libs_use_shared_libs(oav_update_t) + +logging_send_syslog_msg(oav_update_t) + +sysnet_read_config(oav_update_t) + +optional_policy(` + cron_system_entry(oav_update_t,oav_update_exec_t) +') + +######################################## +# +# Scannerdaemon local policy +# + +dontaudit scannerdaemon_t self:capability sys_tty_config; +allow scannerdaemon_t self:process signal_perms; +allow scannerdaemon_t self:fifo_file { read write }; +allow scannerdaemon_t self:tcp_socket create_stream_socket_perms; +allow scannerdaemon_t self:udp_socket create_socket_perms; + +allow scannerdaemon_t oav_update_var_lib_t:dir r_dir_perms; +allow scannerdaemon_t oav_update_var_lib_t:file r_file_perms; +files_search_var_lib(scannerdaemon_t) + +allow scannerdaemon_t scannerdaemon_etc_t:file r_file_perms; + +allow scannerdaemon_t scannerdaemon_log_t:file create_file_perms; +logging_log_filetrans(scannerdaemon_t,scannerdaemon_log_t,file) + +allow scannerdaemon_t scannerdaemon_var_run_t:file create_file_perms; +allow scannerdaemon_t scannerdaemon_var_run_t:dir rw_dir_perms; +files_pid_filetrans(scannerdaemon_t,scannerdaemon_var_run_t,file) + +kernel_read_system_state(scannerdaemon_t) +kernel_read_kernel_sysctls(scannerdaemon_t) + +# Can run kaffe +corecmd_exec_all_executables(scannerdaemon_t) + +corenet_tcp_sendrecv_generic_if(scannerdaemon_t) +corenet_udp_sendrecv_generic_if(scannerdaemon_t) +corenet_raw_sendrecv_generic_if(scannerdaemon_t) +corenet_tcp_sendrecv_all_nodes(scannerdaemon_t) +corenet_udp_sendrecv_all_nodes(scannerdaemon_t) +corenet_raw_sendrecv_all_nodes(scannerdaemon_t) +corenet_tcp_sendrecv_all_ports(scannerdaemon_t) +corenet_udp_sendrecv_all_ports(scannerdaemon_t) +corenet_non_ipsec_sendrecv(scannerdaemon_t) +corenet_tcp_bind_all_nodes(scannerdaemon_t) +corenet_udp_bind_all_nodes(scannerdaemon_t) + +dev_read_sysfs(scannerdaemon_t) + +domain_use_interactive_fds(scannerdaemon_t) + +files_read_etc_files(scannerdaemon_t) +files_read_etc_runtime_files(scannerdaemon_t) +# Can run kaffe +files_exec_etc_files(scannerdaemon_t) + +fs_getattr_all_fs(scannerdaemon_t) +fs_search_auto_mountpoints(scannerdaemon_t) + +term_dontaudit_use_console(scannerdaemon_t) + +auth_dontaudit_read_shadow(scannerdaemon_t) + +init_use_fds(scannerdaemon_t) +init_use_script_ptys(scannerdaemon_t) + +libs_use_ld_so(scannerdaemon_t) +libs_use_shared_libs(scannerdaemon_t) +# Can run kaffe +libs_use_ld_so(scannerdaemon_t) +libs_use_shared_libs(scannerdaemon_t) +libs_exec_ld_so(scannerdaemon_t) +libs_exec_lib_files(scannerdaemon_t) + +logging_send_syslog_msg(scannerdaemon_t) + +miscfiles_read_localization(scannerdaemon_t) + +sysnet_read_config(scannerdaemon_t) + +userdom_dontaudit_use_unpriv_user_fds(scannerdaemon_t) +userdom_dontaudit_search_sysadm_home_dirs(scannerdaemon_t) + +ifdef(`targeted_policy',` + term_dontaudit_use_unallocated_ttys(scannerdaemon_t) + term_dontaudit_use_generic_ptys(scannerdaemon_t) + files_dontaudit_read_root_files(scannerdaemon_t) +') + +optional_policy(` + seutil_sigchld_newrole(scannerdaemon_t) +') + +optional_policy(` + udev_read_db(scannerdaemon_t) +') diff --git a/refpolicy/policy/modules/system/userdomain.te b/refpolicy/policy/modules/system/userdomain.te index 0931a3f..b59427d 100644 --- a/refpolicy/policy/modules/system/userdomain.te +++ b/refpolicy/policy/modules/system/userdomain.te @@ -1,5 +1,5 @@ -policy_module(userdomain,1.3.21) +policy_module(userdomain,1.3.22) gen_require(` role sysadm_r, staff_r, user_r; @@ -347,6 +347,10 @@ ifdef(`targeted_policy',` ') optional_policy(` + oav_run_update(sysadm_t,sysadm_r,admin_terminal) + ') + + optional_policy(` pcmcia_run_cardctl(sysadm_t,sysadm_r,admin_terminal) ')