From b6d37ebb7c1886ebf8bae463cae581a3605a8745 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Fri, 28 Apr 2006 15:50:06 +0000 Subject: [PATCH] add munin, bug 1530 --- refpolicy/Changelog | 1 + refpolicy/policy/modules/admin/logrotate.te | 8 +- refpolicy/policy/modules/services/cron.te | 7 +- refpolicy/policy/modules/services/munin.fc | 11 ++ refpolicy/policy/modules/services/munin.if | 62 ++++++++ refpolicy/policy/modules/services/munin.te | 135 ++++++++++++++++++ refpolicy/policy/modules/system/userdomain.te | 6 +- 7 files changed, 227 insertions(+), 3 deletions(-) create mode 100644 refpolicy/policy/modules/services/munin.fc create mode 100644 refpolicy/policy/modules/services/munin.if create mode 100644 refpolicy/policy/modules/services/munin.te diff --git a/refpolicy/Changelog b/refpolicy/Changelog index 17f994a0..aeccccd7 100644 --- a/refpolicy/Changelog +++ b/refpolicy/Changelog @@ -56,6 +56,7 @@ jabber mozilla mplayer + munin nagios nessus nsd diff --git a/refpolicy/policy/modules/admin/logrotate.te b/refpolicy/policy/modules/admin/logrotate.te index b312f660..a479123d 100644 --- a/refpolicy/policy/modules/admin/logrotate.te +++ b/refpolicy/policy/modules/admin/logrotate.te @@ -1,5 +1,5 @@ -policy_module(logrotate,1.2.0) +policy_module(logrotate,1.2.1) ######################################## # @@ -169,6 +169,12 @@ optional_policy(` mailman_manage_log(logrotate_t) ') +optional_policy(` + munin_read_config(logrotate_t) + munin_stream_connect(logrotate_t) + munin_search_lib(logrotate_t) +') + optional_policy(` mysql_read_config(logrotate_t) mysql_search_db(logrotate_t) diff --git a/refpolicy/policy/modules/services/cron.te b/refpolicy/policy/modules/services/cron.te index b311aebf..d4601e51 100644 --- a/refpolicy/policy/modules/services/cron.te +++ b/refpolicy/policy/modules/services/cron.te @@ -1,5 +1,5 @@ -policy_module(cron,1.3.4) +policy_module(cron,1.3.5) gen_require(` class passwd rootok; @@ -190,6 +190,11 @@ optional_policy(` hal_dbus_send(crond_t) ') +optional_policy(` + # cjp: why? + munin_search_lib(crond_t) +') + optional_policy(` nis_use_ypbind(crond_t) ') diff --git a/refpolicy/policy/modules/services/munin.fc b/refpolicy/policy/modules/services/munin.fc new file mode 100644 index 00000000..54ca668f --- /dev/null +++ b/refpolicy/policy/modules/services/munin.fc @@ -0,0 +1,11 @@ +/etc/lrrd(/.*)? gen_context(system_u:object_r:munin_etc_t,s0) + +/usr/bin/lrrd-.* -- gen_context(system_u:object_r:munin_exec_t,s0) +/usr/sbin/lrrd-.* -- gen_context(system_u:object_r:munin_exec_t,s0) +/usr/share/lrrd/lrrd-.* -- gen_context(system_u:object_r:munin_exec_t,s0) +/usr/share/lrrd/plugins/.* -- gen_context(system_u:object_r:munin_exec_t,s0) + +/var/lib/lrrd(/.*)? gen_context(system_u:object_r:munin_var_lib_t,s0) +/var/log/lrrd.* -- gen_context(system_u:object_r:munin_log_t,s0) +/var/run/lrrd(/.*)? gen_context(system_u:object_r:munin_var_run_t,s0) +/var/www/lrrd(/.*)? gen_context(system_u:object_r:munin_var_lib_t,s0) diff --git a/refpolicy/policy/modules/services/munin.if b/refpolicy/policy/modules/services/munin.if new file mode 100644 index 00000000..aca3c639 --- /dev/null +++ b/refpolicy/policy/modules/services/munin.if @@ -0,0 +1,62 @@ +## Munin network-wide load graphing (formerly LRRD) + +######################################## +## +## Connect to munin over a unix domain +## stream socket. +## +## +## +## Domain allowed access. +## +## +# +interface(`munin_stream_connect',` + gen_require(` + type munin_var_run_t, munin_t; + ') + + allow $1 munin_t:unix_stream_socket connectto; + allow $1 munin_var_run_t:sock_file { getattr write }; + files_search_pids($1) +') + +####################################### +## +## Read munin configuration files. +## +## +## +## Domain allowed access. +## +## +# +interface(`munin_read_config',` + gen_require(` + type munin_etc_t; + ') + + allow $1 munin_etc_t:dir list_dir_perms; + allow $1 munin_etc_t:file read_file_perms; + allow $1 munin_etc_t:lnk_file { getattr read }; + files_search_etc($1) +') + +####################################### +## +## Search munin library directories. +## +## +## +## Domain allowed access. +## +## +# +interface(`munin_search_lib',` + gen_require(` + type munin_var_lib_t; + ') + + allow $1 munin_var_lib_t:dir search_dir_perms; + files_search_var_lib($1) +') diff --git a/refpolicy/policy/modules/services/munin.te b/refpolicy/policy/modules/services/munin.te new file mode 100644 index 00000000..a68abc77 --- /dev/null +++ b/refpolicy/policy/modules/services/munin.te @@ -0,0 +1,135 @@ + +policy_module(munin,1.0.0) + +######################################## +# +# Declarations +# + +type munin_t alias lrrd_t; +type munin_exec_t alias lrrd_exec_t; +init_daemon_domain(munin_t,munin_exec_t) + +type munin_etc_t alias lrrd_etc_t; +files_config_file(munin_etc_t) + +type munin_log_t alias lrrd_log_t; +logging_log_file(munin_log_t) + +type munin_tmp_t alias lrrd_tmp_t; +files_tmp_file(munin_tmp_t) + +type munin_var_lib_t alias lrrd_var_lib_t; +files_type(munin_var_lib_t) + +type munin_var_run_t alias lrrd_var_run_t; +files_pid_file(munin_var_run_t) + +######################################## +# +# Local policy +# + +allow munin_t self:capability { setgid setuid }; +dontaudit munin_t self:capability sys_tty_config; +allow munin_t self:process { getsched setsched signal_perms }; +allow munin_t self:unix_stream_socket { create_stream_socket_perms connectto }; +allow munin_t self:unix_dgram_socket { create_socket_perms sendto }; +allow munin_t self:tcp_socket create_stream_socket_perms; +allow munin_t self:udp_socket create_socket_perms; + +allow munin_t munin_etc_t:file r_file_perms; +allow munin_t munin_etc_t:dir r_dir_perms; +allow munin_t munin_etc_t:lnk_file { getattr read }; +files_search_etc(munin_t) + +allow munin_t munin_log_t:file create_file_perms; +logging_log_filetrans(munin_t,munin_log_t,file) + +allow munin_t munin_tmp_t:dir create_dir_perms; +allow munin_t munin_tmp_t:file create_file_perms; +files_tmp_filetrans(munin_t, munin_tmp_t, { file dir }) + +# Allow access to the munin databases +allow munin_t munin_var_lib_t:dir create_dir_perms; +allow munin_t munin_var_lib_t:file create_file_perms; +allow munin_t munin_var_lib_t:lnk_file create_lnk_perms; +files_search_var_lib(munin_t) + +allow munin_t munin_var_run_t:sock_file manage_file_perms; +allow munin_t munin_var_run_t:file manage_file_perms; +allow munin_t munin_var_run_t:dir rw_dir_perms; +files_pid_filetrans(munin_t,munin_var_run_t,file) + +kernel_read_system_state(munin_t) +kernel_read_kernel_sysctls(munin_t) + +corecmd_exec_bin(munin_t) + +corenet_tcp_sendrecv_generic_if(munin_t) +corenet_udp_sendrecv_generic_if(munin_t) +corenet_raw_sendrecv_generic_if(munin_t) +corenet_tcp_sendrecv_all_nodes(munin_t) +corenet_udp_sendrecv_all_nodes(munin_t) +corenet_raw_sendrecv_all_nodes(munin_t) +corenet_tcp_sendrecv_all_ports(munin_t) +corenet_udp_sendrecv_all_ports(munin_t) +corenet_non_ipsec_sendrecv(munin_t) +corenet_tcp_bind_all_nodes(munin_t) +corenet_udp_bind_all_nodes(munin_t) + +dev_read_sysfs(munin_t) +dev_read_urand(munin_t) + +domain_use_interactive_fds(munin_t) + +files_read_etc_files(munin_t) +files_read_etc_runtime_files(munin_t) +files_read_usr_files(munin_t) + +fs_getattr_all_fs(munin_t) +fs_search_auto_mountpoints(munin_t) + +term_dontaudit_use_console(munin_t) + +init_use_fds(munin_t) +init_use_script_ptys(munin_t) + +libs_use_ld_so(munin_t) +libs_use_shared_libs(munin_t) + +logging_send_syslog_msg(munin_t) + +miscfiles_read_localization(munin_t) + +sysnet_read_config(munin_t) + +userdom_dontaudit_use_unpriv_user_fds(munin_t) +userdom_dontaudit_search_sysadm_home_dirs(munin_t) + +ifdef(`targeted_policy',` + term_dontaudit_use_unallocated_ttys(munin_t) + term_dontaudit_use_generic_ptys(munin_t) + files_dontaudit_read_root_files(munin_t) +') + +optional_policy(` + # for accessing the output directory + apache_search_sys_content(munin_t) +') + +optional_policy(` + cron_system_entry(munin_t,munin_exec_t) +') + +optional_policy(` + nis_use_ypbind(munin_t) +') + +optional_policy(` + seutil_sigchld_newrole(munin_t) +') + +optional_policy(` + udev_read_db(munin_t) +') diff --git a/refpolicy/policy/modules/system/userdomain.te b/refpolicy/policy/modules/system/userdomain.te index fd502141..603d1eb4 100644 --- a/refpolicy/policy/modules/system/userdomain.te +++ b/refpolicy/policy/modules/system/userdomain.te @@ -1,5 +1,5 @@ -policy_module(userdomain,1.3.19) +policy_module(userdomain,1.3.20) gen_require(` role sysadm_r, staff_r, user_r; @@ -337,6 +337,10 @@ ifdef(`targeted_policy',` rpc_domtrans_nfsd(sysadm_t) ') + optional_policy(` + munin_stream_connect(sysadm_t) + ') + optional_policy(` ntp_stub() corenet_udp_bind_ntp_port(sysadm_t)