udev.te 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. policy_module(udev, 1.17.5)
  2. ########################################
  3. #
  4. # Declarations
  5. #
  6. type udev_t;
  7. type udev_exec_t;
  8. type udev_helper_exec_t;
  9. kernel_domtrans_to(udev_t, udev_exec_t)
  10. domain_obj_id_change_exemption(udev_t)
  11. domain_entry_file(udev_t, udev_helper_exec_t)
  12. domain_interactive_fd(udev_t)
  13. init_daemon_domain(udev_t, udev_exec_t)
  14. type udev_etc_t alias etc_udev_t;
  15. files_config_file(udev_etc_t)
  16. type udev_tbl_t alias udev_tdb_t;
  17. files_type(udev_tbl_t)
  18. type udev_rules_t;
  19. files_type(udev_rules_t)
  20. type udev_var_run_t;
  21. files_pid_file(udev_var_run_t)
  22. init_daemon_run_dir(udev_var_run_t, "udev")
  23. ifdef(`enable_mcs',`
  24. kernel_ranged_domtrans_to(udev_t, udev_exec_t, s0 - mcs_systemhigh)
  25. init_ranged_daemon_domain(udev_t, udev_exec_t, s0 - mcs_systemhigh)
  26. ')
  27. ########################################
  28. #
  29. # Local policy
  30. #
  31. allow udev_t self:capability { chown dac_override dac_read_search fowner fsetid sys_admin mknod net_raw net_admin sys_nice sys_rawio sys_resource setuid setgid sys_nice sys_ptrace };
  32. dontaudit udev_t self:capability sys_tty_config;
  33. allow udev_t self:capability2 block_suspend;
  34. allow udev_t self:process ~{ setcurrent setexec setfscreate setrlimit execmem execstack execheap };
  35. allow udev_t self:process { execmem setfscreate };
  36. allow udev_t self:fd use;
  37. allow udev_t self:fifo_file rw_fifo_file_perms;
  38. allow udev_t self:sock_file read_sock_file_perms;
  39. allow udev_t self:shm create_shm_perms;
  40. allow udev_t self:sem create_sem_perms;
  41. allow udev_t self:msgq create_msgq_perms;
  42. allow udev_t self:msg { send receive };
  43. allow udev_t self:unix_stream_socket { listen accept };
  44. allow udev_t self:unix_dgram_socket sendto;
  45. allow udev_t self:unix_stream_socket connectto;
  46. allow udev_t self:netlink_kobject_uevent_socket create_socket_perms;
  47. allow udev_t self:rawip_socket create_socket_perms;
  48. fs_read_cgroup_files(udev_t)
  49. # for systemd-udevd to rename interfaces
  50. allow udev_t self:netlink_route_socket nlmsg_write;
  51. allow udev_t udev_exec_t:file write;
  52. can_exec(udev_t, udev_exec_t)
  53. allow udev_t udev_helper_exec_t:dir list_dir_perms;
  54. can_exec(udev_t, udev_helper_exec_t)
  55. # read udev config
  56. allow udev_t udev_etc_t:file read_file_perms;
  57. allow udev_t udev_tbl_t:file manage_file_perms;
  58. dev_filetrans(udev_t, udev_tbl_t, file)
  59. list_dirs_pattern(udev_t, udev_rules_t, udev_rules_t)
  60. manage_files_pattern(udev_t, udev_rules_t, udev_rules_t)
  61. manage_lnk_files_pattern(udev_t, udev_rules_t, udev_rules_t)
  62. manage_dirs_pattern(udev_t, udev_var_run_t, udev_var_run_t)
  63. manage_files_pattern(udev_t, udev_var_run_t, udev_var_run_t)
  64. manage_lnk_files_pattern(udev_t, udev_var_run_t, udev_var_run_t)
  65. manage_sock_files_pattern(udev_t, udev_var_run_t, udev_var_run_t)
  66. files_pid_filetrans(udev_t, udev_var_run_t, dir, "udev")
  67. kernel_read_system_state(udev_t)
  68. kernel_request_load_module(udev_t)
  69. modutils_read_module_objects(udev_t)
  70. # systemd-udevd needs kernel_load_module and files_read_kernel_modules
  71. kernel_load_module(udev_t)
  72. files_read_kernel_modules(udev_t)
  73. # systemd-udevd searches /run/systemd
  74. init_search_pid_dirs(udev_t)
  75. # for hdparm init script run by udev
  76. initrc_service_status(udev_t)
  77. kernel_getattr_core_if(udev_t)
  78. kernel_use_fds(udev_t)
  79. kernel_read_device_sysctls(udev_t)
  80. kernel_read_hotplug_sysctls(udev_t)
  81. kernel_read_modprobe_sysctls(udev_t)
  82. kernel_read_kernel_sysctls(udev_t)
  83. kernel_rw_hotplug_sysctls(udev_t)
  84. kernel_rw_unix_dgram_sockets(udev_t)
  85. kernel_dgram_send(udev_t)
  86. kernel_signal(udev_t)
  87. kernel_search_debugfs(udev_t)
  88. #https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=235182
  89. kernel_rw_net_sysctls(udev_t)
  90. kernel_read_network_state(udev_t)
  91. kernel_read_software_raid_state(udev_t)
  92. kernel_dontaudit_search_unlabeled(udev_t)
  93. corecmd_exec_all_executables(udev_t)
  94. dev_rw_sysfs(udev_t)
  95. dev_manage_all_dev_nodes(udev_t)
  96. dev_rw_generic_files(udev_t)
  97. dev_delete_generic_files(udev_t)
  98. dev_search_usbfs(udev_t)
  99. dev_relabel_all_dev_nodes(udev_t)
  100. # udev_node.c/node_symlink() symlink labels are explicitly
  101. # preserved, instead of short circuiting the relabel
  102. dev_relabel_generic_symlinks(udev_t)
  103. dev_manage_generic_symlinks(udev_t)
  104. domain_read_all_domains_state(udev_t)
  105. domain_dontaudit_ptrace_all_domains(udev_t) #pidof triggers these
  106. files_read_usr_files(udev_t)
  107. files_read_etc_runtime_files(udev_t)
  108. files_read_etc_files(udev_t)
  109. files_exec_etc_files(udev_t)
  110. files_getattr_generic_locks(udev_t)
  111. files_search_mnt(udev_t)
  112. fs_getattr_all_fs(udev_t)
  113. fs_list_inotifyfs(udev_t)
  114. fs_rw_anon_inodefs_files(udev_t)
  115. mcs_ptrace_all(udev_t)
  116. mls_file_read_all_levels(udev_t)
  117. mls_file_write_all_levels(udev_t)
  118. mls_file_upgrade(udev_t)
  119. mls_file_downgrade(udev_t)
  120. mls_process_write_down(udev_t)
  121. selinux_get_fs_mount(udev_t)
  122. selinux_validate_context(udev_t)
  123. selinux_compute_access_vector(udev_t)
  124. selinux_compute_create_context(udev_t)
  125. selinux_compute_relabel_context(udev_t)
  126. selinux_compute_user_contexts(udev_t)
  127. auth_read_pam_console_data(udev_t)
  128. auth_domtrans_pam_console(udev_t)
  129. auth_use_nsswitch(udev_t)
  130. init_read_utmp(udev_t)
  131. init_dontaudit_write_utmp(udev_t)
  132. init_getattr_initctl(udev_t)
  133. logging_search_logs(udev_t)
  134. logging_send_syslog_msg(udev_t)
  135. logging_send_audit_msgs(udev_t)
  136. miscfiles_read_localization(udev_t)
  137. miscfiles_read_hwdata(udev_t)
  138. modutils_domtrans_insmod(udev_t)
  139. modutils_read_module_config(udev_t)
  140. # read modules.inputmap:
  141. modutils_read_module_deps(udev_t)
  142. seutil_read_config(udev_t)
  143. seutil_read_default_contexts(udev_t)
  144. seutil_read_file_contexts(udev_t)
  145. seutil_domtrans_setfiles(udev_t)
  146. sysnet_domtrans_ifconfig(udev_t)
  147. sysnet_domtrans_dhcpc(udev_t)
  148. sysnet_rw_dhcp_config(udev_t)
  149. sysnet_read_dhcpc_pid(udev_t)
  150. sysnet_delete_dhcpc_pid(udev_t)
  151. sysnet_signal_dhcpc(udev_t)
  152. sysnet_manage_config(udev_t)
  153. sysnet_etc_filetrans_config(udev_t)
  154. systemd_login_read_pid_files(udev_t)
  155. userdom_dontaudit_search_user_home_content(udev_t)
  156. ifdef(`distro_debian',`
  157. files_pid_filetrans(udev_t, udev_var_run_t, dir, "xen-hotplug")
  158. optional_policy(`
  159. # for /usr/lib/avahi/avahi-daemon-check-dns.sh
  160. kernel_read_vm_sysctls(udev_t)
  161. corenet_udp_bind_generic_node(udev_t)
  162. miscfiles_read_generic_certs(udev_t)
  163. avahi_create_pid_dirs(udev_t)
  164. avahi_initrc_domtrans(udev_t)
  165. avahi_manage_pid_files(udev_t)
  166. avahi_setattr_pid_dirs(udev_t)
  167. avahi_filetrans_pid(udev_t, dir, "avahi-daemon")
  168. ')
  169. ')
  170. optional_policy(`
  171. # for systemd-udevd when starting xen domu
  172. virt_read_config(udev_t)
  173. ')
  174. ifdef(`distro_gentoo',`
  175. # during boot, init scripts use /dev/.rcsysinit
  176. # existance to determine if we are in early booting
  177. init_getattr_script_status_files(udev_t)
  178. ')
  179. ifdef(`distro_redhat',`
  180. fs_manage_tmpfs_dirs(udev_t)
  181. fs_manage_tmpfs_files(udev_t)
  182. fs_manage_tmpfs_symlinks(udev_t)
  183. fs_manage_tmpfs_sockets(udev_t)
  184. fs_manage_tmpfs_blk_files(udev_t)
  185. fs_manage_tmpfs_chr_files(udev_t)
  186. fs_relabel_tmpfs_blk_file(udev_t)
  187. fs_relabel_tmpfs_chr_file(udev_t)
  188. term_search_ptys(udev_t)
  189. # for arping used for static IP addresses on PCMCIA ethernet
  190. netutils_domtrans(udev_t)
  191. optional_policy(`
  192. unconfined_domain(udev_t)
  193. ')
  194. ')
  195. optional_policy(`
  196. alsa_domtrans(udev_t)
  197. alsa_read_lib(udev_t)
  198. alsa_read_rw_config(udev_t)
  199. ')
  200. optional_policy(`
  201. bluetooth_domtrans(udev_t)
  202. ')
  203. optional_policy(`
  204. brctl_domtrans(udev_t)
  205. ')
  206. optional_policy(`
  207. clock_domtrans(udev_t)
  208. ')
  209. optional_policy(`
  210. consoletype_exec(udev_t)
  211. ')
  212. optional_policy(`
  213. consolekit_read_pid_files(udev_t)
  214. ')
  215. optional_policy(`
  216. cups_domtrans_config(udev_t)
  217. ')
  218. optional_policy(`
  219. dbus_system_bus_client(udev_t)
  220. dbus_use_system_bus_fds(udev_t)
  221. optional_policy(`
  222. consolekit_dbus_chat(udev_t)
  223. ')
  224. ')
  225. optional_policy(`
  226. devicekit_read_pid_files(udev_t)
  227. devicekit_dgram_send(udev_t)
  228. ')
  229. optional_policy(`
  230. lvm_domtrans(udev_t)
  231. ')
  232. optional_policy(`
  233. fstools_domtrans(udev_t)
  234. ')
  235. optional_policy(`
  236. hal_dgram_send(udev_t)
  237. ifdef(`hide_broken_symptoms',`
  238. hal_dontaudit_rw_dgram_sockets(udev_t)
  239. ')
  240. ')
  241. optional_policy(`
  242. hotplug_read_config(udev_t)
  243. # usb.agent searches /var/run/usb
  244. hotplug_search_pids(udev_t)
  245. ')
  246. optional_policy(`
  247. lvm_domtrans(udev_t)
  248. ')
  249. optional_policy(`
  250. mount_domtrans(udev_t)
  251. ')
  252. optional_policy(`
  253. openct_read_pid_files(udev_t)
  254. openct_domtrans(udev_t)
  255. ')
  256. optional_policy(`
  257. pcscd_read_pid_files(udev_t)
  258. pcscd_domtrans(udev_t)
  259. ')
  260. optional_policy(`
  261. raid_domtrans_mdadm(udev_t)
  262. ')
  263. optional_policy(`
  264. unconfined_signal(udev_t)
  265. ')
  266. optional_policy(`
  267. vbetool_domtrans(udev_t)
  268. ')
  269. optional_policy(`
  270. kernel_write_xen_state(udev_t)
  271. kernel_read_xen_state(udev_t)
  272. xen_manage_log(udev_t)
  273. xen_read_image_files(udev_t)
  274. fs_manage_xenfs_files(udev_t)
  275. ')
  276. optional_policy(`
  277. xserver_read_xdm_pid(udev_t)
  278. ')
  279. optional_policy(`
  280. postfix_admin(udev_t, system_r)
  281. ')
  282. optional_policy(`
  283. gen_require(`
  284. type udev_t;
  285. type ndc_exec_t;
  286. type ndc_t;
  287. ')
  288. domain_auto_trans(udev_t, ndc_exec_t, ndc_t)
  289. ')
  290. optional_policy(`
  291. gen_require(`
  292. type udev_t;
  293. type sshd_var_run_t;
  294. ')
  295. ssh_domtrans(udev_t)
  296. read_files_pattern(udev_t, sshd_var_run_t, sshd_var_run_t)
  297. ')