Blob Blame History Raw
## <summary>Chrony NTP background daemon</summary>

#####################################
## <summary>
##	Execute chronyd in the chronyd domain.
## </summary>
## <param name="domain">
##	<summary>
##	The type of the process performing this action.
##	</summary>
## </param>
#
interface(`chronyd_domtrans',`
	gen_require(`
		type chronyd_t, chronyd_exec_t;
	')

	corecmd_search_bin($1)
	domtrans_pattern($1, chronyd_exec_t, chronyd_t)
')

####################################
## <summary>
##	Execute chronyd
## </summary>
## <param name="domain">
##	<summary>
##	The type of the process performing this action.
##	</summary>
## </param>
#
interface(`chronyd_exec',`
	gen_require(`
		type chronyd_exec_t;
	')

	can_exec($1, chronyd_exec_t)
')

#####################################
## <summary>
##	Read chronyd logs.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`chronyd_read_log',`
	gen_require(`
		type chronyd_var_log_t;
	')

	logging_search_logs($1)
	read_files_pattern($1, chronyd_var_log_t, chronyd_var_log_t)
')

####################################
## <summary>
##	All of the rules required to administrate
##	an chronyd environment
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
## <param name="role">
##	<summary>
##	The role to be allowed to manage the chronyd domain.
##	</summary>
## </param>
## <rolecap/>
#
interface(`chronyd_admin',`
	gen_require(`
		type chronyd_t, chronyd_var_log_t;
		type chronyd_var_run_t, chronyd_var_lib_t;
		type chronyd_initrc_exec_t;
	')

	allow $1 chronyd_t:process { ptrace signal_perms };
	ps_process_pattern($1, chronyd_t)

	init_labeled_script_domtrans($1, chronyd_initrc_exec_t)
	domain_system_change_exemption($1)
	role_transition $2 chronyd_initrc_exec_t system_r;
	allow $2 system_r;

	logging_search_logs($1)
	admin_pattern($1, chronyd_var_log_t)

	files_search_var_lib($1)
	admin_pattern($1, chronyd_var_lib_t)

	files_search_pids($1)
	admin_pattern($1, chronyd_var_run_t)

	files_search_tmp($1)
	admin_pattern($1, chronyd_tmp_t)
')