Chris PeBenito cd3ee9
## <summary>Update firewall filtering to ban IP addresses with too many password failures.</summary>
Chris PeBenito cd3ee9
Chris PeBenito cd3ee9
########################################
Chris PeBenito cd3ee9
## <summary>
Chris PeBenito cd3ee9
##	Execute a domain transition to run fail2ban.
Chris PeBenito cd3ee9
## </summary>
Chris PeBenito cd3ee9
## <param name="domain">
Chris PeBenito cd3ee9
## <summary>
Chris PeBenito cd3ee9
##	Domain allowed to transition.
Chris PeBenito cd3ee9
## </summary>
Chris PeBenito cd3ee9
## </param>
Chris PeBenito cd3ee9
#
Chris PeBenito cd3ee9
interface(`fail2ban_domtrans',`
Chris PeBenito cd3ee9
	gen_require(`
Chris PeBenito cd3ee9
		type fail2ban_t, fail2ban_exec_t;
Chris PeBenito cd3ee9
	')
Chris PeBenito cd3ee9
Chris PeBenito 0bfccd
	domtrans_pattern($1, fail2ban_exec_t, fail2ban_t)
Chris PeBenito cd3ee9
')
Chris PeBenito cd3ee9
Chris PeBenito bf140f
#####################################
Chris PeBenito bf140f
## <summary>
Chris PeBenito bf140f
##	Connect to fail2ban over a unix domain
Chris PeBenito bf140f
##	stream socket.
Chris PeBenito bf140f
## </summary>
Chris PeBenito bf140f
## <param name="domain">
Chris PeBenito bf140f
##	<summary>
Chris PeBenito bf140f
##	Domain allowed access.
Chris PeBenito bf140f
##	</summary>
Chris PeBenito bf140f
## </param>
Chris PeBenito bf140f
#
Chris PeBenito bf140f
interface(`fail2ban_stream_connect',`
Chris PeBenito bf140f
	gen_require(`
Chris PeBenito bf140f
		type fail2ban_t, fail2ban_var_run_t;
Chris PeBenito bf140f
	')
Chris PeBenito bf140f
Chris PeBenito bf140f
	files_search_pids($1)
Chris PeBenito bf140f
	stream_connect_pattern($1, fail2ban_var_run_t, fail2ban_var_run_t, fail2ban_t)
Chris PeBenito bf140f
')
Chris PeBenito bf140f
Chris PeBenito bf140f
########################################
Chris PeBenito bf140f
## <summary>
Chris PeBenito bf140f
##	Read and write to an fail2ban unix stream socket.
Chris PeBenito bf140f
## </summary>
Chris PeBenito bf140f
## <param name="domain">
Chris PeBenito bf140f
##	<summary>
Chris PeBenito bf140f
##	Domain allowed access.
Chris PeBenito bf140f
##	</summary>
Chris PeBenito bf140f
## </param>
Chris PeBenito bf140f
#
Chris PeBenito bf140f
interface(`fail2ban_rw_stream_sockets',`
Chris PeBenito bf140f
	gen_require(`
Chris PeBenito bf140f
		type fail2ban_t;
Chris PeBenito bf140f
	')
Chris PeBenito bf140f
Chris PeBenito bf140f
	allow $1 fail2ban_t:unix_stream_socket rw_stream_socket_perms;
Chris PeBenito bf140f
')
Chris PeBenito bf140f
Chris PeBenito cd3ee9
########################################
Chris PeBenito cd3ee9
## <summary>
Chris PeBenito 455155
##	Read fail2ban lib files.
Chris PeBenito 455155
## </summary>
Chris PeBenito 455155
## <param name="domain">
Chris PeBenito 455155
##	<summary>
Chris PeBenito 455155
##	Domain allowed access.
Chris PeBenito 455155
##	</summary>
Chris PeBenito 455155
## </param>
Chris PeBenito 455155
#
Chris PeBenito 455155
interface(`fail2ban_read_lib_files',`
Chris PeBenito 455155
	gen_require(`
Chris PeBenito 455155
		type fail2ban_var_lib_t;
Chris PeBenito 455155
	')
Chris PeBenito 455155
Chris PeBenito 455155
	files_search_var_lib($1)
Chris PeBenito 455155
	allow $1 fail2ban_var_lib_t:file read_file_perms;
Chris PeBenito 455155
')
Chris PeBenito 455155
Chris PeBenito 455155
########################################
Chris PeBenito 455155
## <summary>
Chris PeBenito cd3ee9
##	Allow the specified domain to read fail2ban's log files.
Chris PeBenito cd3ee9
## </summary>
Chris PeBenito cd3ee9
## <param name="domain">
Chris PeBenito cd3ee9
##	<summary>
Chris PeBenito cd3ee9
##	Domain allowed access.
Chris PeBenito cd3ee9
##	</summary>
Chris PeBenito cd3ee9
## </param>
Chris PeBenito cd3ee9
## <rolecap/>
Chris PeBenito cd3ee9
#
Chris PeBenito cd3ee9
interface(`fail2ban_read_log',`
Chris PeBenito cd3ee9
	gen_require(`
Chris PeBenito cd3ee9
		type fail2ban_log_t;
Chris PeBenito cd3ee9
	')
Chris PeBenito cd3ee9
Chris PeBenito cd3ee9
	logging_search_logs($1)
Chris PeBenito cd3ee9
	allow $1 fail2ban_log_t:dir list_dir_perms;
Chris PeBenito 82d277
	allow $1 fail2ban_log_t:file read_file_perms;
Chris PeBenito cd3ee9
')
Chris PeBenito cd3ee9
Chris PeBenito cd3ee9
########################################
Chris PeBenito cd3ee9
## <summary>
Chris PeBenito cd3ee9
##	Allow the specified domain to append
Chris PeBenito cd3ee9
##	fail2ban log files.
Chris PeBenito cd3ee9
## </summary>
Chris PeBenito cd3ee9
## <param name="domain">
Chris PeBenito cd3ee9
## 	<summary>
Chris PeBenito cd3ee9
##	Domain allowed to transition.
Chris PeBenito cd3ee9
## 	</summary>
Chris PeBenito cd3ee9
## </param>
Chris PeBenito cd3ee9
#
Chris PeBenito cd3ee9
interface(`fail2ban_append_log',`
Chris PeBenito cd3ee9
	gen_require(`
Chris PeBenito cd3ee9
		type fail2ban_log_t;
Chris PeBenito cd3ee9
	')
Chris PeBenito cd3ee9
Chris PeBenito cd3ee9
	logging_search_logs($1)
Chris PeBenito cd3ee9
	allow $1 fail2ban_log_t:dir list_dir_perms;
Chris PeBenito cd3ee9
	allow $1 fail2ban_log_t:file append_file_perms;
Chris PeBenito cd3ee9
')
Chris PeBenito cd3ee9
Chris PeBenito cd3ee9
########################################
Chris PeBenito cd3ee9
## <summary>
Chris PeBenito cd3ee9
##	Read fail2ban PID files.
Chris PeBenito cd3ee9
## </summary>
Chris PeBenito cd3ee9
## <param name="domain">
Chris PeBenito cd3ee9
##	<summary>
Chris PeBenito cd3ee9
##	Domain allowed access.
Chris PeBenito cd3ee9
##	</summary>
Chris PeBenito cd3ee9
## </param>
Chris PeBenito cd3ee9
#
Chris PeBenito cd3ee9
interface(`fail2ban_read_pid_files',`
Chris PeBenito cd3ee9
	gen_require(`
Chris PeBenito cd3ee9
		type fail2ban_var_run_t;
Chris PeBenito cd3ee9
	')
Chris PeBenito cd3ee9
Chris PeBenito cd3ee9
	files_search_pids($1)
Chris PeBenito cd3ee9
	allow $1 fail2ban_var_run_t:file read_file_perms;
Chris PeBenito cd3ee9
')
Chris PeBenito e87221
Chris PeBenito e87221
########################################
Chris PeBenito e87221
## <summary>
Chris PeBenito e87221
##	All of the rules required to administrate 
Chris PeBenito e87221
##	an fail2ban environment
Chris PeBenito e87221
## </summary>
Chris PeBenito e87221
## <param name="domain">
Chris PeBenito e87221
##	<summary>
Chris PeBenito e87221
##	Domain allowed access.
Chris PeBenito e87221
##	</summary>
Chris PeBenito e87221
## </param>
Chris PeBenito e87221
## <param name="role">
Chris PeBenito e87221
##	<summary>
Chris PeBenito e87221
##	The role to be allowed to manage the fail2ban domain.
Chris PeBenito e87221
##	</summary>
Chris PeBenito e87221
## </param>
Chris PeBenito e87221
## <rolecap/>
Chris PeBenito e87221
#
Chris PeBenito e87221
interface(`fail2ban_admin',`
Chris PeBenito e87221
	gen_require(`
Chris PeBenito e87221
		type fail2ban_t, fail2ban_log_t;
Chris PeBenito e87221
		type fail2ban_var_run_t, fail2ban_initrc_exec_t;
Chris PeBenito e87221
	')
Chris PeBenito e87221
Chris PeBenito e87221
	allow $1 fail2ban_t:process { ptrace signal_perms };
Chris PeBenito e87221
	ps_process_pattern($1, fail2ban_t)
Chris PeBenito e87221
Chris PeBenito 455155
	init_labeled_script_domtrans($1, fail2ban_initrc_exec_t)
Chris PeBenito e87221
	domain_system_change_exemption($1)
Chris PeBenito e87221
	role_transition $2 fail2ban_initrc_exec_t system_r;
Chris PeBenito e87221
	allow $2 system_r;
Chris PeBenito e87221
Chris PeBenito e87221
	logging_list_logs($1)
Chris PeBenito e87221
	admin_pattern($1, fail2ban_log_t)
Chris PeBenito e87221
Chris PeBenito e87221
	files_list_pids($1)
Chris PeBenito e87221
	admin_pattern($1, fail2ban_var_run_t)
Chris PeBenito e87221
')