fail2ban.te 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. policy_module(fail2ban, 1.5.7)
  2. ########################################
  3. #
  4. # Declarations
  5. #
  6. attribute_role fail2ban_client_roles;
  7. type fail2ban_t;
  8. type fail2ban_exec_t;
  9. init_daemon_domain(fail2ban_t, fail2ban_exec_t)
  10. type fail2ban_initrc_exec_t;
  11. init_script_file(fail2ban_initrc_exec_t)
  12. type fail2ban_log_t;
  13. logging_log_file(fail2ban_log_t)
  14. type fail2ban_var_lib_t;
  15. files_type(fail2ban_var_lib_t)
  16. type fail2ban_var_run_t;
  17. files_pid_file(fail2ban_var_run_t)
  18. type fail2ban_tmp_t;
  19. files_tmp_file(fail2ban_tmp_t)
  20. type fail2ban_client_t;
  21. type fail2ban_client_exec_t;
  22. init_system_domain(fail2ban_client_t, fail2ban_client_exec_t)
  23. role fail2ban_client_roles types fail2ban_client_t;
  24. ########################################
  25. #
  26. # Server Local policy
  27. #
  28. allow fail2ban_t self:capability { dac_read_search dac_override sys_tty_config };
  29. allow fail2ban_t self:process signal;
  30. allow fail2ban_t self:fifo_file rw_fifo_file_perms;
  31. allow fail2ban_t self:unix_stream_socket { accept connectto listen };
  32. allow fail2ban_t self:tcp_socket { accept listen };
  33. read_files_pattern(fail2ban_t, fail2ban_t, fail2ban_t)
  34. append_files_pattern(fail2ban_t, fail2ban_log_t, fail2ban_log_t)
  35. create_files_pattern(fail2ban_t, fail2ban_log_t, fail2ban_log_t)
  36. setattr_files_pattern(fail2ban_t, fail2ban_log_t, fail2ban_log_t)
  37. logging_log_filetrans(fail2ban_t, fail2ban_log_t, file)
  38. manage_dirs_pattern(fail2ban_t, fail2ban_tmp_t, fail2ban_tmp_t)
  39. manage_files_pattern(fail2ban_t, fail2ban_tmp_t, fail2ban_tmp_t)
  40. exec_files_pattern(fail2ban_t, fail2ban_tmp_t, fail2ban_tmp_t)
  41. files_tmp_filetrans(fail2ban_t, fail2ban_tmp_t, { dir file })
  42. manage_dirs_pattern(fail2ban_t, fail2ban_var_lib_t, fail2ban_var_lib_t)
  43. manage_files_pattern(fail2ban_t, fail2ban_var_lib_t, fail2ban_var_lib_t)
  44. manage_dirs_pattern(fail2ban_t, fail2ban_var_run_t, fail2ban_var_run_t)
  45. manage_sock_files_pattern(fail2ban_t, fail2ban_var_run_t, fail2ban_var_run_t)
  46. manage_files_pattern(fail2ban_t, fail2ban_var_run_t, fail2ban_var_run_t)
  47. files_pid_filetrans(fail2ban_t, fail2ban_var_run_t, { file sock_file })
  48. kernel_read_system_state(fail2ban_t)
  49. corecmd_exec_bin(fail2ban_t)
  50. corecmd_exec_shell(fail2ban_t)
  51. corenet_all_recvfrom_unlabeled(fail2ban_t)
  52. corenet_all_recvfrom_netlabel(fail2ban_t)
  53. corenet_tcp_sendrecv_generic_if(fail2ban_t)
  54. corenet_tcp_sendrecv_generic_node(fail2ban_t)
  55. corenet_sendrecv_whois_client_packets(fail2ban_t)
  56. corenet_tcp_connect_whois_port(fail2ban_t)
  57. corenet_tcp_sendrecv_whois_port(fail2ban_t)
  58. dev_read_urand(fail2ban_t)
  59. domain_use_interactive_fds(fail2ban_t)
  60. domain_dontaudit_read_all_domains_state(fail2ban_t)
  61. files_read_etc_runtime_files(fail2ban_t)
  62. files_read_usr_files(fail2ban_t)
  63. files_list_var(fail2ban_t)
  64. files_dontaudit_list_tmp(fail2ban_t)
  65. fs_list_inotifyfs(fail2ban_t)
  66. fs_getattr_all_fs(fail2ban_t)
  67. auth_use_nsswitch(fail2ban_t)
  68. logging_read_all_logs(fail2ban_t)
  69. logging_send_syslog_msg(fail2ban_t)
  70. miscfiles_read_localization(fail2ban_t)
  71. sysnet_manage_config(fail2ban_t)
  72. sysnet_etc_filetrans_config(fail2ban_t)
  73. mta_send_mail(fail2ban_t)
  74. optional_policy(`
  75. apache_read_log(fail2ban_t)
  76. ')
  77. optional_policy(`
  78. ftp_read_log(fail2ban_t)
  79. ')
  80. optional_policy(`
  81. iptables_domtrans(fail2ban_t)
  82. ')
  83. optional_policy(`
  84. libs_exec_ldconfig(fail2ban_t)
  85. ')
  86. optional_policy(`
  87. shorewall_domtrans(fail2ban_t)
  88. ')
  89. ########################################
  90. #
  91. # Client Local policy
  92. #
  93. allow fail2ban_client_t self:capability dac_read_search;
  94. allow fail2ban_client_t self:unix_stream_socket { create connect write read };
  95. allow fail2ban_client_t self:capability sys_tty_config;
  96. domtrans_pattern(fail2ban_client_t, fail2ban_exec_t, fail2ban_t)
  97. stream_connect_pattern(fail2ban_client_t, fail2ban_var_run_t, fail2ban_var_run_t, fail2ban_t)
  98. manage_dirs_pattern(fail2ban_client_t, fail2ban_var_run_t, fail2ban_var_run_t)
  99. manage_sock_files_pattern(fail2ban_client_t, fail2ban_var_run_t, fail2ban_var_run_t)
  100. manage_files_pattern(fail2ban_client_t, fail2ban_var_run_t, fail2ban_var_run_t)
  101. files_pid_filetrans(fail2ban_client_t, fail2ban_var_run_t, { file sock_file })
  102. kernel_read_system_state(fail2ban_client_t)
  103. corecmd_exec_bin(fail2ban_client_t)
  104. domain_use_interactive_fds(fail2ban_client_t)
  105. files_read_etc_files(fail2ban_client_t)
  106. files_read_usr_files(fail2ban_client_t)
  107. files_search_pids(fail2ban_client_t)
  108. logging_getattr_all_logs(fail2ban_client_t)
  109. logging_search_all_logs(fail2ban_client_t)
  110. miscfiles_read_localization(fail2ban_client_t)
  111. userdom_dontaudit_search_user_home_dirs(fail2ban_client_t)
  112. userdom_use_user_terminals(fail2ban_client_t)
  113. term_write_console(fail2ban_client_t)
  114. term_read_console(fail2ban_client_t)