2006-01-18 16:40:04 +00:00
|
|
|
## <summary>SELinux utility to run a shell with a new role</summary>
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
## <summary>
|
2008-11-05 16:10:46 +00:00
|
|
|
## The role template for the userhelper module.
|
2006-01-18 16:40:04 +00:00
|
|
|
## </summary>
|
2008-11-05 16:10:46 +00:00
|
|
|
## <param name="userrole_prefix">
|
2006-02-10 18:41:53 +00:00
|
|
|
## <summary>
|
2008-11-05 16:10:46 +00:00
|
|
|
## The prefix of the user role (e.g., user
|
|
|
|
## is the prefix for user_r).
|
2006-02-10 18:41:53 +00:00
|
|
|
## </summary>
|
2006-01-18 16:40:04 +00:00
|
|
|
## </param>
|
2008-11-05 16:10:46 +00:00
|
|
|
## <param name="user_role">
|
2006-02-10 18:41:53 +00:00
|
|
|
## <summary>
|
2008-11-05 16:10:46 +00:00
|
|
|
## The user role.
|
2006-02-10 18:41:53 +00:00
|
|
|
## </summary>
|
2006-01-18 16:40:04 +00:00
|
|
|
## </param>
|
2008-11-05 16:10:46 +00:00
|
|
|
## <param name="user_domain">
|
2006-02-10 18:41:53 +00:00
|
|
|
## <summary>
|
2008-11-05 16:10:46 +00:00
|
|
|
## The user domain associated with the role.
|
2006-02-10 18:41:53 +00:00
|
|
|
## </summary>
|
2006-01-18 16:40:04 +00:00
|
|
|
## </param>
|
|
|
|
#
|
2008-11-05 16:10:46 +00:00
|
|
|
template(`userhelper_role_template',`
|
2006-01-18 16:40:04 +00:00
|
|
|
gen_require(`
|
2008-11-05 16:10:46 +00:00
|
|
|
attribute userhelper_type;
|
2006-01-18 16:40:04 +00:00
|
|
|
type userhelper_exec_t, userhelper_conf_t;
|
2010-08-26 13:41:21 +00:00
|
|
|
class dbus send_msg;
|
2006-01-18 16:40:04 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
2006-03-02 23:41:11 +00:00
|
|
|
|
2008-11-05 16:10:46 +00:00
|
|
|
type $1_userhelper_t, userhelper_type;
|
2008-07-23 21:38:39 +00:00
|
|
|
application_domain($1_userhelper_t, userhelper_exec_t)
|
2006-02-02 21:08:12 +00:00
|
|
|
domain_role_change_exemption($1_userhelper_t)
|
|
|
|
domain_obj_id_change_exemption($1_userhelper_t)
|
2006-02-20 21:33:25 +00:00
|
|
|
domain_interactive_fd($1_userhelper_t)
|
2006-02-02 21:08:12 +00:00
|
|
|
domain_subj_id_change_exemption($1_userhelper_t)
|
2008-11-05 16:10:46 +00:00
|
|
|
ubac_constrained($1_userhelper_t)
|
|
|
|
role $2 types $1_userhelper_t;
|
2008-10-17 15:52:39 +00:00
|
|
|
|
2006-01-18 16:40:04 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Local policy
|
|
|
|
#
|
|
|
|
allow $1_userhelper_t self:capability { setuid setgid net_bind_service dac_override chown sys_tty_config };
|
|
|
|
allow $1_userhelper_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
|
2006-12-12 20:08:08 +00:00
|
|
|
allow $1_userhelper_t self:process setexec;
|
2006-01-18 16:40:04 +00:00
|
|
|
allow $1_userhelper_t self:fd use;
|
2006-12-12 20:08:08 +00:00
|
|
|
allow $1_userhelper_t self:fifo_file rw_fifo_file_perms;
|
2006-01-18 16:40:04 +00:00
|
|
|
allow $1_userhelper_t self:shm create_shm_perms;
|
|
|
|
allow $1_userhelper_t self:sem create_sem_perms;
|
|
|
|
allow $1_userhelper_t self:msgq create_msgq_perms;
|
|
|
|
allow $1_userhelper_t self:msg { send receive };
|
|
|
|
allow $1_userhelper_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
allow $1_userhelper_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
allow $1_userhelper_t self:unix_dgram_socket sendto;
|
|
|
|
allow $1_userhelper_t self:unix_stream_socket connectto;
|
2006-12-12 20:08:08 +00:00
|
|
|
allow $1_userhelper_t self:sock_file read_sock_file_perms;
|
2006-01-18 16:40:04 +00:00
|
|
|
|
|
|
|
#Transition to the derived domain.
|
2008-11-05 16:10:46 +00:00
|
|
|
domtrans_pattern($3, userhelper_exec_t, $1_userhelper_t)
|
2006-01-18 16:40:04 +00:00
|
|
|
|
|
|
|
allow $1_userhelper_t userhelper_conf_t:dir rw_dir_perms;
|
2008-07-23 21:38:39 +00:00
|
|
|
rw_files_pattern($1_userhelper_t, userhelper_conf_t, userhelper_conf_t)
|
2006-01-18 16:40:04 +00:00
|
|
|
|
|
|
|
can_exec($1_userhelper_t, userhelper_exec_t)
|
|
|
|
|
2008-11-05 16:10:46 +00:00
|
|
|
dontaudit $3 $1_userhelper_t:process signal;
|
2008-10-17 15:52:39 +00:00
|
|
|
|
2006-01-31 16:49:43 +00:00
|
|
|
kernel_read_all_sysctls($1_userhelper_t)
|
2006-01-18 16:40:04 +00:00
|
|
|
kernel_getattr_debugfs($1_userhelper_t)
|
|
|
|
kernel_read_system_state($1_userhelper_t)
|
|
|
|
|
|
|
|
# Execute shells
|
|
|
|
corecmd_exec_shell($1_userhelper_t)
|
|
|
|
# By default, revert to the calling domain when a program is executed
|
2008-11-05 16:10:46 +00:00
|
|
|
corecmd_bin_domtrans($1_userhelper_t, $3)
|
2006-01-18 16:40:04 +00:00
|
|
|
|
|
|
|
# Inherit descriptors from the current session.
|
2006-02-20 21:33:25 +00:00
|
|
|
domain_use_interactive_fds($1_userhelper_t)
|
2006-01-18 16:40:04 +00:00
|
|
|
# for when the user types "exec userhelper" at the command line
|
2006-02-20 21:33:25 +00:00
|
|
|
domain_sigchld_interactive_fds($1_userhelper_t)
|
2006-01-18 16:40:04 +00:00
|
|
|
|
|
|
|
dev_read_urand($1_userhelper_t)
|
|
|
|
# Read /dev directories and any symbolic links.
|
|
|
|
dev_list_all_dev_nodes($1_userhelper_t)
|
|
|
|
|
|
|
|
files_list_var_lib($1_userhelper_t)
|
|
|
|
# Read the /etc/security/default_type file
|
|
|
|
files_read_etc_files($1_userhelper_t)
|
|
|
|
# Read /var.
|
|
|
|
files_read_var_files($1_userhelper_t)
|
2006-01-31 19:21:01 +00:00
|
|
|
files_read_var_symlinks($1_userhelper_t)
|
2006-01-18 16:40:04 +00:00
|
|
|
# for some PAM modules and for cwd
|
|
|
|
files_search_home($1_userhelper_t)
|
|
|
|
|
|
|
|
fs_search_auto_mountpoints($1_userhelper_t)
|
|
|
|
fs_read_nfs_files($1_userhelper_t)
|
|
|
|
fs_read_nfs_symlinks($1_userhelper_t)
|
|
|
|
|
|
|
|
# Allow $1_userhelper to obtain contexts to relabel TTYs
|
|
|
|
selinux_get_fs_mount($1_userhelper_t)
|
|
|
|
selinux_validate_context($1_userhelper_t)
|
|
|
|
selinux_compute_access_vector($1_userhelper_t)
|
|
|
|
selinux_compute_create_context($1_userhelper_t)
|
|
|
|
selinux_compute_relabel_context($1_userhelper_t)
|
|
|
|
selinux_compute_user_contexts($1_userhelper_t)
|
|
|
|
|
|
|
|
# Read the devpts root directory.
|
|
|
|
term_list_ptys($1_userhelper_t)
|
|
|
|
# Relabel terminals.
|
2010-02-11 19:20:10 +00:00
|
|
|
term_relabel_all_ttys($1_userhelper_t)
|
|
|
|
term_relabel_all_ptys($1_userhelper_t)
|
2006-01-18 16:40:04 +00:00
|
|
|
# Access terminals.
|
2010-02-11 19:20:10 +00:00
|
|
|
term_use_all_ttys($1_userhelper_t)
|
|
|
|
term_use_all_ptys($1_userhelper_t)
|
2006-01-18 16:40:04 +00:00
|
|
|
|
|
|
|
auth_domtrans_chk_passwd($1_userhelper_t)
|
|
|
|
auth_manage_pam_pid($1_userhelper_t)
|
|
|
|
auth_manage_var_auth($1_userhelper_t)
|
|
|
|
auth_search_pam_console_data($1_userhelper_t)
|
|
|
|
|
|
|
|
# Inherit descriptors from the current session.
|
2006-03-02 23:41:11 +00:00
|
|
|
init_use_fds($1_userhelper_t)
|
2006-01-18 16:40:04 +00:00
|
|
|
# Write to utmp.
|
|
|
|
init_manage_utmp($1_userhelper_t)
|
2008-11-05 16:10:46 +00:00
|
|
|
init_pid_filetrans_utmp($1_userhelper_t)
|
2006-01-18 16:40:04 +00:00
|
|
|
|
|
|
|
miscfiles_read_localization($1_userhelper_t)
|
|
|
|
|
|
|
|
seutil_read_config($1_userhelper_t)
|
|
|
|
seutil_read_default_contexts($1_userhelper_t)
|
|
|
|
|
|
|
|
# Allow $1_userhelper_t to transition to user domains.
|
|
|
|
userdom_bin_spec_domtrans_unpriv_users($1_userhelper_t)
|
|
|
|
userdom_entry_spec_domtrans_unpriv_users($1_userhelper_t)
|
|
|
|
|
|
|
|
ifdef(`distro_redhat',`
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-18 16:40:04 +00:00
|
|
|
# Allow transitioning to rpm_t, for up2date
|
|
|
|
rpm_domtrans($1_userhelper_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-18 16:40:04 +00:00
|
|
|
logging_send_syslog_msg($1_userhelper_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-18 16:40:04 +00:00
|
|
|
nis_use_ypbind($1_userhelper_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-02-02 21:08:12 +00:00
|
|
|
nscd_socket_use($1_userhelper_t)
|
2006-01-18 16:40:04 +00:00
|
|
|
')
|
2008-11-05 16:10:46 +00:00
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
tunable_policy(`! secure_mode',`
|
|
|
|
#if we are not in secure mode then we can transition to sysadm_t
|
|
|
|
sysadm_bin_spec_domtrans($1_userhelper_t)
|
|
|
|
sysadm_entry_spec_domtrans($1_userhelper_t)
|
|
|
|
')
|
|
|
|
')
|
2006-01-18 16:40:04 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
2006-01-19 21:04:33 +00:00
|
|
|
## Search the userhelper configuration directory.
|
2006-01-18 16:40:04 +00:00
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
2006-02-10 18:41:53 +00:00
|
|
|
## <summary>
|
2008-12-03 19:16:20 +00:00
|
|
|
## Domain allowed access.
|
2006-02-10 18:41:53 +00:00
|
|
|
## </summary>
|
2006-01-19 21:04:33 +00:00
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`userhelper_search_config',`
|
|
|
|
gen_require(`
|
|
|
|
type userhelper_conf_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
allow $1 userhelper_conf_t:dir search_dir_perms;
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
2010-07-08 14:56:15 +00:00
|
|
|
## Do not audit attempts to search
|
2006-01-19 21:04:33 +00:00
|
|
|
## the userhelper configuration directory.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
2006-02-10 18:41:53 +00:00
|
|
|
## <summary>
|
2008-12-03 19:16:20 +00:00
|
|
|
## Domain to not audit.
|
2006-02-10 18:41:53 +00:00
|
|
|
## </summary>
|
2006-01-18 16:40:04 +00:00
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`userhelper_dontaudit_search_config',`
|
|
|
|
gen_require(`
|
|
|
|
type userhelper_conf_t;
|
|
|
|
')
|
|
|
|
|
2006-01-19 21:04:33 +00:00
|
|
|
dontaudit $1 userhelper_conf_t:dir search_dir_perms;
|
2006-01-18 16:40:04 +00:00
|
|
|
')
|
2006-03-14 21:54:26 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Allow domain to use userhelper file descriptor.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
2008-12-03 19:16:20 +00:00
|
|
|
## Domain allowed access.
|
2006-03-14 21:54:26 +00:00
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
2008-11-05 16:10:46 +00:00
|
|
|
interface(`userhelper_use_fd',`
|
2006-03-14 21:54:26 +00:00
|
|
|
gen_require(`
|
2008-11-05 16:10:46 +00:00
|
|
|
attribute userhelper_type;
|
2006-03-14 21:54:26 +00:00
|
|
|
')
|
|
|
|
|
2008-11-05 16:10:46 +00:00
|
|
|
allow $1 userhelper_type:fd use;
|
2006-03-14 21:54:26 +00:00
|
|
|
')
|
2006-12-12 20:08:08 +00:00
|
|
|
|
2006-03-14 21:54:26 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Allow domain to send sigchld to userhelper.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
2008-12-03 19:16:20 +00:00
|
|
|
## Domain allowed access.
|
2006-03-14 21:54:26 +00:00
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
2008-11-05 16:10:46 +00:00
|
|
|
interface(`userhelper_sigchld',`
|
2006-03-14 21:54:26 +00:00
|
|
|
gen_require(`
|
2008-11-05 16:10:46 +00:00
|
|
|
attribute userhelper_type;
|
2006-03-14 21:54:26 +00:00
|
|
|
')
|
|
|
|
|
2008-11-05 16:10:46 +00:00
|
|
|
allow $1 userhelper_type:process sigchld;
|
2006-03-14 21:54:26 +00:00
|
|
|
')
|
2007-02-16 23:01:42 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Execute the userhelper program in the caller domain.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
2010-08-02 13:22:09 +00:00
|
|
|
## Domain allowed access.
|
2007-02-16 23:01:42 +00:00
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`userhelper_exec',`
|
|
|
|
gen_require(`
|
|
|
|
type userhelper_exec_t;
|
|
|
|
')
|
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
can_exec($1, userhelper_exec_t)
|
2007-02-16 23:01:42 +00:00
|
|
|
')
|
2010-08-26 13:41:21 +00:00
|
|
|
|
|
|
|
#######################################
|
|
|
|
## <summary>
|
|
|
|
## The role template for the consolehelper module.
|
|
|
|
## </summary>
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## This template creates a derived domains which are used
|
|
|
|
## for consolehelper applications.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
|
|
|
## <param name="role_prefix">
|
|
|
|
## <summary>
|
|
|
|
## The prefix of the user domain (e.g., user
|
|
|
|
## is the prefix for user_t).
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
## <param name="user_role">
|
|
|
|
## <summary>
|
|
|
|
## The role associated with the user domain.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
## <param name="user_domain">
|
|
|
|
## <summary>
|
|
|
|
## The type of the user domain.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
template(`userhelper_console_role_template',`
|
|
|
|
gen_require(`
|
|
|
|
type consolehelper_exec_t;
|
|
|
|
attribute consolehelper_domain;
|
|
|
|
class dbus send_msg;
|
|
|
|
')
|
|
|
|
type $1_consolehelper_t, consolehelper_domain;
|
|
|
|
domain_type($1_consolehelper_t)
|
|
|
|
domain_entry_file($1_consolehelper_t, consolehelper_exec_t)
|
|
|
|
role $2 types $1_consolehelper_t;
|
|
|
|
|
|
|
|
domtrans_pattern($3, consolehelper_exec_t, $1_consolehelper_t)
|
|
|
|
|
|
|
|
allow $3 $1_consolehelper_t:dbus send_msg;
|
|
|
|
allow $1_consolehelper_t $3:dbus send_msg;
|
|
|
|
|
|
|
|
auth_use_pam($1_consolehelper_t)
|
|
|
|
|
2010-09-23 21:31:09 +00:00
|
|
|
userdom_manage_tmpfs_role($2, $1_consolehelper_t)
|
2010-09-23 19:14:34 +00:00
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
optional_policy(`
|
|
|
|
shutdown_run($1_consolehelper_t, $2)
|
|
|
|
shutdown_send_sigchld($3)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
2010-09-23 19:14:34 +00:00
|
|
|
xserver_run_xauth($1_consolehelper_t, $2)
|
2010-08-26 13:41:21 +00:00
|
|
|
xserver_read_xdm_pid($1_consolehelper_t)
|
|
|
|
')
|
|
|
|
')
|