atop.te 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. policy_module(atop, 0.1.21)
  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. allow atop_t atopacct_t:sem { associate read unix_write write };
  39. manage_dirs_pattern(atop_t, atop_var_log_t, atop_var_log_t)
  40. manage_files_pattern(atop_t, atop_var_log_t, atop_var_log_t)
  41. logging_log_filetrans(atop_t, atop_var_log_t, file)
  42. manage_dirs_pattern(atop_t, atop_var_cache_t, atop_var_cache_t)
  43. manage_files_pattern(atop_t, atop_var_cache_t, atop_var_cache_t)
  44. manage_dirs_pattern(atop_t, atop_var_run_t, atop_var_run_t)
  45. manage_files_pattern(atop_t, atop_var_run_t, atop_var_run_t)
  46. files_pid_filetrans(atop_t, atop_var_run_t, { file dir })
  47. read_files_pattern(atop_t, atopacct_var_run_t, atopacct_var_run_t)
  48. corecmd_exec_bin(atop_t)
  49. optional_policy(`
  50. gen_require(`
  51. type initrc_t;
  52. ')
  53. allow atop_t initrc_t:sem { read unix_write write associate };
  54. ')
  55. userdom_getattr_user_home_dirs(atop_t)
  56. kernel_getattr_proc(atop_t)
  57. kernel_search_proc(atop_t)
  58. kernel_list_proc(atop_t)
  59. kernel_getattr_proc_files(atop_t)
  60. kernel_read_proc_symlinks(atop_t)
  61. kernel_read_system_state(atop_t)
  62. kernel_get_sysvipc_info(atop_t)
  63. kernel_read_kernel_sysctls(atop_t)
  64. kernel_read_rpc_sysctls(atop_t)
  65. domain_read_all_domains_state(atop_t)
  66. corecmd_shell_entry_type(atop_t)
  67. kernel_read_network_state(atop_t)
  68. fs_getattr_tmpfs(atop_t)
  69. fs_getattr_xattr_fs(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. allow atopacct_t self:sem { read unix_read };
  82. manage_dirs_pattern(atopacct_t, atopacct_var_run_t, atopacct_var_run_t)
  83. manage_files_pattern(atopacct_t, atopacct_var_run_t, atopacct_var_run_t)
  84. files_pid_filetrans(atopacct_t, atopacct_var_run_t, { file dir })
  85. logging_send_syslog_msg(atopacct_t)
  86. miscfiles_read_localization(atopacct_t)
  87. kernel_read_system_state(atopacct_t)
  88. fs_getattr_tmpfs(atopacct_t)
  89. optional_policy(`
  90. gen_require(`
  91. type initrc_t;
  92. ')
  93. allow atopacct_t initrc_t:sem { associate read unix_read unix_write write };
  94. ')