Chris PeBenito ab58ad
#DESC udev - Linux configurable dynamic device naming support
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Author:  Dan Walsh dwalsh@redhat.com
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Rules for the udev_t domain.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# udev_exec_t is the type of the udev executable.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
daemon_domain(udev, `, nscd_client_domain, privmodule, privmem, fs_domain, privfd, privowner, mlsfileread, mlsfilewrite, mlsfileupgrade, mlsfiledowngrade, mlsprocwrite')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
general_domain_access(udev_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
if (allow_execmem) {
Chris PeBenito ab58ad
# for alsactl
Chris PeBenito ab58ad
allow udev_t self:process execmem;
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
Chris PeBenito ab58ad
etc_domain(udev)
Chris PeBenito ab58ad
type udev_helper_exec_t, file_type, sysadmfile, exec_type;
Chris PeBenito ab58ad
can_exec_any(udev_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Rules used for udev
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
type udev_tdb_t, file_type, sysadmfile, dev_fs;
Chris PeBenito ab58ad
typealias udev_tdb_t alias udev_tbl_t;
Chris PeBenito ab58ad
file_type_auto_trans(udev_t, device_t, udev_tdb_t, file)
Chris PeBenito ab58ad
allow udev_t self:capability { chown dac_override dac_read_search fowner fsetid sys_admin sys_nice mknod net_raw net_admin sys_rawio sys_nice };
Chris PeBenito ab58ad
allow udev_t self:file { getattr read };
Chris PeBenito ab58ad
allow udev_t self:unix_stream_socket {connectto create_stream_socket_perms};
Chris PeBenito ab58ad
allow udev_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito ab58ad
allow udev_t self:fifo_file rw_file_perms;
Chris PeBenito ab58ad
allow udev_t self:netlink_kobject_uevent_socket create_socket_perms; 
Chris PeBenito ab58ad
allow udev_t device_t:file { unlink rw_file_perms };
Chris PeBenito ab58ad
allow udev_t device_t:sock_file create_file_perms;
Chris PeBenito ab58ad
allow udev_t device_t:lnk_file create_lnk_perms;
Chris PeBenito ab58ad
allow udev_t { device_t device_type }:{ chr_file blk_file } { relabelfrom relabelto create_file_perms };
Chris PeBenito ab58ad
ifdef(`distro_redhat', `
Chris PeBenito ab58ad
allow udev_t tmpfs_t:dir create_dir_perms;
Chris PeBenito ab58ad
allow udev_t tmpfs_t:{ sock_file file } create_file_perms;
Chris PeBenito ab58ad
allow udev_t tmpfs_t:lnk_file create_lnk_perms;
Chris PeBenito ab58ad
allow udev_t tmpfs_t:{ chr_file blk_file } { relabelfrom relabelto create_file_perms };
Chris PeBenito ab58ad
allow udev_t tmpfs_t:dir search;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# for arping used for static IP addresses on PCMCIA ethernet
Chris PeBenito ab58ad
domain_auto_trans(udev_t, netutils_exec_t, netutils_t)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
allow udev_t etc_t:file { getattr read ioctl };
Chris PeBenito ab58ad
allow udev_t { bin_t sbin_t }:dir r_dir_perms;
Chris PeBenito ab58ad
allow udev_t { sbin_t bin_t }:lnk_file read;
Chris PeBenito ab58ad
allow udev_t bin_t:lnk_file read;
Chris PeBenito ab58ad
can_exec(udev_t, { shell_exec_t bin_t sbin_t etc_t } )
Chris PeBenito ab58ad
can_exec(udev_t, udev_exec_t)
Chris PeBenito ab58ad
rw_dir_file(udev_t, sysfs_t)
Chris PeBenito ab58ad
allow udev_t sysadm_tty_device_t:chr_file { read write };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# to read the file_contexts file
Chris PeBenito ab58ad
r_dir_file(udev_t, { selinux_config_t file_context_t default_context_t } )
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow udev_t policy_config_t:dir search;
Chris PeBenito ab58ad
allow udev_t proc_t:file { getattr read ioctl };
Chris PeBenito ab58ad
allow udev_t proc_kcore_t:file getattr;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Get security policy decisions.
Chris PeBenito ab58ad
can_getsecurity(udev_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# set file system create context
Chris PeBenito ab58ad
can_setfscreate(udev_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow udev_t kernel_t:fd use;
Chris PeBenito ab58ad
allow udev_t kernel_t:unix_dgram_socket { sendto ioctl read write };
Chris PeBenito ab58ad
allow udev_t kernel_t:process signal;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow udev_t initrc_var_run_t:file r_file_perms;
Chris PeBenito ab58ad
dontaudit udev_t initrc_var_run_t:file write;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
domain_auto_trans(kernel_t, udev_exec_t, udev_t)
Chris PeBenito ab58ad
domain_auto_trans(udev_t, restorecon_exec_t, restorecon_t)
Chris PeBenito ab58ad
ifdef(`hide_broken_symptoms', `
Chris PeBenito ab58ad
dontaudit restorecon_t udev_t:unix_dgram_socket { read write };
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
allow udev_t devpts_t:dir { getattr search };
Chris PeBenito ab58ad
allow udev_t etc_runtime_t:file { getattr read };
Chris PeBenito ab58ad
ifdef(`xdm.te', `
Chris PeBenito ab58ad
allow udev_t xdm_var_run_t:file { getattr read };
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
ifdef(`hotplug.te', `
Chris PeBenito ab58ad
r_dir_file(udev_t, hotplug_etc_t)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
allow udev_t var_log_t:dir search;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
ifdef(`consoletype.te', `
Chris PeBenito ab58ad
can_exec(udev_t, consoletype_exec_t)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
ifdef(`pamconsole.te', `
Chris PeBenito ab58ad
allow udev_t pam_var_console_t:dir search;
Chris PeBenito ab58ad
allow udev_t pam_var_console_t:file { getattr read };
Chris PeBenito ab58ad
domain_auto_trans(udev_t, pam_console_exec_t, pam_console_t)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
allow udev_t var_lock_t:dir search;
Chris PeBenito ab58ad
allow udev_t var_lock_t:file getattr;
Chris PeBenito ab58ad
domain_auto_trans(udev_t, ifconfig_exec_t, ifconfig_t)
Chris PeBenito ab58ad
ifdef(`hide_broken_symptoms', `
Chris PeBenito ab58ad
dontaudit ifconfig_t udev_t:unix_dgram_socket { read write };
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
dontaudit udev_t file_t:dir search;
Chris PeBenito ab58ad
ifdef(`dhcpc.te', `
Chris PeBenito ab58ad
domain_auto_trans(udev_t, dhcpc_exec_t, dhcpc_t)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow udev_t udev_helper_exec_t:dir r_dir_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
dbusd_client(system, udev)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow udev_t device_t:dir { relabelfrom relabelto create_dir_perms };
Chris PeBenito ab58ad
allow udev_t sysctl_dev_t:dir search;
Chris PeBenito ab58ad
allow udev_t mnt_t:dir search;
Chris PeBenito ab58ad
allow udev_t { sysctl_dev_t sysctl_modprobe_t sysctl_kernel_t sysctl_hotplug_t }:file { getattr read };
Chris PeBenito ab58ad
allow udev_t self:rawip_socket create_socket_perms;
Chris PeBenito ab58ad
dontaudit udev_t domain:dir r_dir_perms;
Chris PeBenito ab58ad
dontaudit udev_t ttyfile:chr_file unlink;
Chris PeBenito ab58ad
ifdef(`hotplug.te', `
Chris PeBenito ab58ad
r_dir_file(udev_t, hotplug_var_run_t)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
r_dir_file(udev_t, modules_object_t)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Udev is now writing dhclient-eth*.conf* files.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
ifdef(`dhcpd.te', `define(`use_dhcp')')
Chris PeBenito ab58ad
ifdef(`dhcpc.te', `define(`use_dhcp')')
Chris PeBenito ab58ad
ifdef(`use_dhcp', `
Chris PeBenito ab58ad
allow udev_t dhcp_etc_t:file rw_file_perms;
Chris PeBenito ab58ad
file_type_auto_trans(udev_t, etc_t, dhcp_etc_t, file)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
r_dir_file(udev_t, domain)
Chris PeBenito ab58ad
allow udev_t modules_dep_t:file r_file_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
nsswitch_domain(udev_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
ifdef(`unlimitedUtils', `
Chris PeBenito ab58ad
unconfined_domain(udev_t) 
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
dontaudit hostname_t udev_t:fd use;
Chris PeBenito ab58ad
ifdef(`use_mcs', `
Chris PeBenito ab58ad
range_transition kernel_t udev_exec_t s0 - s0:c0.c255;
Chris PeBenito ab58ad
range_transition initrc_t udev_exec_t s0 - s0:c0.c255;
Chris PeBenito ab58ad
')