Chris PeBenito e07fbc
## <summary>DenyHosts SSH dictionary attack mitigation</summary>
Chris PeBenito e07fbc
## <desc>
Chris PeBenito e07fbc
##	

Chris PeBenito e07fbc
##	DenyHosts is a script intended to be run by Linux
Chris PeBenito e07fbc
##	system administrators to help thwart SSH server attacks
Chris PeBenito e07fbc
##	(also known as dictionary based attacks and brute force
Chris PeBenito e07fbc
##	attacks).
Chris PeBenito e07fbc
##	

Chris PeBenito e07fbc
## </desc>
Chris PeBenito e07fbc
Chris PeBenito e07fbc
########################################
Chris PeBenito e07fbc
## <summary>
Chris PeBenito e07fbc
##	Execute a domain transition to run denyhosts.
Chris PeBenito e07fbc
## </summary>
Chris PeBenito e07fbc
## <param name="domain">
Chris PeBenito e07fbc
## <summary>
Chris PeBenito e07fbc
##	Domain allowed to transition.
Chris PeBenito e07fbc
## </summary>
Chris PeBenito e07fbc
## </param>
Chris PeBenito e07fbc
#
Chris PeBenito e07fbc
interface(`denyhosts_domtrans', `
Chris PeBenito e07fbc
	gen_require(`
Chris PeBenito e07fbc
		type denyhosts_t, denyhosts_exec_t;
Chris PeBenito e07fbc
	')
Chris PeBenito e07fbc
Chris PeBenito e07fbc
	domtrans_pattern($1, denyhosts_exec_t, denyhosts_t)
Chris PeBenito e07fbc
')
Chris PeBenito e07fbc
Chris PeBenito e07fbc
########################################
Chris PeBenito e07fbc
## <summary>
Chris PeBenito e07fbc
##	Execute denyhost server in the denyhost domain.
Chris PeBenito e07fbc
## </summary>
Chris PeBenito e07fbc
## <param name="domain">
Chris PeBenito e07fbc
##	<summary>
Dominick Grift 288845
##	Domain allowed to transition.
Chris PeBenito e07fbc
##	</summary>
Chris PeBenito e07fbc
## </param>
Chris PeBenito e07fbc
#
Chris PeBenito e07fbc
interface(`denyhosts_initrc_domtrans', `
Chris PeBenito e07fbc
	gen_require(`
Chris PeBenito e07fbc
		type denyhosts_initrc_exec_t;
Chris PeBenito e07fbc
	')
Chris PeBenito e07fbc
Chris PeBenito e07fbc
	init_labeled_script_domtrans($1, denyhosts_initrc_exec_t)
Chris PeBenito e07fbc
')
Chris PeBenito e07fbc
Chris PeBenito e07fbc
########################################
Chris PeBenito e07fbc
## <summary>
Chris PeBenito e07fbc
##	All of the rules required to administrate
Chris PeBenito e07fbc
##	an denyhosts environment.
Chris PeBenito e07fbc
## </summary>
Chris PeBenito e07fbc
## <param name="domain">
Chris PeBenito e07fbc
##	<summary>
Chris PeBenito e07fbc
##	Domain allowed access.
Chris PeBenito e07fbc
##	</summary>
Chris PeBenito e07fbc
## </param>
Chris PeBenito e07fbc
## <param name="role">
Chris PeBenito e07fbc
##	<summary>
Chris PeBenito e07fbc
##	Role allowed access.
Chris PeBenito e07fbc
##	</summary>
Chris PeBenito e07fbc
## </param>
Chris PeBenito e07fbc
#
Chris PeBenito e07fbc
interface(`denyhosts_admin', `
Chris PeBenito e07fbc
	gen_require(`
Chris PeBenito e07fbc
		type denyhosts_t, denyhosts_var_lib_t, denyhosts_var_lock_t;
Chris PeBenito e07fbc
		type denyhosts_var_log_t, denyhosts_initrc_exec_t;
Chris PeBenito e07fbc
	')
Chris PeBenito e07fbc
Chris PeBenito e07fbc
	allow $1 denyhosts_t:process { ptrace signal_perms };
Chris PeBenito e07fbc
	ps_process_pattern($1, denyhosts_t)
Chris PeBenito e07fbc
Chris PeBenito e07fbc
	denyhosts_initrc_domtrans($1)
Chris PeBenito e07fbc
	domain_system_change_exemption($1)
Chris PeBenito e07fbc
	role_transition $2 denyhosts_initrc_exec_t system_r;
Chris PeBenito e07fbc
	allow $2 system_r;
Chris PeBenito e07fbc
Chris PeBenito e07fbc
	files_search_var_lib($1)
Chris PeBenito e07fbc
	admin_pattern($1, denyhosts_var_lib_t)
Chris PeBenito e07fbc
Chris PeBenito e07fbc
	logging_search_logs($1)
Chris PeBenito e07fbc
	admin_pattern($1, denyhosts_var_log_t)
Chris PeBenito e07fbc
Chris PeBenito e07fbc
	files_search_locks($1)
Chris PeBenito e07fbc
	admin_pattern($1, denyhosts_var_lock_t)
Chris PeBenito e07fbc
')