php-fpm.te 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. policy_module(php-fpm, 0.2.12)
  2. ########################################
  3. #
  4. # Declarations
  5. #
  6. attribute_role phpfpm_roles;
  7. type phpfpm_t;
  8. type phpfpm_exec_t;
  9. init_daemon_domain(phpfpm_t, phpfpm_exec_t)
  10. role phpfpm_roles types phpfpm_t;
  11. type phpfpm_etc_t;
  12. files_config_file(phpfpm_etc_t)
  13. type php_etc_t;
  14. files_config_file(php_etc_t)
  15. type phpfpm_initrc_exec_t;
  16. init_script_file(phpfpm_initrc_exec_t)
  17. type phpfpm_var_run_t;
  18. files_pid_file(phpfpm_var_run_t)
  19. type php_usr_lib_t;
  20. files_type(php_usr_lib_t)
  21. type phpfpm_tmp_t;
  22. files_tmp_file(phpfpm_tmp_t)
  23. type phpfpm_var_log_t;
  24. logging_log_file(phpfpm_var_log_t)
  25. type phpfpm_var_lib_t;
  26. files_type(phpfpm_var_lib_t)
  27. ########################################
  28. #
  29. # Local policy
  30. #
  31. allow phpfpm_t self:capability { setuid setgid };
  32. allow phpfpm_t self:fifo_file { write read };
  33. allow phpfpm_t self:tcp_socket { setopt getopt bind create accept listen };
  34. allow phpfpm_t self:capability kill;
  35. allow phpfpm_t self:process { signal execmem };
  36. allow phpfpm_t self:fifo_file getattr;
  37. read_files_pattern(phpfpm_t, phpfpm_etc_t, phpfpm_etc_t)
  38. read_files_pattern(phpfpm_t, php_etc_t, php_etc_t)
  39. read_files_pattern(phpfpm_t,php_usr_lib_t, php_usr_lib_t)
  40. manage_files_pattern(phpfpm_t, phpfpm_tmp_t, phpfpm_tmp_t)
  41. manage_dirs_pattern(phpfpm_t, phpfpm_tmp_t, phpfpm_tmp_t)
  42. files_tmp_filetrans(phpfpm_t, phpfpm_tmp_t, { file dir })
  43. manage_files_pattern(phpfpm_t, phpfpm_var_run_t, phpfpm_var_run_t)
  44. manage_dirs_pattern(phpfpm_t, phpfpm_var_run_t, phpfpm_var_run_t)
  45. files_pid_filetrans(phpfpm_t, phpfpm_var_run_t, { file dir })
  46. manage_files_pattern(phpfpm_t, phpfpm_var_log_t, phpfpm_var_log_t)
  47. append_files_pattern(phpfpm_t, phpfpm_var_log_t, phpfpm_var_log_t)
  48. create_files_pattern(phpfpm_t, phpfpm_var_log_t, phpfpm_var_log_t)
  49. setattr_files_pattern(phpfpm_t, phpfpm_var_log_t, phpfpm_var_log_t)
  50. logging_log_filetrans(phpfpm_t, phpfpm_var_log_t, file)
  51. manage_files_pattern(phpfpm_t, phpfpm_var_lib_t, phpfpm_var_lib_t)
  52. create_files_pattern(phpfpm_t, phpfpm_var_lib_t, phpfpm_var_lib_t)
  53. manage_dirs_pattern(phpfpm_t, phpfpm_var_lib_t, phpfpm_var_lib_t)
  54. files_var_lib_filetrans(phpfpm_t, phpfpm_var_lib_t, { file dir })
  55. mysql_stream_connect(phpfpm_t)
  56. mta_sendmail_exec(phpfpm_t)
  57. dev_read_urand(phpfpm_t)
  58. miscfiles_read_all_certs(phpfpm_t)
  59. corecmd_exec_shell(phpfpm_t)
  60. corenet_tcp_bind_cslistener_port(phpfpm_t)
  61. corenet_tcp_bind_generic_node(phpfpm_t)
  62. corenet_tcp_connect_tor_port(phpfpm_t)
  63. corenet_tcp_bind_all_unreserved_ports(phpfpm_t)
  64. kernel_read_kernel_sysctls(phpfpm_t)
  65. kernel_read_crypto_sysctls(phpfpm_t)
  66. fs_getattr_xattr_fs(phpfpm_t)
  67. fs_rw_hugetlbfs_files(phpfpm_t)
  68. corenet_tcp_connect_http_port(phpfpm_t)
  69. corenet_sendrecv_smtp_client_packets(phpfpm_t)
  70. corenet_tcp_connect_smtp_port(phpfpm_t)
  71. corenet_tcp_sendrecv_smtp_port(phpfpm_t)
  72. corenet_sendrecv_pop_client_packets(phpfpm_t)
  73. corenet_tcp_connect_pop_port(phpfpm_t)
  74. corenet_tcp_sendrecv_pop_port(phpfpm_t)
  75. corenet_tcp_connect_all_unreserved_ports(phpfpm_t)
  76. miscfiles_read_localization(phpfpm_t)
  77. auth_use_nsswitch(phpfpm_t)
  78. read_files_pattern(phpfpm_t, php_usr_lib_t, php_usr_lib_t)
  79. allow phpfpm_t php_usr_lib_t:file execute;
  80. apache_manage_sys_content(phpfpm_t)
  81. kernel_read_system_state(phpfpm_t)
  82. mta_send_mail(phpfpm_t)
  83. mta_signal_system_mail(phpfpm_t)
  84. gen_require(`
  85. type bin_t;
  86. ')
  87. allow phpfpm_t bin_t:dir getattr;
  88. gen_require(`
  89. type initrc_t;
  90. ')
  91. allow initrc_t phpfpm_etc_t:file { read getattr open };
  92. gen_require(`
  93. type usr_t;
  94. ')
  95. read_files_pattern(phpfpm_t, usr_t, usr_t)
  96. optional_policy(`
  97. gen_require(`
  98. type httpd_sys_ra_content_t;
  99. ')
  100. manage_files_pattern(phpfpm_t, httpd_sys_ra_content_t, httpd_sys_ra_content_t)
  101. create_files_pattern(phpfpm_t, httpd_sys_ra_content_t, httpd_sys_ra_content_t)
  102. ')