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 cd3ee9
########################################
Chris PeBenito cd3ee9
## <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 e87221
	init_labeled_script_domtrans($1, rbcbind_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
')