SETroubleshoot patch from Dan Walsh.

Policy to handle the fixit button in setroubleshoot.
This commit is contained in:
Chris PeBenito 2010-05-13 13:22:53 -04:00
parent ada61e1529
commit bcc6e65421
3 changed files with 170 additions and 12 deletions

View File

@ -1,5 +1,7 @@
/usr/sbin/setroubleshootd -- gen_context(system_u:object_r:setroubleshootd_exec_t,s0)
/usr/share/setroubleshoot/SetroubleshootFixit\.py* -- gen_context(system_u:object_r:setroubleshoot_fixit_exec_t,s0)
/var/run/setroubleshoot(/.*)? gen_context(system_u:object_r:setroubleshoot_var_run_t,s0)
/var/log/setroubleshoot(/.*)? gen_context(system_u:object_r:setroubleshoot_var_log_t,s0)

View File

@ -16,8 +16,8 @@ interface(`setroubleshoot_stream_connect',`
')
files_search_pids($1)
allow $1 setroubleshoot_var_run_t:sock_file write;
allow $1 setroubleshootd_t:unix_stream_socket connectto;
stream_connect_pattern($1, setroubleshoot_var_run_t, setroubleshoot_var_run_t, setroubleshootd_t)
allow $1 setroubleshoot_var_run_t:sock_file read;
')
########################################
@ -36,6 +36,100 @@ interface(`setroubleshoot_dontaudit_stream_connect',`
type setroubleshootd_t, setroubleshoot_var_run_t;
')
dontaudit $1 setroubleshoot_var_run_t:sock_file write;
dontaudit $1 setroubleshoot_var_run_t:sock_file rw_sock_file_perms;
dontaudit $1 setroubleshootd_t:unix_stream_socket connectto;
')
########################################
## <summary>
## Send and receive messages from
## setroubleshoot over dbus.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`setroubleshoot_dbus_chat',`
gen_require(`
type setroubleshootd_t;
class dbus send_msg;
')
allow $1 setroubleshootd_t:dbus send_msg;
allow setroubleshootd_t $1:dbus send_msg;
')
########################################
## <summary>
## Do not audit send and receive messages from
## setroubleshoot over dbus.
## </summary>
## <param name="domain">
## <summary>
## Domain to not audit.
## </summary>
## </param>
#
interface(`setroubleshoot_dontaudit_dbus_chat',`
gen_require(`
type setroubleshootd_t;
class dbus send_msg;
')
dontaudit $1 setroubleshootd_t:dbus send_msg;
dontaudit setroubleshootd_t $1:dbus send_msg;
')
########################################
## <summary>
## Send and receive messages from
## setroubleshoot over dbus.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`setroubleshoot_dbus_chat_fixit',`
gen_require(`
type setroubleshoot_fixit_t;
class dbus send_msg;
')
allow $1 setroubleshoot_fixit_t:dbus send_msg;
allow setroubleshoot_fixit_t $1:dbus send_msg;
')
########################################
## <summary>
## All of the rules required to administrate
## an setroubleshoot environment
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`setroubleshoot_admin',`
gen_require(`
type setroubleshootd_t, setroubleshoot_log_t;
type setroubleshoot_var_lib_t, setroubleshoot_var_run_t;
')
allow $1 setroubleshootd_t:process { ptrace signal_perms };
ps_process_pattern($1, setroubleshootd_t)
logging_list_logs($1)
admin_pattern($1, setroubleshoot_log_t)
files_list_var_lib($1)
admin_pattern($1, setroubleshoot_var_lib_t)
files_list_pids($1)
admin_pattern($1, setroubleshoot_var_run_t)
')

View File

@ -1,9 +1,9 @@
policy_module(setroubleshoot, 1.10.0)
policy_module(setroubleshoot, 1.10.1)
########################################
#
# Declarations
# Declarations
#
type setroubleshootd_t alias setroubleshoot_t;
@ -11,6 +11,10 @@ type setroubleshootd_exec_t;
domain_type(setroubleshootd_t)
init_daemon_domain(setroubleshootd_t, setroubleshootd_exec_t)
type setroubleshoot_fixit_t;
type setroubleshoot_fixit_exec_t;
dbus_system_domain(setroubleshoot_fixit_t, setroubleshoot_fixit_exec_t)
type setroubleshoot_var_lib_t;
files_type(setroubleshoot_var_lib_t)
@ -27,8 +31,8 @@ files_pid_file(setroubleshoot_var_run_t)
# setroubleshootd local policy
#
allow setroubleshootd_t self:capability { dac_override sys_tty_config };
allow setroubleshootd_t self:process { signull signal getattr getsched };
allow setroubleshootd_t self:capability { dac_override sys_nice sys_tty_config };
allow setroubleshootd_t self:process { getattr getsched setsched sigkill signull signal };
allow setroubleshootd_t self:fifo_file rw_fifo_file_perms;
allow setroubleshootd_t self:tcp_socket create_stream_socket_perms;
allow setroubleshootd_t self:unix_stream_socket { create_stream_socket_perms connectto };
@ -52,6 +56,7 @@ files_pid_filetrans(setroubleshootd_t, setroubleshoot_var_run_t, { file sock_fil
kernel_read_kernel_sysctls(setroubleshootd_t)
kernel_read_system_state(setroubleshootd_t)
kernel_read_net_sysctls(setroubleshootd_t)
kernel_read_network_state(setroubleshootd_t)
corecmd_exec_bin(setroubleshootd_t)
@ -68,16 +73,26 @@ corenet_sendrecv_smtp_client_packets(setroubleshootd_t)
dev_read_urand(setroubleshootd_t)
dev_read_sysfs(setroubleshootd_t)
dev_getattr_all_blk_files(setroubleshootd_t)
dev_getattr_all_chr_files(setroubleshootd_t)
domain_dontaudit_search_all_domains_state(setroubleshootd_t)
domain_signull_all_domains(setroubleshootd_t)
files_read_usr_files(setroubleshootd_t)
files_read_etc_files(setroubleshootd_t)
files_getattr_all_dirs(setroubleshootd_t)
files_list_all(setroubleshootd_t)
files_getattr_all_files(setroubleshootd_t)
files_getattr_all_pipes(setroubleshootd_t)
files_getattr_all_sockets(setroubleshootd_t)
files_read_all_symlinks(setroubleshootd_t)
fs_getattr_all_dirs(setroubleshootd_t)
fs_getattr_all_files(setroubleshootd_t)
fs_read_fusefs_symlinks(setroubleshootd_t)
fs_list_inotifyfs(setroubleshootd_t)
fs_dontaudit_read_nfs_files(setroubleshootd_t)
fs_dontaudit_read_cifs_files(setroubleshootd_t)
selinux_get_enforce_mode(setroubleshootd_t)
selinux_validate_context(setroubleshootd_t)
@ -94,23 +109,70 @@ miscfiles_read_localization(setroubleshootd_t)
locallogin_dontaudit_use_fds(setroubleshootd_t)
logging_send_audit_msgs(setroubleshootd_t)
logging_send_syslog_msg(setroubleshootd_t)
logging_stream_connect_dispatcher(setroubleshootd_t)
modutils_read_module_config(setroubleshootd_t)
seutil_read_config(setroubleshootd_t)
seutil_read_file_contexts(setroubleshootd_t)
sysnet_read_config(setroubleshootd_t)
seutil_read_bin_policy(setroubleshootd_t)
userdom_dontaudit_read_user_home_content_files(setroubleshootd_t)
optional_policy(`
dbus_system_bus_client(setroubleshootd_t)
dbus_connect_system_bus(setroubleshootd_t)
dbus_system_domain(setroubleshootd_t, setroubleshootd_exec_t)
')
optional_policy(`
rpm_signull(setroubleshootd_t)
rpm_read_db(setroubleshootd_t)
rpm_dontaudit_manage_db(setroubleshootd_t)
rpm_use_script_fds(setroubleshootd_t)
')
########################################
#
# setroubleshoot_fixit local policy
#
allow setroubleshoot_fixit_t self:capability sys_nice;
allow setroubleshoot_fixit_t self:process { setsched getsched };
allow setroubleshoot_fixit_t self:fifo_file rw_fifo_file_perms;
allow setroubleshoot_fixit_t self:unix_dgram_socket create_socket_perms;
allow setroubleshoot_fixit_t setroubleshootd_t:process signull;
setroubleshoot_dbus_chat(setroubleshoot_fixit_t)
setroubleshoot_stream_connect(setroubleshoot_fixit_t)
kernel_read_system_state(setroubleshoot_fixit_t)
corecmd_exec_bin(setroubleshoot_fixit_t)
corecmd_exec_shell(setroubleshoot_fixit_t)
seutil_domtrans_setfiles(setroubleshoot_fixit_t)
files_read_usr_files(setroubleshoot_fixit_t)
files_read_etc_files(setroubleshoot_fixit_t)
files_list_tmp(setroubleshoot_fixit_t)
auth_use_nsswitch(setroubleshoot_fixit_t)
logging_send_audit_msgs(setroubleshoot_fixit_t)
logging_send_syslog_msg(setroubleshoot_fixit_t)
miscfiles_read_localization(setroubleshoot_fixit_t)
optional_policy(`
rpm_signull(setroubleshoot_fixit_t)
rpm_read_db(setroubleshoot_fixit_t)
rpm_dontaudit_manage_db(setroubleshoot_fixit_t)
rpm_use_script_fds(setroubleshoot_fixit_t)
')
optional_policy(`
policykit_dbus_chat(setroubleshoot_fixit_t)
userdom_read_all_users_state(setroubleshoot_fixit_t)
')