selinux-policy/policy/modules/admin/rpm.te

359 lines
10 KiB
Plaintext
Raw Normal View History

2005-05-23 17:56:47 +00:00
policy_module(rpm,1.8.0)
2005-05-23 17:56:47 +00:00
########################################
#
# Declarations
#
2005-11-18 16:12:30 +00:00
type rpm_t;
2005-05-23 17:56:47 +00:00
type rpm_exec_t;
2005-06-13 17:35:46 +00:00
init_system_domain(rpm_t,rpm_exec_t)
2006-02-02 21:08:12 +00:00
domain_obj_id_change_exemption(rpm_t)
domain_role_change_exemption(rpm_t)
domain_system_change_exemption(rpm_t)
2006-02-20 21:33:25 +00:00
domain_interactive_fd(rpm_t)
2005-05-23 17:56:47 +00:00
role system_r types rpm_t;
type rpm_file_t;
files_type(rpm_file_t)
2005-05-23 17:56:47 +00:00
type rpm_tmp_t;
2005-06-13 17:35:46 +00:00
files_tmp_file(rpm_tmp_t)
2005-05-23 17:56:47 +00:00
type rpm_tmpfs_t;
2005-06-13 17:35:46 +00:00
files_tmpfs_file(rpm_tmpfs_t)
2005-05-23 17:56:47 +00:00
type rpm_log_t;
2005-06-13 17:35:46 +00:00
logging_log_file(rpm_log_t)
2005-05-23 17:56:47 +00:00
type rpm_var_lib_t;
files_type(rpm_var_lib_t)
2005-05-23 17:56:47 +00:00
typealias rpm_var_lib_t alias var_lib_rpm_t;
2005-09-20 20:48:17 +00:00
type rpm_script_t;
2005-05-23 17:56:47 +00:00
type rpm_script_exec_t;
2006-02-02 21:08:12 +00:00
domain_obj_id_change_exemption(rpm_script_t)
domain_system_change_exemption(rpm_script_t)
2005-06-13 17:35:46 +00:00
corecmd_shell_entry_type(rpm_script_t)
domain_type(rpm_script_t)
domain_entry_file(rpm_t,rpm_script_exec_t)
2006-02-20 21:33:25 +00:00
domain_interactive_fd(rpm_script_t)
2005-05-23 17:56:47 +00:00
role system_r types rpm_script_t;
type rpm_script_tmp_t;
2005-06-13 17:35:46 +00:00
files_tmp_file(rpm_script_tmp_t)
2005-05-23 17:56:47 +00:00
type rpm_script_tmpfs_t;
2005-06-13 17:35:46 +00:00
files_tmpfs_file(rpm_script_tmpfs_t)
2005-05-23 17:56:47 +00:00
########################################
#
# rpm Local policy
#
2005-09-01 20:13:42 +00:00
allow rpm_t self:capability { chown dac_override fowner fsetid setgid setuid sys_chroot sys_tty_config mknod };
allow rpm_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
2005-05-23 17:56:47 +00:00
allow rpm_t self:process { getattr setexec setfscreate setrlimit };
allow rpm_t self:fd use;
2006-12-12 20:08:08 +00:00
allow rpm_t self:fifo_file rw_fifo_file_perms;
2005-06-09 17:21:52 +00:00
allow rpm_t self:unix_dgram_socket create_socket_perms;
allow rpm_t self:unix_stream_socket rw_stream_socket_perms;
2005-05-23 17:56:47 +00:00
allow rpm_t self:unix_dgram_socket sendto;
allow rpm_t self:unix_stream_socket connectto;
allow rpm_t self:udp_socket { connect };
2005-06-09 17:21:52 +00:00
allow rpm_t self:udp_socket create_socket_perms;
2005-06-10 01:01:13 +00:00
allow rpm_t self:tcp_socket create_stream_socket_perms;
2005-06-09 17:21:52 +00:00
allow rpm_t self:shm create_shm_perms;
allow rpm_t self:sem create_sem_perms;
allow rpm_t self:msgq create_msgq_perms;
2005-05-23 17:56:47 +00:00
allow rpm_t self:msg { send receive };
allow rpm_t self:dir search;
2005-06-09 17:21:52 +00:00
allow rpm_t self:file rw_file_perms;;
2005-05-23 17:56:47 +00:00
allow rpm_t rpm_log_t:file manage_file_perms;
logging_log_filetrans(rpm_t,rpm_log_t,file)
2006-12-12 20:08:08 +00:00
manage_dirs_pattern(rpm_t,rpm_tmp_t,rpm_tmp_t)
manage_files_pattern(rpm_t,rpm_tmp_t,rpm_tmp_t)
2006-02-21 18:40:44 +00:00
files_tmp_filetrans(rpm_t, rpm_tmp_t, { file dir })
2005-05-23 17:56:47 +00:00
2006-12-12 20:08:08 +00:00
manage_dirs_pattern(rpm_t,rpm_tmpfs_t,rpm_tmpfs_t)
manage_files_pattern(rpm_t,rpm_tmpfs_t,rpm_tmpfs_t)
manage_lnk_files_pattern(rpm_t,rpm_tmpfs_t,rpm_tmpfs_t)
manage_fifo_files_pattern(rpm_t,rpm_tmpfs_t,rpm_tmpfs_t)
manage_sock_files_pattern(rpm_t,rpm_tmpfs_t,rpm_tmpfs_t)
2006-02-21 18:40:44 +00:00
fs_tmpfs_filetrans(rpm_t,rpm_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
2005-05-23 17:56:47 +00:00
# Access /var/lib/rpm files
2006-12-12 20:08:08 +00:00
manage_files_pattern(rpm_t,rpm_var_lib_t,rpm_var_lib_t)
2006-02-21 18:40:44 +00:00
files_var_lib_filetrans(rpm_t,rpm_var_lib_t,dir)
2005-05-23 17:56:47 +00:00
kernel_read_system_state(rpm_t)
kernel_read_kernel_sysctls(rpm_t)
2005-06-29 20:53:53 +00:00
corecmd_exec_all_executables(rpm_t)
corenet_all_recvfrom_unlabeled(rpm_t)
corenet_all_recvfrom_netlabel(rpm_t)
2005-06-10 01:01:13 +00:00
corenet_tcp_sendrecv_all_if(rpm_t)
corenet_raw_sendrecv_all_if(rpm_t)
corenet_udp_sendrecv_all_if(rpm_t)
corenet_tcp_sendrecv_all_nodes(rpm_t)
corenet_raw_sendrecv_all_nodes(rpm_t)
corenet_udp_sendrecv_all_nodes(rpm_t)
corenet_tcp_sendrecv_all_ports(rpm_t)
corenet_udp_sendrecv_all_ports(rpm_t)
corenet_tcp_connect_all_ports(rpm_t)
2006-05-29 19:53:43 +00:00
corenet_sendrecv_all_client_packets(rpm_t)
2005-05-23 17:56:47 +00:00
2005-07-12 20:34:24 +00:00
dev_list_sysfs(rpm_t)
dev_list_usbfs(rpm_t)
2005-06-13 16:22:32 +00:00
dev_read_urand(rpm_t)
2005-05-23 17:56:47 +00:00
#devices_manage_all_device_types(rpm_t)
2005-09-20 20:48:17 +00:00
fs_manage_nfs_dirs(rpm_t)
2005-06-27 16:30:55 +00:00
fs_manage_nfs_files(rpm_t)
fs_manage_nfs_symlinks(rpm_t)
2005-06-10 01:01:13 +00:00
fs_getattr_all_fs(rpm_t)
2005-06-27 16:30:55 +00:00
fs_search_auto_mountpoints(rpm_t)
2005-05-23 17:56:47 +00:00
mls_file_read_all_levels(rpm_t)
mls_file_write_all_levels(rpm_t)
2006-01-06 22:51:40 +00:00
mls_file_upgrade(rpm_t)
mls_file_downgrade(rpm_t)
2006-01-06 22:51:40 +00:00
2005-07-12 20:34:24 +00:00
selinux_get_fs_mount(rpm_t)
selinux_validate_context(rpm_t)
selinux_compute_access_vector(rpm_t)
selinux_compute_create_context(rpm_t)
selinux_compute_relabel_context(rpm_t)
selinux_compute_user_contexts(rpm_t)
2005-05-23 17:56:47 +00:00
storage_raw_write_fixed_disk(rpm_t)
# for installing kernel packages
storage_raw_read_fixed_disk(rpm_t)
2005-06-10 01:01:13 +00:00
term_list_ptys(rpm_t)
2005-05-23 17:56:47 +00:00
2005-06-29 20:53:53 +00:00
auth_relabel_all_files_except_shadow(rpm_t)
auth_manage_all_files_except_shadow(rpm_t)
2005-06-13 17:35:46 +00:00
auth_dontaudit_read_shadow(rpm_t)
auth_use_nsswitch(rpm_t)
2005-05-23 17:56:47 +00:00
2005-11-18 16:12:30 +00:00
# transition to rpm script:
2006-02-02 21:08:12 +00:00
rpm_domtrans_script(rpm_t)
2005-05-23 17:56:47 +00:00
2005-06-13 17:35:46 +00:00
domain_read_all_domains_state(rpm_t)
2005-09-16 14:54:36 +00:00
domain_getattr_all_domains(rpm_t)
domain_dontaudit_ptrace_all_domains(rpm_t)
2006-02-20 21:33:25 +00:00
domain_use_interactive_fds(rpm_t)
2005-11-25 19:38:45 +00:00
domain_dontaudit_getattr_all_pipes(rpm_t)
domain_dontaudit_getattr_all_tcp_sockets(rpm_t)
domain_dontaudit_getattr_all_udp_sockets(rpm_t)
domain_dontaudit_getattr_all_packet_sockets(rpm_t)
domain_dontaudit_getattr_all_raw_sockets(rpm_t)
domain_dontaudit_getattr_all_stream_sockets(rpm_t)
domain_dontaudit_getattr_all_dgram_sockets(rpm_t)
2005-05-23 17:56:47 +00:00
files_exec_etc_files(rpm_t)
2005-05-23 17:56:47 +00:00
2005-06-13 17:35:46 +00:00
init_domtrans_script(rpm_t)
2005-05-23 17:56:47 +00:00
2005-06-13 17:35:46 +00:00
libs_use_ld_so(rpm_t)
libs_use_shared_libs(rpm_t)
libs_exec_ld_so(rpm_t)
libs_exec_lib_files(rpm_t)
libs_domtrans_ldconfig(rpm_t)
2005-05-23 17:56:47 +00:00
2005-06-13 17:35:46 +00:00
logging_send_syslog_msg(rpm_t)
2005-05-23 17:56:47 +00:00
# allow compiling and loading new policy
2006-02-02 21:08:12 +00:00
seutil_manage_src_policy(rpm_t)
seutil_manage_bin_policy(rpm_t)
2005-05-23 17:56:47 +00:00
2006-02-21 18:40:44 +00:00
userdom_use_unpriv_users_fds(rpm_t)
2005-05-23 17:56:47 +00:00
optional_policy(`
cron_system_entry(rpm_t,rpm_exec_t)
')
optional_policy(`
hal_dbus_chat(rpm_t)
2005-06-28 17:32:57 +00:00
')
2005-05-23 17:56:47 +00:00
optional_policy(`
prelink_domtrans(rpm_t)
')
optional_policy(`
unconfined_domain(rpm_t)
# yum-updatesd requires this
unconfined_dbus_chat(rpm_t)
')
2005-05-23 17:56:47 +00:00
ifdef(`TODO',`
# read/write/create any files in the system
dontaudit rpm_t domain:{ socket unix_dgram_socket udp_socket unix_stream_socket tcp_socket fifo_file rawip_socket packet_socket } getattr;
allow rpm_t ttyfile:chr_file unlink;
# needs rw permission to the directory for an rpm package that includes a mount
# point
allow rpm_t fs_type:dir { setattr rw_dir_perms };
allow rpm_t mount_t:tcp_socket write;
allow rpm_t rpc_pipefs_t:dir search;
optional_policy(`
2005-05-23 17:56:47 +00:00
allow rpm_t sysadm_gph_t:fd use;
')
') dnl endif TODO
########################################
#
# rpm-script Local policy
#
allow rpm_script_t self:capability { chown dac_override dac_read_search fowner fsetid setgid setuid ipc_lock sys_chroot sys_nice mknod kill };
2005-09-01 20:13:42 +00:00
allow rpm_script_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
2005-05-23 17:56:47 +00:00
allow rpm_script_t self:fd use;
2006-12-12 20:08:08 +00:00
allow rpm_script_t self:fifo_file rw_fifo_file_perms;
2005-06-09 17:21:52 +00:00
allow rpm_script_t self:unix_dgram_socket create_socket_perms;
allow rpm_script_t self:unix_stream_socket rw_stream_socket_perms;
2005-05-23 17:56:47 +00:00
allow rpm_script_t self:unix_dgram_socket sendto;
allow rpm_script_t self:unix_stream_socket connectto;
2005-06-09 17:21:52 +00:00
allow rpm_script_t self:shm create_shm_perms;
allow rpm_script_t self:sem create_sem_perms;
allow rpm_script_t self:msgq create_msgq_perms;
2005-05-23 17:56:47 +00:00
allow rpm_script_t self:msg { send receive };
2006-12-12 20:08:08 +00:00
allow rpm_script_t rpm_tmp_t:file read_file_perms;
2005-05-23 17:56:47 +00:00
allow rpm_script_t rpm_script_tmp_t:dir mounton;
2006-12-12 20:08:08 +00:00
manage_dirs_pattern(rpm_script_t,rpm_script_tmp_t,rpm_script_tmp_t)
manage_files_pattern(rpm_script_t,rpm_script_tmp_t,rpm_script_tmp_t)
2006-02-21 18:40:44 +00:00
files_tmp_filetrans(rpm_script_t, rpm_script_tmp_t, { file dir })
2005-05-23 17:56:47 +00:00
2006-12-12 20:08:08 +00:00
manage_dirs_pattern(rpm_script_t,rpm_script_tmpfs_t,rpm_script_tmpfs_t)
manage_files_pattern(rpm_script_t,rpm_script_tmpfs_t,rpm_script_tmpfs_t)
manage_lnk_files_pattern(rpm_script_t,rpm_script_tmpfs_t,rpm_script_tmpfs_t)
manage_fifo_files_pattern(rpm_script_t,rpm_script_tmpfs_t,rpm_script_tmpfs_t)
manage_sock_files_pattern(rpm_script_t,rpm_script_tmpfs_t,rpm_script_tmpfs_t)
2006-02-21 18:40:44 +00:00
fs_tmpfs_filetrans(rpm_script_t,rpm_script_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
2005-05-23 17:56:47 +00:00
kernel_read_kernel_sysctls(rpm_script_t)
2005-05-23 17:56:47 +00:00
kernel_read_system_state(rpm_script_t)
2005-07-12 20:34:24 +00:00
dev_list_sysfs(rpm_script_t)
2005-05-27 21:56:01 +00:00
# ideally we would not need this
dev_manage_generic_blk_files(rpm_script_t)
dev_manage_generic_chr_files(rpm_script_t)
2005-06-13 16:22:32 +00:00
dev_manage_all_blk_files(rpm_script_t)
dev_manage_all_chr_files(rpm_script_t)
2005-05-27 21:56:01 +00:00
2005-06-08 13:12:00 +00:00
fs_manage_nfs_files(rpm_script_t)
2005-06-10 01:01:13 +00:00
fs_getattr_nfs(rpm_script_t)
2005-05-23 17:56:47 +00:00
# why is this not using mount?
2005-06-10 01:01:13 +00:00
fs_getattr_xattr_fs(rpm_script_t)
fs_mount_xattr_fs(rpm_script_t)
fs_unmount_xattr_fs(rpm_script_t)
2005-06-27 16:30:55 +00:00
fs_search_auto_mountpoints(rpm_script_t)
2005-05-23 17:56:47 +00:00
mcs_killall(rpm_script_t)
mcs_ptrace_all(rpm_script_t)
mls_file_read_all_levels(rpm_script_t)
mls_file_write_all_levels(rpm_script_t)
2006-01-06 22:51:40 +00:00
2005-07-12 20:34:24 +00:00
selinux_get_fs_mount(rpm_script_t)
selinux_validate_context(rpm_script_t)
selinux_compute_access_vector(rpm_script_t)
selinux_compute_create_context(rpm_script_t)
selinux_compute_relabel_context(rpm_script_t)
selinux_compute_user_contexts(rpm_script_t)
2005-05-23 17:56:47 +00:00
storage_raw_read_fixed_disk(rpm_script_t)
storage_raw_write_fixed_disk(rpm_script_t)
2005-06-10 01:01:13 +00:00
term_getattr_unallocated_ttys(rpm_script_t)
term_list_ptys(rpm_script_t)
term_use_all_terms(rpm_script_t)
2005-05-23 17:56:47 +00:00
2005-06-13 17:35:46 +00:00
auth_dontaudit_getattr_shadow(rpm_script_t)
auth_use_nsswitch(rpm_script_t)
2005-05-25 20:58:21 +00:00
# ideally we would not need this
2005-06-13 17:35:46 +00:00
auth_manage_all_files_except_shadow(rpm_script_t)
2005-05-23 17:56:47 +00:00
corecmd_exec_all_executables(rpm_script_t)
2005-05-23 17:56:47 +00:00
2005-06-13 17:35:46 +00:00
domain_read_all_domains_state(rpm_script_t)
2005-09-16 14:54:36 +00:00
domain_getattr_all_domains(rpm_script_t)
domain_dontaudit_ptrace_all_domains(rpm_script_t)
2006-02-20 21:33:25 +00:00
domain_use_interactive_fds(rpm_script_t)
2005-05-23 17:56:47 +00:00
domain_signal_all_domains(rpm_script_t)
domain_signull_all_domains(rpm_script_t)
files_exec_etc_files(rpm_script_t)
2005-06-13 17:35:46 +00:00
files_read_etc_runtime_files(rpm_script_t)
2005-06-29 20:53:53 +00:00
files_exec_usr_files(rpm_script_t)
2005-05-23 17:56:47 +00:00
2005-06-13 17:35:46 +00:00
init_domtrans_script(rpm_script_t)
2005-05-23 17:56:47 +00:00
2005-06-13 17:35:46 +00:00
libs_use_ld_so(rpm_script_t)
libs_use_shared_libs(rpm_script_t)
libs_exec_ld_so(rpm_script_t)
libs_exec_lib_files(rpm_script_t)
libs_domtrans_ldconfig(rpm_script_t)
2005-05-23 17:56:47 +00:00
2005-06-13 17:35:46 +00:00
logging_send_syslog_msg(rpm_script_t)
2005-05-23 17:56:47 +00:00
miscfiles_read_localization(rpm_script_t)
2005-06-13 17:35:46 +00:00
modutils_domtrans_depmod(rpm_script_t)
modutils_domtrans_insmod(rpm_script_t)
2005-05-23 17:56:47 +00:00
2006-02-02 21:08:12 +00:00
seutil_domtrans_loadpolicy(rpm_script_t)
2007-05-11 17:10:43 +00:00
seutil_domtrans_setfiles(rpm_script_t)
seutil_domtrans_semanage(rpm_script_t)
2005-05-23 17:56:47 +00:00
2006-02-20 21:33:25 +00:00
userdom_use_all_users_fds(rpm_script_t)
2005-05-23 17:56:47 +00:00
2006-01-06 22:51:40 +00:00
ifdef(`distro_redhat',`
optional_policy(`
2006-01-06 22:51:40 +00:00
mta_send_mail(rpm_script_t)
')
')
2005-09-20 20:48:17 +00:00
tunable_policy(`allow_execmem',`
allow rpm_script_t self:process execmem;
')
optional_policy(`
bootloader_domtrans(rpm_script_t)
')
optional_policy(`
tzdata_domtrans(rpm_t)
tzdata_domtrans(rpm_script_t)
')
optional_policy(`
unconfined_domain(rpm_script_t)
unconfined_domtrans(rpm_script_t)
optional_policy(`
java_domtrans(rpm_script_t)
')
optional_policy(`
mono_domtrans(rpm_script_t)
')
')
optional_policy(`
2005-07-12 20:34:24 +00:00
usermanage_domtrans_groupadd(rpm_script_t)
usermanage_domtrans_useradd(rpm_script_t)
')