Chris PeBenito 76a9fe
policy_module(devices, 1.10.2)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
attribute device_node;
Chris PeBenito 17de1b
attribute memory_raw_read;
Chris PeBenito 17de1b
attribute memory_raw_write;
Chris PeBenito 17de1b
attribute devices_unconfined_type;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# device_t is the type of /dev.
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type device_t;
Chris PeBenito 17de1b
fs_associate_tmpfs(device_t)
Chris PeBenito 17de1b
files_type(device_t)
Chris PeBenito 17de1b
files_mountpoint(device_t)
Chris PeBenito 17de1b
files_associate_tmp(device_t)
Jeremy Solt d6e1ef
fs_type(device_t)
Jeremy Solt d6e1ef
fs_use_trans devtmpfs gen_context(system_u:object_r:device_t,s0);
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Type for /dev/agpgart
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type agp_device_t;
Chris PeBenito 17de1b
dev_node(agp_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Type for /dev/apm_bios
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type apm_bios_t;
Chris PeBenito 17de1b
dev_node(apm_bios_t)
Chris PeBenito 17de1b
Chris PeBenito 7b7620
#
Chris PeBenito 7b7620
# Type for /dev/autofs
Chris PeBenito 7b7620
#
Chris PeBenito 7b7620
type autofs_device_t;
Chris PeBenito 7b7620
dev_node(autofs_device_t)
Chris PeBenito 7b7620
Chris PeBenito 17de1b
type cardmgr_dev_t;
Chris PeBenito 17de1b
dev_node(cardmgr_dev_t)
Chris PeBenito 17de1b
files_tmp_file(cardmgr_dev_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# clock_device_t is the type of
Chris PeBenito 17de1b
# /dev/rtc.
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type clock_device_t;
Chris PeBenito 17de1b
dev_node(clock_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# cpu control devices /dev/cpu/0/*
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type cpu_device_t;
Chris PeBenito 17de1b
dev_node(cpu_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# for the IBM zSeries z90crypt hardware ssl accelorator
Chris PeBenito 17de1b
type crypt_device_t;
Chris PeBenito 17de1b
dev_node(crypt_device_t)
Chris PeBenito 17de1b
Chris PeBenito 053517
#
Chris PeBenito 053517
# dlm_misc_device_t is the type of /dev/misc/dlm.*
Chris PeBenito 053517
#
Chris PeBenito 053517
type dlm_control_device_t;
Chris PeBenito 053517
dev_node(dlm_control_device_t)
Chris PeBenito 053517
Chris PeBenito 17de1b
type dri_device_t;
Chris PeBenito 17de1b
dev_node(dri_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type event_device_t;
Chris PeBenito 17de1b
dev_node(event_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Type for framebuffer /dev/fb/*
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type framebuf_device_t;
Chris PeBenito 17de1b
dev_node(framebuf_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 7b7620
# Type for /dev/ipmi/0
Chris PeBenito 7b7620
#
Chris PeBenito 7b7620
type ipmi_device_t;
Chris PeBenito 7b7620
dev_node(ipmi_device_t)
Chris PeBenito 7b7620
Chris PeBenito 7b7620
#
Chris PeBenito d6d16b
# Type for /dev/kmsg
Chris PeBenito d6d16b
#
Chris PeBenito d6d16b
type kmsg_device_t;
Chris PeBenito d6d16b
dev_node(kmsg_device_t)
Chris PeBenito d6d16b
Chris PeBenito d6d16b
#
Chris PeBenito b51e8e
# ksm_device_t is the type of /dev/ksm
Chris PeBenito b51e8e
#
Chris PeBenito b51e8e
type ksm_device_t;
Chris PeBenito b51e8e
dev_node(ksm_device_t)
Chris PeBenito b51e8e
Chris PeBenito b51e8e
#
Chris PeBenito 7b7620
# kvm_device_t is the type of
Chris PeBenito 7b7620
# /dev/kvm
Chris PeBenito 7b7620
#
Chris PeBenito 7b7620
type kvm_device_t;
Chris PeBenito 7b7620
dev_node(kvm_device_t)
Chris PeBenito 7b7620
Chris PeBenito 7b7620
#
Chris PeBenito b51e8e
# Type for /dev/lirc
Chris PeBenito b51e8e
#
Chris PeBenito b51e8e
type lirc_device_t;
Chris PeBenito b51e8e
dev_node(lirc_device_t)
Chris PeBenito b51e8e
Chris PeBenito b51e8e
#
Chris PeBenito 17de1b
# Type for /dev/mapper/control
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type lvm_control_t;
Chris PeBenito 17de1b
dev_node(lvm_control_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# memory_device_t is the type of /dev/kmem,
Chris PeBenito 17de1b
# /dev/mem and /dev/port.
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type memory_device_t;
Chris PeBenito 17de1b
dev_node(memory_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
neverallow ~{ memory_raw_read devices_unconfined_type } memory_device_t:{ chr_file blk_file } read;
Chris PeBenito 17de1b
neverallow ~{ memory_raw_write devices_unconfined_type } memory_device_t:{ chr_file blk_file } { append write };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type misc_device_t;
Chris PeBenito 17de1b
dev_node(misc_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito b51e8e
# A general type for modem devices.
Chris PeBenito b51e8e
#
Chris PeBenito b51e8e
type modem_device_t;
Chris PeBenito b51e8e
dev_node(modem_device_t)
Chris PeBenito b51e8e
Chris PeBenito b51e8e
#
Chris PeBenito 17de1b
# A more general type for mouse devices.
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type mouse_device_t;
Chris PeBenito 17de1b
dev_node(mouse_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Type for /dev/cpu/mtrr and /proc/mtrr
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type mtrr_device_t;
Chris PeBenito 17de1b
dev_node(mtrr_device_t)
Chris PeBenito 17de1b
genfscon proc /mtrr gen_context(system_u:object_r:mtrr_device_t,s0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito b51e8e
# network control devices
Chris PeBenito 7b7620
#
Chris PeBenito 7b7620
type netcontrol_device_t;
Chris PeBenito 7b7620
dev_node(netcontrol_device_t)
Chris PeBenito 7b7620
Chris PeBenito 7b7620
#
Chris PeBenito 17de1b
# null_device_t is the type of /dev/null.
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type null_device_t;
Chris PeBenito 17de1b
dev_node(null_device_t)
Chris PeBenito 17de1b
mls_trusted_object(null_device_t)
Chris PeBenito 17de1b
sid devnull gen_context(system_u:object_r:null_device_t,s0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito b51e8e
# Type for /dev/nvram
Chris PeBenito a5e213
#
Chris PeBenito a5e213
type nvram_device_t;
Chris PeBenito a5e213
dev_node(nvram_device_t)
Chris PeBenito a5e213
Chris PeBenito a5e213
#
Chris PeBenito b51e8e
# Type for /dev/pmu
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type power_device_t;
Chris PeBenito 17de1b
dev_node(power_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type printer_device_t;
Chris PeBenito 17de1b
dev_node(printer_device_t)
Chris PeBenito f497b8
mls_file_write_within_range(printer_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito b51e8e
# qemu control devices
Chris PeBenito 7b7620
#
Chris PeBenito 7b7620
type qemu_device_t;
Chris PeBenito 7b7620
dev_node(qemu_device_t)
Chris PeBenito 7b7620
Chris PeBenito 7b7620
#
Chris PeBenito 17de1b
# random_device_t is the type of /dev/random
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type random_device_t;
Chris PeBenito 17de1b
dev_node(random_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type scanner_device_t;
Chris PeBenito 17de1b
dev_node(scanner_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito d534d3
# Type for smartcards
Chris PeBenito d534d3
#
Chris PeBenito d534d3
type smartcard_device_t;
Chris PeBenito d534d3
dev_node(smartcard_device_t)
Chris PeBenito d534d3
Chris PeBenito d534d3
#
Chris PeBenito 17de1b
# Type for sound devices and mixers
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type sound_device_t;
Chris PeBenito 17de1b
dev_node(sound_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# sysfs_t is the type for the /sys pseudofs
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type sysfs_t;
Chris PeBenito 17de1b
files_mountpoint(sysfs_t)
Chris PeBenito 17de1b
fs_type(sysfs_t)
Chris PeBenito 17de1b
genfscon sysfs / gen_context(system_u:object_r:sysfs_t,s0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 731008
# Type for /dev/tpm
Chris PeBenito 731008
#
Chris PeBenito 731008
type tpm_device_t;
Chris PeBenito 731008
dev_node(tpm_device_t)
Chris PeBenito 731008
Chris PeBenito 731008
#
Chris PeBenito 17de1b
# urandom_device_t is the type of /dev/urandom
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type urandom_device_t;
Chris PeBenito 17de1b
dev_node(urandom_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# usbfs_t is the type for the /proc/bus/usb pseudofs
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type usbfs_t alias usbdevfs_t;
Chris PeBenito 17de1b
files_mountpoint(usbfs_t)
Chris PeBenito 17de1b
fs_noxattr_type(usbfs_t)
Chris PeBenito 17de1b
genfscon usbfs / gen_context(system_u:object_r:usbfs_t,s0)
Chris PeBenito 17de1b
genfscon usbdevfs / gen_context(system_u:object_r:usbfs_t,s0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# usb_device_t is the type for /dev/bus/usb/[0-9]+/[0-9]+
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type usb_device_t;
Chris PeBenito 17de1b
dev_node(usb_device_t)
Chris PeBenito 17de1b
Chris PeBenito 053517
#
Chris PeBenito fb7cad
# usb_device_t is the type for /dev/usbmon
Chris PeBenito fb7cad
#
Chris PeBenito fb7cad
type usbmon_device_t;
Chris PeBenito fb7cad
dev_node(usbmon_device_t)
Chris PeBenito fb7cad
Chris PeBenito fb7cad
#
Chris PeBenito 053517
# userio_device_t is the type for /dev/uio[0-9]+
Chris PeBenito 053517
#
Chris PeBenito 053517
type userio_device_t;
Chris PeBenito 053517
dev_node(userio_device_t)
Chris PeBenito 053517
Chris PeBenito 17de1b
type v4l_device_t;
Chris PeBenito 17de1b
dev_node(v4l_device_t)
Chris PeBenito 17de1b
Chris PeBenito fb7cad
#
Chris PeBenito fb7cad
# vhost_device_t is the type for /dev/vhost-net
Chris PeBenito fb7cad
#
Chris PeBenito fb7cad
type vhost_device_t;
Chris PeBenito fb7cad
dev_node(vhost_device_t)
Chris PeBenito fb7cad
Chris PeBenito 17de1b
# Type for vmware devices.
Chris PeBenito 17de1b
type vmware_device_t;
Chris PeBenito 17de1b
dev_node(vmware_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type watchdog_device_t;
Chris PeBenito a5e213
dev_node(watchdog_device_t)
Chris PeBenito 17de1b
Chris PeBenito b51e8e
#
Chris PeBenito b51e8e
# wireless control devices
Chris PeBenito b51e8e
#
Chris PeBenito b51e8e
type wireless_device_t;
Chris PeBenito b51e8e
dev_node(wireless_device_t)
Chris PeBenito b51e8e
Chris PeBenito 17de1b
type xen_device_t;
Chris PeBenito 17de1b
dev_node(xen_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type xserver_misc_device_t;
Chris PeBenito 17de1b
dev_node(xserver_misc_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# zero_device_t is the type of /dev/zero.
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type zero_device_t;
Chris PeBenito 17de1b
dev_node(zero_device_t)
Chris PeBenito 17de1b
mls_trusted_object(zero_device_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Rules for all device nodes
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 0d2480
allow device_node device_t:filesystem associate;
Chris PeBenito 0d2480
Chris PeBenito 17de1b
fs_associate(device_node)
Chris PeBenito 17de1b
fs_associate_tmpfs(device_node)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_associate_tmp(device_node)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Unconfined access to this module
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow devices_unconfined_type self:capability sys_rawio;
Chris PeBenito 17de1b
allow devices_unconfined_type device_node:{ blk_file chr_file } *;
Chris PeBenito 8b9ebd
allow devices_unconfined_type mtrr_device_t:file *;