atop.te 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. policy_module(atop, 0.1.15)
  2. ########################################
  3. #
  4. # Declarations
  5. #
  6. attribute_role atop_roles;
  7. type atop_t;
  8. type atop_exec_t;
  9. init_daemon_domain(atop_t, atop_exec_t)
  10. role atop_roles types atop_t;
  11. type atopacct_t;
  12. type atopacct_exec_t;
  13. init_daemon_domain(atopacct_t, atopacct_exec_t)
  14. type atop_initrc_exec_t;
  15. init_script_file(atop_initrc_exec_t)
  16. type atopacct_initrc_exec_t;
  17. init_script_file(atopacct_initrc_exec_t)
  18. type atop_var_log_t;
  19. logging_log_file(atop_var_log_t)
  20. type atop_var_run_t;
  21. files_pid_file(atop_var_run_t)
  22. type atopacct_var_run_t;
  23. files_pid_file(atopacct_var_run_t)
  24. type atop_var_cache_t;
  25. files_type(atop_var_cache_t)
  26. ########################################
  27. #
  28. # Local policy
  29. #
  30. allow atop_t atop_exec_t:file execute_no_trans;
  31. allow atop_t self:capability { setuid sys_nice sys_resource ipc_lock sys_pacct dac_override net_raw sys_ptrace };
  32. allow atop_t self:process { setsched sigkill setrlimit setpgid signal };
  33. allow atop_t self:sem { write read create unix_write unix_read };
  34. allow atop_t self:udp_socket { create ioctl };
  35. allow atop_t self:sem associate;
  36. allow atop_t self:rawip_socket { create getopt };
  37. allow atop_t self:fifo_file { getattr ioctl read write };
  38. manage_dirs_pattern(atop_t, atop_var_log_t, atop_var_log_t)
  39. append_files_pattern(atop_t, atop_var_log_t, atop_var_log_t)
  40. create_files_pattern(atop_t, atop_var_log_t, atop_var_log_t)
  41. setattr_files_pattern(atop_t, atop_var_log_t, atop_var_log_t)
  42. rw_files_pattern(atop_t, atop_var_log_t, atop_var_log_t)
  43. logging_log_filetrans(atop_t, atop_var_log_t, file)
  44. manage_dirs_pattern(atop_t, atop_var_cache_t, atop_var_cache_t)
  45. manage_files_pattern(atop_t, atop_var_cache_t, atop_var_cache_t)
  46. manage_dirs_pattern(atop_t, atop_var_run_t, atop_var_run_t)
  47. manage_files_pattern(atop_t, atop_var_run_t, atop_var_run_t)
  48. files_pid_filetrans(atop_t, atop_var_run_t, { file dir })
  49. read_files_pattern(atop_t, atopacct_var_run_t, atopacct_var_run_t)
  50. corecmd_exec_bin(atop_t)
  51. optional_policy(`
  52. gen_require(`
  53. type initrc_t;
  54. ')
  55. allow atop_t initrc_t:sem { read unix_write write associate };
  56. ')
  57. userdom_getattr_user_home_dirs(atop_t)
  58. kernel_getattr_proc(atop_t)
  59. kernel_search_proc(atop_t)
  60. kernel_list_proc(atop_t)
  61. kernel_getattr_proc_files(atop_t)
  62. kernel_read_proc_symlinks(atop_t)
  63. kernel_read_system_state(atop_t)
  64. kernel_get_sysvipc_info(atop_t)
  65. kernel_read_kernel_sysctls(atop_t)
  66. domain_read_all_domains_state(atop_t)
  67. corecmd_shell_entry_type(atop_t)
  68. kernel_read_network_state(atop_t)
  69. fs_getattr_tmpfs(atop_t)
  70. auth_use_nsswitch(atop_t)
  71. storage_getattr_fixed_disk_dev(atop_t)
  72. miscfiles_read_localization(atop_t)
  73. dev_getattr_lvm_control(atop_t)
  74. cron_system_entry(atop_t, atop_exec_t)
  75. init_read_utmp(atop_t)
  76. ### atopacct policy
  77. allow atopacct_t self:capability { net_admin sys_nice sys_pacct };
  78. allow atopacct_t self:netlink_generic_socket { bind create read setopt write };
  79. allow atopacct_t self:process { setsched signal };
  80. allow atopacct_t self:unix_dgram_socket { connect create write };
  81. manage_dirs_pattern(atopacct_t, atopacct_var_run_t, atopacct_var_run_t)
  82. manage_files_pattern(atopacct_t, atopacct_var_run_t, atopacct_var_run_t)
  83. files_pid_filetrans(atopacct_t, atopacct_var_run_t, { file dir })
  84. logging_send_syslog_msg(atopacct_t)
  85. miscfiles_read_localization(atopacct_t)
  86. kernel_read_system_state(atopacct_t)
  87. fs_getattr_tmpfs(atopacct_t)
  88. optional_policy(`
  89. gen_require(`
  90. type initrc_t;
  91. ')
  92. allow atopacct_t initrc_t:sem { associate read unix_read unix_write write };
  93. ')