|
Chris PeBenito |
e181fe |
|
|
Chris PeBenito |
46c69c |
policy_module(modutils,1.0.2)
|
|
Chris PeBenito |
960373 |
|
|
Chris PeBenito |
9fd4b8 |
gen_require(`
|
|
Chris PeBenito |
9fd4b8 |
bool secure_mode_insmod;
|
|
Chris PeBenito |
9fd4b8 |
')
|
|
Chris PeBenito |
9fd4b8 |
|
|
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 |
8fd367 |
files_type(modules_conf_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
b4cd15 |
# module dependencies
|
|
Chris PeBenito |
b4cd15 |
type modules_dep_t;
|
|
Chris PeBenito |
8fd367 |
files_type(modules_dep_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
f0574f |
type insmod_t;
|
|
Chris PeBenito |
b4cd15 |
type insmod_exec_t;
|
|
Chris PeBenito |
c9428d |
init_system_domain(insmod_t,insmod_exec_t)
|
|
Chris PeBenito |
f0574f |
mls_file_write_down(insmod_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 |
c9428d |
init_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 |
c9428d |
init_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 |
c9428d |
files_tmp_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 |
80048c |
allow insmod_t self:udp_socket create_socket_perms;
|
|
Chris PeBenito |
80048c |
allow insmod_t self:rawip_socket create_socket_perms;
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
183227 |
# Read module config and dependency information
|
|
Chris PeBenito |
80048c |
allow insmod_t { modules_conf_t modules_dep_t }:file r_file_perms;
|
|
Chris PeBenito |
183227 |
|
|
Chris PeBenito |
80048c |
can_exec(insmod_t, insmod_exec_t)
|
|
Chris PeBenito |
183227 |
|
|
Chris PeBenito |
4614e8 |
# make sediff happy (no effect)
|
|
Chris PeBenito |
4614e8 |
dontaudit insmod_t self:process { noatsecure rlimitinh siginh };
|
|
Chris PeBenito |
4614e8 |
type_transition insmod_t insmod_exec_t:process insmod_t;
|
|
Chris PeBenito |
4614e8 |
|
|
Chris PeBenito |
7c5d78 |
kernel_load_module(insmod_t)
|
|
Chris PeBenito |
d490eb |
kernel_read_system_state(insmod_t)
|
|
Chris PeBenito |
a1fcff |
kernel_mount_debugfs(insmod_t)
|
|
Chris PeBenito |
d8636f |
kernel_read_debugfs(insmod_t)
|
|
Chris PeBenito |
b4cd15 |
# Rules for /proc/sys/kernel/tainted
|
|
Chris PeBenito |
445522 |
kernel_read_kernel_sysctls(insmod_t)
|
|
Chris PeBenito |
0fd9dc |
kernel_rw_kernel_sysctl(insmod_t)
|
|
Chris PeBenito |
445522 |
kernel_read_hotplug_sysctls(insmod_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
5f75f5 |
bootloader_read_kernel_modules(insmod_t)
|
|
Chris PeBenito |
d490eb |
# for locking: (cjp: ????)
|
|
Chris PeBenito |
d490eb |
bootloader_write_kernel_modules(insmod_t)
|
|
Chris PeBenito |
5f75f5 |
|
|
Chris PeBenito |
8bd678 |
dev_search_sysfs(insmod_t)
|
|
Chris PeBenito |
8bd678 |
dev_search_usbfs(insmod_t)
|
|
Karl MacMillan |
f0c985 |
dev_write_mtrr(insmod_t)
|
|
Karl MacMillan |
f0c985 |
dev_read_urand(insmod_t)
|
|
Chris PeBenito |
207c47 |
dev_rw_agp(insmod_t)
|
|
Chris PeBenito |
207c47 |
dev_read_sound(insmod_t)
|
|
Chris PeBenito |
207c47 |
dev_write_sound(insmod_t)
|
|
Chris PeBenito |
ebdc3b |
dev_rw_apm_bios(insmod_t)
|
|
Chris PeBenito |
fd89e1 |
# cjp: why is this needed? insmod cannot mounton any dir
|
|
Chris PeBenito |
fd89e1 |
# and it also transitions to mount
|
|
Chris PeBenito |
fd89e1 |
dev_mount_usbfs(insmod_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_xattr_fs(insmod_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
c9428d |
corecmd_exec_bin(insmod_t)
|
|
Chris PeBenito |
c9428d |
corecmd_exec_sbin(insmod_t)
|
|
Chris PeBenito |
c9428d |
corecmd_exec_shell(insmod_t)
|
|
Chris PeBenito |
f5c42b |
|
|
Chris PeBenito |
f5c42b |
domain_signal_all_domains(insmod_t)
|
|
Chris PeBenito |
c9428d |
domain_use_wide_inherit_fd(insmod_t)
|
|
Chris PeBenito |
f5c42b |
|
|
Chris PeBenito |
c9428d |
files_read_etc_runtime_files(insmod_t)
|
|
Chris PeBenito |
8fd367 |
files_read_etc_files(insmod_t)
|
|
Chris PeBenito |
c9428d |
files_read_usr_files(insmod_t)
|
|
Chris PeBenito |
8fd367 |
files_exec_etc_files(insmod_t)
|
|
Chris PeBenito |
3b857e |
# for nscd:
|
|
Chris PeBenito |
c9428d |
files_dontaudit_search_pids(insmod_t)
|
|
Chris PeBenito |
3b857e |
# for when /var is not mounted early in the boot:
|
|
Chris PeBenito |
9e04f5 |
files_dontaudit_search_isid_type_dirs(insmod_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
1815ba |
init_rw_initctl(insmod_t)
|
|
Chris PeBenito |
c9428d |
init_use_fd(insmod_t)
|
|
Chris PeBenito |
c9428d |
init_use_script_fd(insmod_t)
|
|
Chris PeBenito |
1815ba |
init_use_script_ptys(insmod_t)
|
|
Chris PeBenito |
b2e062 |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so(insmod_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs(insmod_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
c9428d |
logging_send_syslog_msg(insmod_t)
|
|
Chris PeBenito |
c9428d |
logging_search_logs(insmod_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
b4cd15 |
miscfiles_read_localization(insmod_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
51a89c |
seutil_read_file_contexts(insmod_t)
|
|
Chris PeBenito |
51a89c |
|
|
Chris PeBenito |
725926 |
if( ! secure_mode_insmod ) {
|
|
Chris PeBenito |
270d42 |
kernel_domtrans_to(insmod_t,insmod_exec_t)
|
|
Chris PeBenito |
725926 |
}
|
|
Chris PeBenito |
725926 |
|
|
Chris PeBenito |
50f650 |
ifdef(`hide_broken_symptoms',`
|
|
Chris PeBenito |
50f650 |
dev_dontaudit_rw_cardmgr(insmod_t)
|
|
Chris PeBenito |
50f650 |
')
|
|
Chris PeBenito |
50f650 |
|
|
Chris PeBenito |
689f6d |
ifdef(`targeted_policy',`
|
|
Chris PeBenito |
955019 |
unconfined_domain(insmod_t)
|
|
Chris PeBenito |
892266 |
')
|
|
Chris PeBenito |
892266 |
|
|
Chris PeBenito |
132880 |
optional_policy(`hotplug',`
|
|
Chris PeBenito |
98a8ea |
hotplug_search_config(insmod_t)
|
|
Chris PeBenito |
98a8ea |
')
|
|
Chris PeBenito |
98a8ea |
|
|
Chris PeBenito |
132880 |
optional_policy(`mount',`
|
|
Chris PeBenito |
c9428d |
mount_domtrans(insmod_t)
|
|
Chris PeBenito |
7c5d78 |
')
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
132880 |
optional_policy(`nis',`
|
|
Chris PeBenito |
fa6757 |
nis_use_ypbind(insmod_t)
|
|
Chris PeBenito |
fa6757 |
')
|
|
Chris PeBenito |
fa6757 |
|
|
Chris PeBenito |
132880 |
optional_policy(`nscd',`
|
|
Chris PeBenito |
1815ba |
nscd_socket_use(insmod_t)
|
|
Chris PeBenito |
98a8ea |
')
|
|
Chris PeBenito |
98a8ea |
|
|
Chris PeBenito |
132880 |
optional_policy(`rpm',`
|
|
Chris PeBenito |
1815ba |
rpm_rw_pipes(insmod_t)
|
|
Chris PeBenito |
b24f35 |
')
|
|
Chris PeBenito |
b24f35 |
|
|
Chris PeBenito |
cf6a7d |
ifdef(`TODO',`
|
|
Chris PeBenito |
a1fcff |
allow insmod_t proc_t:file rw_file_perms;
|
|
Chris PeBenito |
132880 |
optional_policy(`xserver',`
|
|
Chris PeBenito |
cf6a7d |
xserver_getattr_log(insmod_t)
|
|
Chris PeBenito |
cf6a7d |
allow insmod_t xserver_misc_device_t:chr_file { read write };
|
|
Chris PeBenito |
cf6a7d |
')
|
|
Chris PeBenito |
cf6a7d |
')
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
7c5d78 |
########################################
|
|
Chris PeBenito |
7c5d78 |
#
|
|
Chris PeBenito |
7c5d78 |
# depmod local policy
|
|
Chris PeBenito |
7c5d78 |
#
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
80048c |
can_exec(depmod_t, depmod_exec_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
7c5d78 |
# Read conf.modules.
|
|
Chris PeBenito |
80048c |
allow depmod_t modules_conf_t:file r_file_perms;
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
80048c |
allow depmod_t modules_dep_t:file create_file_perms;
|
|
Chris PeBenito |
9d5949 |
bootloader_filetrans_modules(depmod_t,modules_dep_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
7c5d78 |
kernel_read_system_state(depmod_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
d35c62 |
bootloader_read_kernel_symbol_table(depmod_t)
|
|
Chris PeBenito |
d35c62 |
bootloader_read_kernel_modules(depmod_t)
|
|
Chris PeBenito |
d35c62 |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_xattr_fs(depmod_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
0fd9dc |
term_use_console(depmod_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
58c3da |
corecmd_search_bin(depmod_t)
|
|
Chris PeBenito |
58c3da |
corecmd_search_sbin(depmod_t)
|
|
Chris PeBenito |
58c3da |
|
|
Chris PeBenito |
58c3da |
domain_use_wide_inherit_fd(depmod_t)
|
|
Chris PeBenito |
58c3da |
|
|
Chris PeBenito |
c9428d |
init_use_fd(depmod_t)
|
|
Chris PeBenito |
c9428d |
init_use_script_fd(depmod_t)
|
|
Chris PeBenito |
1815ba |
init_use_script_ptys(depmod_t)
|
|
Chris PeBenito |
b2e062 |
|
|
Chris PeBenito |
c9428d |
files_read_etc_runtime_files(depmod_t)
|
|
Chris PeBenito |
8fd367 |
files_read_etc_files(depmod_t)
|
|
Chris PeBenito |
8fd367 |
files_read_usr_src_files(depmod_t)
|
|
Chris PeBenito |
681c9a |
files_list_usr(depmod_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so(depmod_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs(depmod_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
fd89e1 |
# Read System.map from home directories.
|
|
Chris PeBenito |
fd89e1 |
files_list_home(depmod_t)
|
|
Chris PeBenito |
fd89e1 |
userdom_read_staff_home_files(depmod_t)
|
|
Chris PeBenito |
fd89e1 |
userdom_read_sysadm_home_files(depmod_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
7ac225 |
ifdef(`targeted_policy', `
|
|
Chris PeBenito |
1815ba |
term_use_unallocated_ttys(depmod_t)
|
|
Chris PeBenito |
1815ba |
term_use_generic_ptys(depmod_t)
|
|
Chris PeBenito |
7ac225 |
')
|
|
Chris PeBenito |
7ac225 |
|
|
Chris PeBenito |
132880 |
optional_policy(`rpm',`
|
|
Chris PeBenito |
1815ba |
rpm_rw_pipes(depmod_t)
|
|
Chris PeBenito |
b24f35 |
')
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
fd89e1 |
ifdef(`TODO',`
|
|
Chris PeBenito |
fd89e1 |
ifdef(`gnome-pty-helper.te', `allow depmod_t sysadm_gph_t:fd use;')
|
|
Chris PeBenito |
7c5d78 |
') dnl end ifdef TODO
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
9bbc75 |
allow depmod_t modules_object_t:file unlink;
|
|
Chris PeBenito |
9bbc75 |
|
|
Chris PeBenito |
7c5d78 |
#################################
|
|
Chris PeBenito |
7c5d78 |
#
|
|
Chris PeBenito |
7c5d78 |
# update-modules local policy
|
|
Chris PeBenito |
7c5d78 |
#
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
80048c |
allow update_modules_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
80048c |
allow update_modules_t modules_dep_t:file rw_file_perms;
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
80048c |
can_exec(update_modules_t, insmod_exec_t)
|
|
Chris PeBenito |
80048c |
can_exec(update_modules_t, update_modules_exec_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
b2e062 |
# manage module loading configuration
|
|
Chris PeBenito |
80048c |
allow update_modules_t modules_conf_t:file create_file_perms;
|
|
Chris PeBenito |
9d5949 |
bootloader_filetrans_modules(update_modules_t,modules_conf_t)
|
|
Chris PeBenito |
9d5949 |
files_filetrans_etc(update_modules_t,modules_conf_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
b2e062 |
# transition to depmod
|
|
Chris PeBenito |
80048c |
domain_auto_trans(update_modules_t, depmod_exec_t, depmod_t)
|
|
Chris PeBenito |
ccfd7b |
allow update_modules_t depmod_t:fd use;
|
|
Chris PeBenito |
ccfd7b |
allow depmod_t update_modules_t:fd use;
|
|
Chris PeBenito |
ccfd7b |
allow depmod_t update_modules_t:fifo_file rw_file_perms;
|
|
Chris PeBenito |
ccfd7b |
allow depmod_t update_modules_t:process sigchld;
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
80048c |
allow update_modules_t update_modules_tmp_t:dir create_dir_perms;
|
|
Chris PeBenito |
80048c |
allow update_modules_t update_modules_tmp_t:file create_file_perms;
|
|
Chris PeBenito |
9d5949 |
files_filetrans_tmp(update_modules_t, update_modules_tmp_t, { file dir })
|
|
Chris PeBenito |
94edcc |
|
|
Chris PeBenito |
445522 |
kernel_read_kernel_sysctls(update_modules_t)
|
|
Chris PeBenito |
7c5d78 |
kernel_read_system_state(update_modules_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Karl MacMillan |
f0c985 |
dev_read_urand(update_modules_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_xattr_fs(update_modules_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
0fd9dc |
term_use_console(update_modules_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
ccfd7b |
init_use_fd(update_modules_t)
|
|
Chris PeBenito |
ccfd7b |
init_use_script_fd(update_modules_t)
|
|
Chris PeBenito |
1815ba |
init_use_script_ptys(update_modules_t)
|
|
Chris PeBenito |
b2e062 |
|
|
Chris PeBenito |
ccfd7b |
domain_use_wide_inherit_fd(update_modules_t)
|
|
Chris PeBenito |
b2e062 |
|
|
Chris PeBenito |
c9428d |
files_read_etc_runtime_files(update_modules_t)
|
|
Chris PeBenito |
8fd367 |
files_read_etc_files(update_modules_t)
|
|
Chris PeBenito |
8fd367 |
files_exec_etc_files(update_modules_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
c9428d |
corecmd_exec_bin(update_modules_t)
|
|
Chris PeBenito |
c9428d |
corecmd_exec_sbin(update_modules_t)
|
|
Chris PeBenito |
c9428d |
corecmd_exec_shell(update_modules_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so(update_modules_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs(update_modules_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
c9428d |
logging_send_syslog_msg(update_modules_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
7c5d78 |
miscfiles_read_localization(update_modules_t)
|
|
Chris PeBenito |
7c5d78 |
|
|
Chris PeBenito |
ae9e27 |
userdom_dontaudit_search_sysadm_home_dir(update_modules_t)
|
|
Chris PeBenito |
a525f2 |
|
|
Chris PeBenito |
a525f2 |
ifdef(`targeted_policy',`
|
|
Chris PeBenito |
1815ba |
term_use_generic_ptys(update_modules_t)
|
|
Chris PeBenito |
1815ba |
term_use_unallocated_ttys(update_modules_t)
|
|
Chris PeBenito |
a525f2 |
')
|