php-fpm.te 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. policy_module(php-fpm, 0.2.14)
  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 dac_override kill };
  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:process { signal execmem };
  35. allow phpfpm_t self:fifo_file getattr;
  36. read_files_pattern(phpfpm_t, phpfpm_etc_t, phpfpm_etc_t)
  37. read_files_pattern(phpfpm_t, php_etc_t, php_etc_t)
  38. read_files_pattern(phpfpm_t,php_usr_lib_t, php_usr_lib_t)
  39. manage_files_pattern(phpfpm_t, phpfpm_tmp_t, phpfpm_tmp_t)
  40. manage_dirs_pattern(phpfpm_t, phpfpm_tmp_t, phpfpm_tmp_t)
  41. files_tmp_filetrans(phpfpm_t, phpfpm_tmp_t, { file dir })
  42. manage_files_pattern(phpfpm_t, phpfpm_var_run_t, phpfpm_var_run_t)
  43. manage_dirs_pattern(phpfpm_t, phpfpm_var_run_t, phpfpm_var_run_t)
  44. files_pid_filetrans(phpfpm_t, phpfpm_var_run_t, { file dir })
  45. manage_files_pattern(phpfpm_t, phpfpm_var_log_t, phpfpm_var_log_t)
  46. append_files_pattern(phpfpm_t, phpfpm_var_log_t, phpfpm_var_log_t)
  47. create_files_pattern(phpfpm_t, phpfpm_var_log_t, phpfpm_var_log_t)
  48. setattr_files_pattern(phpfpm_t, phpfpm_var_log_t, phpfpm_var_log_t)
  49. logging_log_filetrans(phpfpm_t, phpfpm_var_log_t, file)
  50. manage_files_pattern(phpfpm_t, phpfpm_var_lib_t, phpfpm_var_lib_t)
  51. create_files_pattern(phpfpm_t, phpfpm_var_lib_t, phpfpm_var_lib_t)
  52. manage_dirs_pattern(phpfpm_t, phpfpm_var_lib_t, phpfpm_var_lib_t)
  53. files_var_lib_filetrans(phpfpm_t, phpfpm_var_lib_t, { file dir })
  54. mysql_stream_connect(phpfpm_t)
  55. mta_sendmail_exec(phpfpm_t)
  56. dev_read_urand(phpfpm_t)
  57. miscfiles_read_all_certs(phpfpm_t)
  58. corecmd_exec_shell(phpfpm_t)
  59. corenet_tcp_bind_cslistener_port(phpfpm_t)
  60. corenet_tcp_bind_generic_node(phpfpm_t)
  61. corenet_tcp_connect_tor_port(phpfpm_t)
  62. corenet_tcp_bind_all_unreserved_ports(phpfpm_t)
  63. kernel_read_kernel_sysctls(phpfpm_t)
  64. kernel_read_crypto_sysctls(phpfpm_t)
  65. fs_getattr_xattr_fs(phpfpm_t)
  66. fs_rw_hugetlbfs_files(phpfpm_t)
  67. corenet_tcp_connect_http_port(phpfpm_t)
  68. corenet_sendrecv_smtp_client_packets(phpfpm_t)
  69. corenet_tcp_connect_smtp_port(phpfpm_t)
  70. corenet_tcp_sendrecv_smtp_port(phpfpm_t)
  71. corenet_sendrecv_pop_client_packets(phpfpm_t)
  72. corenet_tcp_connect_pop_port(phpfpm_t)
  73. corenet_tcp_sendrecv_pop_port(phpfpm_t)
  74. corenet_tcp_connect_all_unreserved_ports(phpfpm_t)
  75. miscfiles_read_localization(phpfpm_t)
  76. auth_use_nsswitch(phpfpm_t)
  77. read_files_pattern(phpfpm_t, php_usr_lib_t, php_usr_lib_t)
  78. allow phpfpm_t php_usr_lib_t:file execute;
  79. apache_manage_sys_content(phpfpm_t)
  80. kernel_read_system_state(phpfpm_t)
  81. mta_send_mail(phpfpm_t)
  82. mta_signal_system_mail(phpfpm_t)
  83. gen_require(`
  84. type bin_t;
  85. ')
  86. allow phpfpm_t bin_t:dir getattr;
  87. gen_require(`
  88. type initrc_t;
  89. ')
  90. allow initrc_t phpfpm_etc_t:file { read getattr open };
  91. gen_require(`
  92. type usr_t;
  93. ')
  94. read_files_pattern(phpfpm_t, usr_t, usr_t)
  95. optional_policy(`
  96. gen_require(`
  97. type httpd_sys_ra_content_t;
  98. ')
  99. manage_files_pattern(phpfpm_t, httpd_sys_ra_content_t, httpd_sys_ra_content_t)
  100. create_files_pattern(phpfpm_t, httpd_sys_ra_content_t, httpd_sys_ra_content_t)
  101. ')