2020-06-15 12:43:30 +00:00
|
|
|
policy_module(devices, 1.26.6)
|
2005-04-26 17:00:25 +00:00
|
|
|
|
2005-06-30 18:54:08 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
attribute device_node;
|
2005-05-10 20:24:26 +00:00
|
|
|
attribute memory_raw_read;
|
|
|
|
attribute memory_raw_write;
|
2006-04-10 21:04:51 +00:00
|
|
|
attribute devices_unconfined_type;
|
2015-10-20 17:23:35 +00:00
|
|
|
attribute sysfs_types;
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# device_t is the type of /dev.
|
|
|
|
#
|
2005-04-28 18:59:01 +00:00
|
|
|
type device_t;
|
2005-10-25 18:13:47 +00:00
|
|
|
fs_associate_tmpfs(device_t)
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(device_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_mountpoint(device_t)
|
2005-10-25 18:13:47 +00:00
|
|
|
files_associate_tmp(device_t)
|
2014-04-04 20:52:53 +00:00
|
|
|
fs_xattr_type(device_t)
|
2010-08-18 15:36:34 +00:00
|
|
|
fs_use_trans devtmpfs gen_context(system_u:object_r:device_t,s0);
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2017-02-24 01:03:23 +00:00
|
|
|
optional_policy(`
|
|
|
|
systemd_tmpfilesd_managed(device_t, fifo_file)
|
|
|
|
')
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
# Type for /dev/agpgart
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type agp_device_t;
|
|
|
|
dev_node(agp_device_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Type for /dev/apm_bios
|
|
|
|
#
|
2017-04-26 10:36:20 +00:00
|
|
|
type acpi_bios_t;
|
|
|
|
dev_node(acpi_bios_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2009-03-05 15:36:41 +00:00
|
|
|
#
|
|
|
|
# Type for /dev/autofs
|
|
|
|
#
|
|
|
|
type autofs_device_t;
|
|
|
|
dev_node(autofs_device_t)
|
|
|
|
|
2005-10-25 18:13:47 +00:00
|
|
|
type cardmgr_dev_t;
|
|
|
|
dev_node(cardmgr_dev_t)
|
2005-10-24 14:15:29 +00:00
|
|
|
files_tmp_file(cardmgr_dev_t)
|
2005-05-10 20:25:20 +00:00
|
|
|
|
2012-10-04 12:24:57 +00:00
|
|
|
type cachefiles_device_t;
|
|
|
|
dev_node(cachefiles_device_t)
|
2012-09-23 15:15:39 +00:00
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
# clock_device_t is the type of
|
|
|
|
# /dev/rtc.
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type clock_device_t;
|
|
|
|
dev_node(clock_device_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# cpu control devices /dev/cpu/0/*
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type cpu_device_t;
|
|
|
|
dev_node(cpu_device_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2014-03-25 20:30:06 +00:00
|
|
|
#
|
|
|
|
# /sys/devices/system/cpu/online device
|
|
|
|
#
|
2015-10-20 17:23:35 +00:00
|
|
|
type cpu_online_t, sysfs_types;
|
2014-03-25 20:30:06 +00:00
|
|
|
files_type(cpu_online_t)
|
|
|
|
dev_associate_sysfs(cpu_online_t)
|
2017-01-06 13:18:24 +00:00
|
|
|
genfscon sysfs /devices/system/cpu/online gen_context(system_u:object_r:cpu_online_t,s0)
|
2014-03-25 20:30:06 +00:00
|
|
|
|
2011-03-07 15:47:09 +00:00
|
|
|
#
|
|
|
|
# Type for /dev/crash
|
|
|
|
#
|
|
|
|
type crash_device_t;
|
|
|
|
dev_node(crash_device_t)
|
|
|
|
|
2005-09-13 13:06:07 +00:00
|
|
|
# for the IBM zSeries z90crypt hardware ssl accelorator
|
2005-10-25 18:13:47 +00:00
|
|
|
type crypt_device_t;
|
|
|
|
dev_node(crypt_device_t)
|
2005-09-13 13:06:07 +00:00
|
|
|
|
2019-05-31 17:44:49 +00:00
|
|
|
#
|
|
|
|
# Type for /dev/dax*.*
|
|
|
|
#
|
|
|
|
type dax_device_t;
|
|
|
|
dev_node(dax_device_t)
|
|
|
|
|
2010-03-04 20:30:22 +00:00
|
|
|
#
|
|
|
|
# dlm_misc_device_t is the type of /dev/misc/dlm.*
|
|
|
|
#
|
|
|
|
type dlm_control_device_t;
|
|
|
|
dev_node(dlm_control_device_t)
|
|
|
|
|
2005-10-25 18:13:47 +00:00
|
|
|
type dri_device_t;
|
|
|
|
dev_node(dri_device_t)
|
2005-05-10 20:24:26 +00:00
|
|
|
|
2005-10-25 18:13:47 +00:00
|
|
|
type event_device_t;
|
|
|
|
dev_node(event_device_t)
|
2005-05-10 20:24:26 +00:00
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
# Type for framebuffer /dev/fb/*
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type framebuf_device_t;
|
|
|
|
dev_node(framebuf_device_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2020-03-15 01:54:27 +00:00
|
|
|
#
|
|
|
|
# Type for Dell (others?) freefall detection device /dev/freefall
|
|
|
|
#
|
|
|
|
type freefall_device_t;
|
|
|
|
dev_node(freefall_device_t)
|
|
|
|
|
2019-04-10 18:01:39 +00:00
|
|
|
#
|
|
|
|
# Type for GPIO chip /dev/gpiochip*
|
|
|
|
#
|
|
|
|
type gpiochip_device_t;
|
|
|
|
dev_node(gpiochip_device_t)
|
|
|
|
|
2009-03-05 15:36:41 +00:00
|
|
|
#
|
|
|
|
# Type for /dev/ipmi/0
|
|
|
|
#
|
|
|
|
type ipmi_device_t;
|
|
|
|
dev_node(ipmi_device_t)
|
|
|
|
|
2006-12-04 20:10:56 +00:00
|
|
|
#
|
|
|
|
# Type for /dev/kmsg
|
|
|
|
#
|
|
|
|
type kmsg_device_t;
|
|
|
|
dev_node(kmsg_device_t)
|
|
|
|
|
2020-01-10 16:42:29 +00:00
|
|
|
optional_policy(`
|
|
|
|
init_mountpoint(kmsg_device_t)
|
|
|
|
')
|
|
|
|
|
2009-11-19 14:44:19 +00:00
|
|
|
#
|
|
|
|
# ksm_device_t is the type of /dev/ksm
|
|
|
|
#
|
|
|
|
type ksm_device_t;
|
|
|
|
dev_node(ksm_device_t)
|
|
|
|
|
2009-03-05 15:36:41 +00:00
|
|
|
#
|
|
|
|
# kvm_device_t is the type of
|
|
|
|
# /dev/kvm
|
|
|
|
#
|
|
|
|
type kvm_device_t;
|
|
|
|
dev_node(kvm_device_t)
|
|
|
|
|
2009-11-19 14:44:19 +00:00
|
|
|
#
|
|
|
|
# Type for /dev/lirc
|
|
|
|
#
|
|
|
|
type lirc_device_t;
|
|
|
|
dev_node(lirc_device_t)
|
|
|
|
|
2012-08-31 17:38:21 +00:00
|
|
|
type loop_control_device_t;
|
|
|
|
dev_node(loop_control_device_t)
|
|
|
|
|
2005-04-29 20:35:49 +00:00
|
|
|
#
|
|
|
|
# Type for /dev/mapper/control
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type lvm_control_t;
|
|
|
|
dev_node(lvm_control_t)
|
2005-04-29 20:35:49 +00:00
|
|
|
|
2012-08-22 13:21:53 +00:00
|
|
|
type mei_device_t;
|
|
|
|
dev_node(mei_device_t)
|
|
|
|
|
2005-05-10 20:24:26 +00:00
|
|
|
#
|
|
|
|
# memory_device_t is the type of /dev/kmem,
|
|
|
|
# /dev/mem and /dev/port.
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type memory_device_t;
|
|
|
|
dev_node(memory_device_t)
|
2005-05-10 20:24:26 +00:00
|
|
|
|
2006-04-11 14:19:38 +00:00
|
|
|
neverallow ~{ memory_raw_read devices_unconfined_type } memory_device_t:{ chr_file blk_file } read;
|
|
|
|
neverallow ~{ memory_raw_write devices_unconfined_type } memory_device_t:{ chr_file blk_file } { append write };
|
2005-05-10 20:24:26 +00:00
|
|
|
|
2005-10-25 18:13:47 +00:00
|
|
|
type misc_device_t;
|
|
|
|
dev_node(misc_device_t)
|
2005-05-16 21:10:33 +00:00
|
|
|
|
2009-11-19 14:44:19 +00:00
|
|
|
#
|
|
|
|
# A general type for modem devices.
|
|
|
|
#
|
|
|
|
type modem_device_t;
|
|
|
|
dev_node(modem_device_t)
|
|
|
|
|
2005-05-10 20:24:26 +00:00
|
|
|
#
|
|
|
|
# A more general type for mouse devices.
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type mouse_device_t;
|
|
|
|
dev_node(mouse_device_t)
|
2005-05-10 20:24:26 +00:00
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
# Type for /dev/cpu/mtrr and /proc/mtrr
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type mtrr_device_t;
|
|
|
|
dev_node(mtrr_device_t)
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon proc /mtrr gen_context(system_u:object_r:mtrr_device_t,s0)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2020-05-17 11:36:56 +00:00
|
|
|
optional_policy(`
|
|
|
|
init_mountpoint(mtrr_device_t)
|
|
|
|
')
|
|
|
|
|
2005-05-10 20:24:26 +00:00
|
|
|
#
|
|
|
|
# null_device_t is the type of /dev/null.
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type null_device_t;
|
|
|
|
dev_node(null_device_t)
|
2005-09-26 20:26:32 +00:00
|
|
|
mls_trusted_object(null_device_t)
|
2005-10-06 19:33:06 +00:00
|
|
|
sid devnull gen_context(system_u:object_r:null_device_t,s0)
|
2005-05-10 20:24:26 +00:00
|
|
|
|
2006-08-29 02:41:00 +00:00
|
|
|
#
|
2009-11-19 14:44:19 +00:00
|
|
|
# Type for /dev/nvram
|
2006-08-29 02:41:00 +00:00
|
|
|
#
|
|
|
|
type nvram_device_t;
|
|
|
|
dev_node(nvram_device_t)
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
2009-11-19 14:44:19 +00:00
|
|
|
# Type for /dev/pmu
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type power_device_t;
|
|
|
|
dev_node(power_device_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2019-04-05 14:12:01 +00:00
|
|
|
#
|
|
|
|
# PM QoS Interface, /dev/cpu_dma_latency, network_latency,
|
|
|
|
# network_throughput, and memory_bandwidth
|
|
|
|
#
|
|
|
|
type pmqos_device_t alias netcontrol_device_t;
|
|
|
|
dev_node(pmqos_device_t)
|
|
|
|
|
2005-10-25 18:13:47 +00:00
|
|
|
type printer_device_t;
|
|
|
|
dev_node(printer_device_t)
|
2006-11-01 15:42:22 +00:00
|
|
|
mls_file_write_within_range(printer_device_t)
|
2005-05-10 13:59:10 +00:00
|
|
|
|
2009-03-05 15:36:41 +00:00
|
|
|
#
|
2009-11-19 14:44:19 +00:00
|
|
|
# qemu control devices
|
2009-03-05 15:36:41 +00:00
|
|
|
#
|
|
|
|
type qemu_device_t;
|
|
|
|
dev_node(qemu_device_t)
|
|
|
|
|
2005-05-10 20:24:26 +00:00
|
|
|
#
|
|
|
|
# random_device_t is the type of /dev/random
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type random_device_t;
|
|
|
|
dev_node(random_device_t)
|
2005-05-10 20:24:26 +00:00
|
|
|
|
2005-10-25 18:13:47 +00:00
|
|
|
type scanner_device_t;
|
|
|
|
dev_node(scanner_device_t)
|
2005-05-10 20:24:26 +00:00
|
|
|
|
2007-06-11 15:01:10 +00:00
|
|
|
#
|
|
|
|
# Type for smartcards
|
|
|
|
#
|
|
|
|
type smartcard_device_t;
|
|
|
|
dev_node(smartcard_device_t)
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
# Type for sound devices and mixers
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type sound_device_t;
|
|
|
|
dev_node(sound_device_t)
|
2005-04-29 20:35:49 +00:00
|
|
|
|
2020-04-19 09:40:59 +00:00
|
|
|
#
|
|
|
|
# Type for sysdig device
|
|
|
|
#
|
|
|
|
type sysdig_device_t;
|
|
|
|
dev_node(sysdig_device_t)
|
|
|
|
|
2005-06-14 19:56:46 +00:00
|
|
|
#
|
|
|
|
# sysfs_t is the type for the /sys pseudofs
|
|
|
|
#
|
2015-10-20 17:23:35 +00:00
|
|
|
type sysfs_t, sysfs_types;
|
2005-06-14 19:56:46 +00:00
|
|
|
files_mountpoint(sysfs_t)
|
2014-04-04 20:52:53 +00:00
|
|
|
fs_xattr_type(sysfs_t)
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon sysfs / gen_context(system_u:object_r:sysfs_t,s0)
|
2005-06-14 19:56:46 +00:00
|
|
|
|
2019-07-16 20:23:47 +00:00
|
|
|
#
|
|
|
|
# Types for trusted execution environment interface
|
|
|
|
#
|
|
|
|
type tee_device_t;
|
|
|
|
dev_node(tee_device_t)
|
|
|
|
|
|
|
|
type tee_priv_device_t;
|
|
|
|
dev_node(tee_priv_device_t)
|
|
|
|
|
2009-06-08 17:18:26 +00:00
|
|
|
#
|
|
|
|
# Type for /dev/tpm
|
|
|
|
#
|
|
|
|
type tpm_device_t;
|
|
|
|
dev_node(tpm_device_t)
|
|
|
|
|
2020-03-15 01:54:27 +00:00
|
|
|
#
|
2020-05-17 11:36:56 +00:00
|
|
|
# uhid_device_t is the type of /dev/uhid -
|
2020-03-15 01:54:27 +00:00
|
|
|
# User-space I/O driver support for HID subsystem
|
|
|
|
#
|
|
|
|
type uhid_device_t;
|
|
|
|
dev_node(uhid_device_t)
|
|
|
|
|
2005-05-10 20:24:26 +00:00
|
|
|
#
|
|
|
|
# urandom_device_t is the type of /dev/urandom
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type urandom_device_t;
|
|
|
|
dev_node(urandom_device_t)
|
2005-05-10 20:24:26 +00:00
|
|
|
|
2005-06-14 19:56:46 +00:00
|
|
|
#
|
|
|
|
# usbfs_t is the type for the /proc/bus/usb pseudofs
|
|
|
|
#
|
2019-09-11 00:52:54 +00:00
|
|
|
type usbfs_t;
|
2005-06-14 19:56:46 +00:00
|
|
|
files_mountpoint(usbfs_t)
|
2006-01-31 20:29:27 +00:00
|
|
|
fs_noxattr_type(usbfs_t)
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon usbfs / gen_context(system_u:object_r:usbfs_t,s0)
|
|
|
|
genfscon usbdevfs / gen_context(system_u:object_r:usbfs_t,s0)
|
2005-06-14 19:56:46 +00:00
|
|
|
|
2006-02-13 22:05:08 +00:00
|
|
|
#
|
|
|
|
# usb_device_t is the type for /dev/bus/usb/[0-9]+/[0-9]+
|
|
|
|
#
|
|
|
|
type usb_device_t;
|
|
|
|
dev_node(usb_device_t)
|
|
|
|
|
2010-06-07 13:20:18 +00:00
|
|
|
#
|
|
|
|
# usb_device_t is the type for /dev/usbmon
|
|
|
|
#
|
|
|
|
type usbmon_device_t;
|
|
|
|
dev_node(usbmon_device_t)
|
|
|
|
|
2010-03-04 20:30:22 +00:00
|
|
|
#
|
|
|
|
# userio_device_t is the type for /dev/uio[0-9]+
|
|
|
|
#
|
|
|
|
type userio_device_t;
|
|
|
|
dev_node(userio_device_t)
|
|
|
|
|
2015-09-05 07:41:48 +00:00
|
|
|
type vfio_device_t;
|
|
|
|
dev_node(vfio_device_t)
|
|
|
|
|
2005-10-25 18:13:47 +00:00
|
|
|
type v4l_device_t;
|
|
|
|
dev_node(v4l_device_t)
|
2005-05-10 14:12:10 +00:00
|
|
|
|
2010-06-07 13:20:18 +00:00
|
|
|
#
|
2018-07-13 17:05:36 +00:00
|
|
|
# vhost_device_t is the type for vhost devices like
|
|
|
|
# /dev/vhost-net and /dev/vhost-scsi
|
2010-06-07 13:20:18 +00:00
|
|
|
#
|
|
|
|
type vhost_device_t;
|
|
|
|
dev_node(vhost_device_t)
|
|
|
|
|
2006-04-26 18:18:15 +00:00
|
|
|
# Type for vmware devices.
|
|
|
|
type vmware_device_t;
|
|
|
|
dev_node(vmware_device_t)
|
|
|
|
|
2006-04-28 20:20:40 +00:00
|
|
|
type watchdog_device_t;
|
2006-08-29 02:41:00 +00:00
|
|
|
dev_node(watchdog_device_t)
|
2006-04-28 20:20:40 +00:00
|
|
|
|
2009-11-19 14:44:19 +00:00
|
|
|
#
|
|
|
|
# wireless control devices
|
|
|
|
#
|
|
|
|
type wireless_device_t;
|
|
|
|
dev_node(wireless_device_t)
|
|
|
|
|
2006-03-23 19:19:38 +00:00
|
|
|
type xen_device_t;
|
|
|
|
dev_node(xen_device_t)
|
|
|
|
|
2005-10-25 18:13:47 +00:00
|
|
|
type xserver_misc_device_t;
|
|
|
|
dev_node(xserver_misc_device_t)
|
2005-05-10 20:24:26 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# zero_device_t is the type of /dev/zero.
|
|
|
|
#
|
2005-10-25 18:13:47 +00:00
|
|
|
type zero_device_t;
|
|
|
|
dev_node(zero_device_t)
|
2005-09-26 20:26:32 +00:00
|
|
|
mls_trusted_object(zero_device_t)
|
2005-10-24 03:52:35 +00:00
|
|
|
|
2006-03-28 20:26:29 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Rules for all device nodes
|
|
|
|
#
|
|
|
|
|
2010-08-25 15:18:25 +00:00
|
|
|
allow device_node device_t:filesystem associate;
|
|
|
|
|
2006-03-28 20:26:29 +00:00
|
|
|
fs_associate(device_node)
|
|
|
|
fs_associate_tmpfs(device_node)
|
|
|
|
|
|
|
|
files_associate_tmp(device_node)
|
2006-04-10 21:04:51 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Unconfined access to this module
|
|
|
|
#
|
|
|
|
|
|
|
|
allow devices_unconfined_type self:capability sys_rawio;
|
2019-12-20 15:44:20 +00:00
|
|
|
allow devices_unconfined_type device_node:blk_file { manage_blk_file_perms relabelfrom relabelto map execute quotaon mounton audit_access execmod watch };
|
|
|
|
allow devices_unconfined_type device_node:chr_file { manage_chr_file_perms relabelfrom relabelto map execute quotaon mounton execmod audit_access watch };
|
|
|
|
allow devices_unconfined_type mtrr_device_t:file { manage_file_perms relabelfrom relabelto map execute quotaon mounton execute_no_trans entrypoint execmod audit_access watch };
|