2005-04-20 19:07:16 +00:00
|
|
|
|
2005-04-26 17:00:25 +00:00
|
|
|
policy_module(modutils,1.0)
|
|
|
|
|
2005-05-11 15:46:51 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
# module loading config
|
|
|
|
type modules_conf_t;
|
|
|
|
files_make_file(modules_conf_t)
|
|
|
|
|
|
|
|
# module dependencies
|
|
|
|
type modules_dep_t;
|
|
|
|
files_make_file(modules_dep_t)
|
|
|
|
|
|
|
|
type insmod_t;
|
|
|
|
type insmod_exec_t;
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_userland_entry(insmod_t,insmod_exec_t)
|
2005-05-13 20:21:50 +00:00
|
|
|
init_make_system_domain(insmod_t,insmod_exec_t)
|
2005-05-05 18:30:00 +00:00
|
|
|
role system_r types insmod_t;
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-04-20 21:00:01 +00:00
|
|
|
type depmod_t;
|
|
|
|
type depmod_exec_t;
|
2005-05-13 20:21:50 +00:00
|
|
|
init_make_system_domain(depmod_t,depmod_exec_t)
|
2005-05-05 18:30:00 +00:00
|
|
|
role system_r types depmod_t;
|
2005-04-20 21:00:01 +00:00
|
|
|
|
|
|
|
type update_modules_t;
|
|
|
|
type update_modules_exec_t;
|
2005-05-13 20:21:50 +00:00
|
|
|
init_make_system_domain(update_modules_t,update_modules_exec_t)
|
2005-05-05 18:30:00 +00:00
|
|
|
role system_r types update_modules_t;
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-04-21 22:46:49 +00:00
|
|
|
type update_modules_tmp_t;
|
2005-05-11 19:21:40 +00:00
|
|
|
files_make_temporary_file(update_modules_tmp_t)
|
2005-04-21 22:46:49 +00:00
|
|
|
|
2005-04-20 21:00:01 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# insmod local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow insmod_t self:capability { dac_override net_raw sys_tty_config };
|
|
|
|
allow insmod_t self:process { execmem sigchld sigkill sigstop signull signal };
|
|
|
|
|
2005-06-09 14:26:05 +00:00
|
|
|
allow insmod_t self:udp_socket create_socket_perms;
|
|
|
|
allow insmod_t self:rawip_socket create_socket_perms;
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-05-11 15:22:28 +00:00
|
|
|
# Read module config and dependency information
|
2005-06-09 14:26:05 +00:00
|
|
|
allow insmod_t { modules_conf_t modules_dep_t }:file r_file_perms;
|
2005-05-11 15:22:28 +00:00
|
|
|
|
2005-06-09 14:26:05 +00:00
|
|
|
can_exec(insmod_t, insmod_exec_t)
|
2005-05-11 15:22:28 +00:00
|
|
|
|
2005-04-20 21:00:01 +00:00
|
|
|
kernel_load_module(insmod_t)
|
2005-05-26 20:38:45 +00:00
|
|
|
kernel_read_system_state(insmod_t)
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_search_sysfs(insmod_t)
|
|
|
|
kernel_search_usbfs(insmod_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
# Rules for /proc/sys/kernel/tainted
|
|
|
|
kernel_read_kernel_sysctl(insmod_t)
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_rw_kernel_sysctl(insmod_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
kernel_read_hotplug_sysctl(insmod_t)
|
|
|
|
|
2005-04-25 21:32:09 +00:00
|
|
|
bootloader_read_kernel_modules(insmod_t)
|
2005-05-26 20:38:45 +00:00
|
|
|
# for locking: (cjp: ????)
|
|
|
|
bootloader_write_kernel_modules(insmod_t)
|
2005-04-25 21:32:09 +00:00
|
|
|
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_write_mtrr(insmod_t)
|
|
|
|
dev_read_urand(insmod_t)
|
|
|
|
dev_rw_agp_dev(insmod_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
fs_getattr_xattr_fs(insmod_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-05-30 21:17:20 +00:00
|
|
|
corecommands_execute_general_programs(insmod_t)
|
|
|
|
corecommands_execute_system_programs(insmod_t)
|
|
|
|
corecommands_execute_shell(insmod_t)
|
|
|
|
|
|
|
|
domain_signal_all_domains(insmod_t)
|
|
|
|
domain_use_widely_inheritable_file_descriptors(insmod_t)
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
files_read_runtime_system_config(insmod_t)
|
|
|
|
files_read_general_system_config(insmod_t)
|
2005-05-03 20:23:33 +00:00
|
|
|
files_read_general_application_resources(insmod_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
files_execute_system_config_script(insmod_t)
|
2005-05-31 21:25:45 +00:00
|
|
|
# for nscd:
|
2005-05-24 15:55:57 +00:00
|
|
|
files_ignore_search_runtime_data_directory(insmod_t)
|
2005-05-31 21:25:45 +00:00
|
|
|
# for when /var is not mounted early in the boot:
|
|
|
|
files_ignore_search_isid_type_dir(insmod_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-05-26 20:38:45 +00:00
|
|
|
init_use_control_channel(insmod_t)
|
2005-05-03 20:44:35 +00:00
|
|
|
init_use_file_descriptors(insmod_t)
|
|
|
|
init_script_use_file_descriptors(insmod_t)
|
|
|
|
init_script_use_pseudoterminal(insmod_t)
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
libraries_use_dynamic_loader(insmod_t)
|
2005-05-17 15:32:52 +00:00
|
|
|
libraries_use_shared_libraries(insmod_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-05-30 21:17:20 +00:00
|
|
|
logging_send_system_log_message(insmod_t)
|
|
|
|
logging_search_system_log_directory(insmod_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
miscfiles_read_localization(insmod_t)
|
|
|
|
|
2005-05-02 19:22:58 +00:00
|
|
|
optional_policy(`mount.te',`
|
2005-06-03 12:25:14 +00:00
|
|
|
mount_transition(insmod_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
')
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-05-03 20:44:35 +00:00
|
|
|
ifdef(`TODO',`
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
allow insmod_t apm_bios_t:chr_file { read write };
|
|
|
|
|
|
|
|
allow insmod_t sound_device_t:chr_file { read ioctl write };
|
|
|
|
|
|
|
|
ifdef(`xserver.te', `
|
2005-06-03 12:25:14 +00:00
|
|
|
allow insmod_t xserver_log_t:file getattr;
|
2005-04-14 20:18:17 +00:00
|
|
|
')
|
|
|
|
|
2005-05-30 21:17:20 +00:00
|
|
|
# why is this needed? insmod cannot mounton any dir
|
|
|
|
# and it also transitions to mount
|
2005-04-20 21:00:01 +00:00
|
|
|
allow insmod_t usbfs_t:filesystem mount;
|
2005-05-03 20:44:35 +00:00
|
|
|
') dnl if TODO
|
2005-04-20 21:00:01 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# depmod local policy
|
|
|
|
#
|
|
|
|
|
2005-06-09 14:26:05 +00:00
|
|
|
can_exec(depmod_t, depmod_exec_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
|
|
|
# Read conf.modules.
|
2005-06-09 14:26:05 +00:00
|
|
|
allow depmod_t modules_conf_t:file r_file_perms;
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-06-09 14:26:05 +00:00
|
|
|
allow depmod_t modules_dep_t:file create_file_perms;
|
2005-05-03 20:44:35 +00:00
|
|
|
bootloader_create_private_module_dir_entry(depmod_t,modules_dep_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
|
|
|
kernel_read_system_state(depmod_t)
|
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
fs_getattr_xattr_fs(depmod_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
term_use_console(depmod_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
|
|
|
bootloader_read_kernel_symbol_table(depmod_t)
|
2005-04-25 21:32:09 +00:00
|
|
|
bootloader_read_kernel_modules(depmod_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-05-03 20:44:35 +00:00
|
|
|
init_use_file_descriptors(depmod_t)
|
|
|
|
init_script_use_file_descriptors(depmod_t)
|
|
|
|
init_script_use_pseudoterminal(depmod_t)
|
|
|
|
|
|
|
|
domain_use_widely_inheritable_file_descriptors(depmod_t)
|
|
|
|
|
2005-04-20 21:00:01 +00:00
|
|
|
files_read_runtime_system_config(depmod_t)
|
|
|
|
files_read_general_system_config(depmod_t)
|
2005-05-03 20:44:35 +00:00
|
|
|
files_read_system_source_code(depmod_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
|
|
|
libraries_use_dynamic_loader(depmod_t)
|
2005-05-17 15:32:52 +00:00
|
|
|
libraries_use_shared_libraries(depmod_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
|
|
|
ifdef(`TODO',`
|
|
|
|
|
|
|
|
allow depmod_t { bin_t sbin_t }:dir search;
|
|
|
|
|
|
|
|
ifdef(`gnome-pty-helper.te', `allow depmod_t sysadm_gph_t:fd use;')
|
|
|
|
|
|
|
|
# Read System.map from home directories.
|
|
|
|
allow depmod_t { home_root_t staff_home_dir_t sysadm_home_dir_t }:dir r_dir_perms;
|
|
|
|
r_dir_file(depmod_t, { staff_home_t sysadm_home_t })
|
|
|
|
') dnl end ifdef TODO
|
|
|
|
|
|
|
|
#################################
|
|
|
|
#
|
|
|
|
# update-modules local policy
|
|
|
|
#
|
|
|
|
|
2005-06-09 14:26:05 +00:00
|
|
|
allow update_modules_t self:fifo_file rw_file_perms;
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-06-09 14:26:05 +00:00
|
|
|
allow update_modules_t modules_dep_t:file rw_file_perms;
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-06-09 14:26:05 +00:00
|
|
|
can_exec(update_modules_t, insmod_exec_t)
|
|
|
|
can_exec(update_modules_t, update_modules_exec_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-05-03 20:44:35 +00:00
|
|
|
# manage module loading configuration
|
2005-06-09 14:26:05 +00:00
|
|
|
allow update_modules_t modules_conf_t:file create_file_perms;
|
2005-05-03 20:44:35 +00:00
|
|
|
bootloader_create_private_module_dir_entry(update_modules_t,modules_conf_t)
|
|
|
|
files_create_private_config(update_modules_t,modules_conf_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-05-03 20:44:35 +00:00
|
|
|
# transition to depmod
|
2005-06-09 14:26:05 +00:00
|
|
|
domain_auto_trans(update_modules_t, depmod_exec_t, depmod_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-06-09 14:26:05 +00:00
|
|
|
allow update_modules_t update_modules_tmp_t:dir create_dir_perms;
|
|
|
|
allow update_modules_t update_modules_tmp_t:file create_file_perms;
|
2005-05-11 15:22:28 +00:00
|
|
|
files_create_private_tmp_data(update_modules_t, update_modules_tmp_t, { file dir })
|
2005-04-25 21:44:48 +00:00
|
|
|
|
2005-04-20 21:00:01 +00:00
|
|
|
kernel_read_kernel_sysctl(update_modules_t)
|
|
|
|
kernel_read_system_state(update_modules_t)
|
|
|
|
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_read_urand(update_modules_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
fs_getattr_xattr_fs(update_modules_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
term_use_console(update_modules_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-05-03 20:44:35 +00:00
|
|
|
init_use_file_descriptors(depmod_t)
|
|
|
|
init_script_use_file_descriptors(depmod_t)
|
|
|
|
init_script_use_pseudoterminal(depmod_t)
|
|
|
|
|
|
|
|
domain_use_widely_inheritable_file_descriptors(depmod_t)
|
|
|
|
|
2005-04-20 21:00:01 +00:00
|
|
|
files_read_runtime_system_config(update_modules_t)
|
|
|
|
files_read_general_system_config(update_modules_t)
|
2005-04-21 21:35:45 +00:00
|
|
|
files_execute_system_config_script(update_modules_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
2005-04-21 21:35:45 +00:00
|
|
|
corecommands_execute_general_programs(update_modules_t)
|
|
|
|
corecommands_execute_system_programs(update_modules_t)
|
|
|
|
corecommands_execute_shell(update_modules_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
|
|
|
libraries_use_dynamic_loader(update_modules_t)
|
2005-05-17 15:32:52 +00:00
|
|
|
libraries_use_shared_libraries(update_modules_t)
|
2005-04-20 21:00:01 +00:00
|
|
|
|
|
|
|
logging_send_system_log_message(update_modules_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(update_modules_t)
|
|
|
|
|
|
|
|
ifdef(`TODO',`
|
|
|
|
dontaudit update_modules_t sysadm_home_dir_t:dir search;
|
|
|
|
') dnl endif TODO
|