Chris PeBenito e181fe
# Copyright (C) 2005 Tresys Technology, LLC
Chris PeBenito e181fe
Chris PeBenito 960373
policy_module(modutils,1.0)
Chris PeBenito 960373
Chris PeBenito 118186
########################################
Chris PeBenito 118186
#
Chris PeBenito 118186
# Declarations
Chris PeBenito 118186
#
Chris PeBenito 118186
Chris PeBenito b4cd15
# module loading config
Chris PeBenito b4cd15
type modules_conf_t;
Chris PeBenito b4cd15
files_make_file(modules_conf_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
# module dependencies
Chris PeBenito b4cd15
type modules_dep_t;
Chris PeBenito b4cd15
files_make_file(modules_dep_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
type insmod_t;
Chris PeBenito b4cd15
type insmod_exec_t;
Chris PeBenito ff3138
kernel_make_userland_entrypoint(insmod_t,insmod_exec_t)
Chris PeBenito ff3138
init_make_system_domain(insmod_t,insmod_exec_t)
Chris PeBenito bbd6a6
role system_r types insmod_t;
Chris PeBenito b4cd15
Chris PeBenito 7c5d78
type depmod_t;
Chris PeBenito 7c5d78
type depmod_exec_t;
Chris PeBenito ff3138
init_make_system_domain(depmod_t,depmod_exec_t)
Chris PeBenito bbd6a6
role system_r types depmod_t;
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
type update_modules_t;
Chris PeBenito 7c5d78
type update_modules_exec_t;
Chris PeBenito ff3138
init_make_system_domain(update_modules_t,update_modules_exec_t)
Chris PeBenito bbd6a6
role system_r types update_modules_t;
Chris PeBenito 7c5d78
Chris PeBenito 33bc0d
type update_modules_tmp_t;
Chris PeBenito 38e24a
files_make_temporary_file(update_modules_tmp_t)
Chris PeBenito 33bc0d
Chris PeBenito 7c5d78
########################################
Chris PeBenito 7c5d78
#
Chris PeBenito 7c5d78
# insmod local policy
Chris PeBenito 7c5d78
#
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
allow insmod_t self:capability { dac_override net_raw sys_tty_config };
Chris PeBenito 7c5d78
allow insmod_t self:process { execmem sigchld sigkill sigstop signull signal };
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
allow insmod_t self:udp_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
Chris PeBenito 7c5d78
allow insmod_t self:rawip_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
Chris PeBenito 7c5d78
Chris PeBenito 183227
# Read module config and dependency information
Chris PeBenito 183227
allow insmod_t { modules_conf_t modules_dep_t }:file { getattr read };
Chris PeBenito 183227
Chris PeBenito 183227
allow insmod_t insmod_exec_t:file { getattr read execute execute_no_trans };
Chris PeBenito 183227
Chris PeBenito 7c5d78
kernel_load_module(insmod_t)
Chris PeBenito 7c5d78
Chris PeBenito b4cd15
# Rules for /proc/sys/kernel/tainted
Chris PeBenito b4cd15
kernel_read_kernel_sysctl(insmod_t)
Chris PeBenito b4cd15
kernel_modify_kernel_sysctl(insmod_t)
Chris PeBenito b4cd15
kernel_read_hotplug_sysctl(insmod_t)
Chris PeBenito b4cd15
Chris PeBenito 5f75f5
bootloader_read_kernel_modules(insmod_t)
Chris PeBenito 5f75f5
Chris PeBenito b4cd15
devices_write_mtrr(insmod_t)
Chris PeBenito b4cd15
devices_get_pseudorandom_data(insmod_t)
Chris PeBenito b4cd15
devices_direct_agp_access(insmod_t)
Chris PeBenito b4cd15
Chris PeBenito 219bcf
filesystem_get_persistent_filesystem_attributes(insmod_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
files_read_runtime_system_config(insmod_t)
Chris PeBenito b4cd15
files_read_general_system_config(insmod_t)
Chris PeBenito 3ce6cb
files_read_general_application_resources(insmod_t)
Chris PeBenito 7c5d78
files_execute_system_config_script(insmod_t)
Chris PeBenito b4cd15
Chris PeBenito b2e062
init_use_file_descriptors(insmod_t)
Chris PeBenito b2e062
init_script_use_file_descriptors(insmod_t)
Chris PeBenito b2e062
init_script_use_pseudoterminal(insmod_t)
Chris PeBenito b2e062
Chris PeBenito b4cd15
domain_signal_all_domains(insmod_t)
Chris PeBenito b2e062
domain_use_widely_inheritable_file_descriptors(insmod_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
libraries_use_dynamic_loader(insmod_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(insmod_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
corecommands_execute_general_programs(insmod_t)
Chris PeBenito b4cd15
corecommands_execute_system_programs(insmod_t)
Chris PeBenito b4cd15
corecommands_execute_shell(insmod_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
miscfiles_read_localization(insmod_t)
Chris PeBenito b4cd15
Chris PeBenito 7c5d78
logging_send_system_log_message(insmod_t)
Chris PeBenito b4cd15
Chris PeBenito 25baab
optional_policy(`mount.te',`
Chris PeBenito 7c5d78
mount_transition(insmod_t)
Chris PeBenito 7c5d78
')
Chris PeBenito b4cd15
Chris PeBenito b2e062
ifdef(`TODO',`
Chris PeBenito b4cd15
Chris PeBenito b4cd15
allow insmod_t initrc_t:fifo_file { getattr read write };
Chris PeBenito b4cd15
Chris PeBenito b4cd15
allow insmod_t { var_t var_log_t }:dir search;
Chris PeBenito b4cd15
Chris PeBenito b4cd15
allow insmod_t apm_bios_t:chr_file { read write };
Chris PeBenito b4cd15
Chris PeBenito b4cd15
allow insmod_t sound_device_t:chr_file { read ioctl write };
Chris PeBenito b4cd15
Chris PeBenito b4cd15
ifdef(`xserver.te', `
Chris PeBenito b4cd15
allow insmod_t xserver_log_t:file getattr;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
allow insmod_t sysfs_t:dir search;
Chris PeBenito 7c5d78
allow insmod_t usbfs_t:dir search;
Chris PeBenito 7c5d78
allow insmod_t usbfs_t:filesystem mount;
Chris PeBenito b4cd15
Chris PeBenito b2e062
allow insmod_t admin_tty_type:chr_file { getattr read write };
Chris PeBenito b4cd15
Chris PeBenito b4cd15
# for when /var is not mounted early in the boot
Chris PeBenito b4cd15
dontaudit insmod_t file_t:dir search;
Chris PeBenito b4cd15
Chris PeBenito b4cd15
# for nscd
Chris PeBenito b4cd15
dontaudit insmod_t var_run_t:dir search;
Chris PeBenito b4cd15
Chris PeBenito b2e062
') dnl if TODO
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
########################################
Chris PeBenito 7c5d78
#
Chris PeBenito 7c5d78
# depmod local policy
Chris PeBenito 7c5d78
#
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
allow depmod_t depmod_exec_t:file { getattr read execute execute_no_trans };
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
# Read conf.modules.
Chris PeBenito 7c5d78
allow depmod_t modules_conf_t:file { getattr read };
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
allow depmod_t modules_dep_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito b2e062
bootloader_create_private_module_dir_entry(depmod_t,modules_dep_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
kernel_read_system_state(depmod_t)
Chris PeBenito 7c5d78
Chris PeBenito 219bcf
filesystem_get_persistent_filesystem_attributes(depmod_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
terminal_use_console(depmod_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
bootloader_read_kernel_symbol_table(depmod_t)
Chris PeBenito 5f75f5
bootloader_read_kernel_modules(depmod_t)
Chris PeBenito 7c5d78
Chris PeBenito b2e062
init_use_file_descriptors(depmod_t)
Chris PeBenito b2e062
init_script_use_file_descriptors(depmod_t)
Chris PeBenito b2e062
init_script_use_pseudoterminal(depmod_t)
Chris PeBenito b2e062
Chris PeBenito b2e062
domain_use_widely_inheritable_file_descriptors(depmod_t)
Chris PeBenito b2e062
Chris PeBenito 7c5d78
files_read_runtime_system_config(depmod_t)
Chris PeBenito 7c5d78
files_read_general_system_config(depmod_t)
Chris PeBenito b2e062
files_read_system_source_code(depmod_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
libraries_use_dynamic_loader(depmod_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(depmod_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
ifdef(`TODO',`
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
allow depmod_t { bin_t sbin_t }:dir search;
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
domain_auto_trans(sysadm_t, depmod_exec_t, depmod_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
# Access terminals.
Chris PeBenito b2e062
allow depmod_t admin_tty_type:chr_file rw_file_perms;
Chris PeBenito 7c5d78
ifdef(`gnome-pty-helper.te', `allow depmod_t sysadm_gph_t:fd use;')
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
# Read System.map from home directories.
Chris PeBenito 7c5d78
allow depmod_t { home_root_t staff_home_dir_t sysadm_home_dir_t }:dir r_dir_perms;
Chris PeBenito 7c5d78
r_dir_file(depmod_t, { staff_home_t sysadm_home_t })
Chris PeBenito 7c5d78
') dnl end ifdef TODO
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
#################################
Chris PeBenito 7c5d78
#
Chris PeBenito 7c5d78
# update-modules local policy
Chris PeBenito 7c5d78
#
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
allow update_modules_t self:fifo_file { getattr read write };
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
allow update_modules_t modules_dep_t:file { getattr read write };
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
allow update_modules_t insmod_exec_t:file { getattr read execute execute_no_trans };
Chris PeBenito 7c5d78
allow update_modules_t update_modules_exec_t:file { getattr read execute execute_no_trans };
Chris PeBenito 7c5d78
Chris PeBenito b2e062
# manage module loading configuration
Chris PeBenito 7c5d78
allow update_modules_t modules_conf_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito b2e062
bootloader_create_private_module_dir_entry(update_modules_t,modules_conf_t)
Chris PeBenito b2e062
files_create_private_config(update_modules_t,modules_conf_t)
Chris PeBenito 7c5d78
Chris PeBenito b2e062
# transition to depmod
Chris PeBenito 7c5d78
allow update_modules_t depmod_exec_t:file { getattr read execute };
Chris PeBenito f1470e
allow update_modules_t depmod_t:process transition;
Chris PeBenito 7c5d78
type_transition update_modules_t depmod_exec_t:process depmod_t;
Chris PeBenito f1470e
dontaudit update_modules_t depmod_t : process { noatsecure siginh rlimitinh };
Chris PeBenito 7c5d78
Chris PeBenito 94edcc
allow update_modules_t update_modules_tmp_t:dir { create read getattr lock setattr ioctl link unlink rename search add_name remove_name reparent write rmdir };
Chris PeBenito 94edcc
allow update_modules_t update_modules_tmp_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 183227
files_create_private_tmp_data(update_modules_t, update_modules_tmp_t, { file dir })
Chris PeBenito 94edcc
Chris PeBenito 7c5d78
kernel_read_kernel_sysctl(update_modules_t)
Chris PeBenito 7c5d78
kernel_read_system_state(update_modules_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
devices_get_pseudorandom_data(update_modules_t)
Chris PeBenito 7c5d78
Chris PeBenito 219bcf
filesystem_get_persistent_filesystem_attributes(update_modules_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
terminal_use_console(update_modules_t)
Chris PeBenito 7c5d78
Chris PeBenito b2e062
init_use_file_descriptors(depmod_t)
Chris PeBenito b2e062
init_script_use_file_descriptors(depmod_t)
Chris PeBenito b2e062
init_script_use_pseudoterminal(depmod_t)
Chris PeBenito b2e062
Chris PeBenito b2e062
domain_use_widely_inheritable_file_descriptors(depmod_t)
Chris PeBenito b2e062
Chris PeBenito 7c5d78
files_read_runtime_system_config(update_modules_t)
Chris PeBenito 7c5d78
files_read_general_system_config(update_modules_t)
Chris PeBenito 1f7b37
files_execute_system_config_script(update_modules_t)
Chris PeBenito 7c5d78
Chris PeBenito 1f7b37
corecommands_execute_general_programs(update_modules_t)
Chris PeBenito 1f7b37
corecommands_execute_system_programs(update_modules_t)
Chris PeBenito 1f7b37
corecommands_execute_shell(update_modules_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
libraries_use_dynamic_loader(update_modules_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(update_modules_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
logging_send_system_log_message(update_modules_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
miscfiles_read_localization(update_modules_t)
Chris PeBenito 7c5d78
Chris PeBenito 7c5d78
ifdef(`TODO',`
Chris PeBenito 7c5d78
role sysadm_r types update_modules_t;
Chris PeBenito b2e062
domain_auto_trans(sysadm_t, update_modules_exec_t, update_modules_t)
Chris PeBenito b2e062
allow update_modules_t admin_tty_type:chr_file rw_file_perms;
Chris PeBenito 7c5d78
dontaudit update_modules_t sysadm_home_dir_t:dir search;
Chris PeBenito 7c5d78
') dnl endif TODO