Chris PeBenito 96ce00
## <summary>Rotate and archive system logs</summary>
Chris PeBenito 96ce00
Chris PeBenito 96ce00
########################################
Chris PeBenito 96ce00
## <summary>
Chris PeBenito 96ce00
##	Execute logrotate in the logrotate domain.
Chris PeBenito 96ce00
## </summary>
Chris PeBenito 96ce00
## <param name="domain">
Chris PeBenito 96ce00
##	The type of the process performing this action.
Chris PeBenito 96ce00
## </param>
Chris PeBenito 96ce00
#
Chris PeBenito 96ce00
interface(`logrotate_domtrans',`
Chris PeBenito 96ce00
	gen_require(`
Chris PeBenito 96ce00
		type logrotate_t, logrotate_exec_t;
Chris PeBenito 96ce00
		class process sigchld;
Chris PeBenito 96ce00
		class fd use;
Chris PeBenito 96ce00
		class fifo_file rw_file_perms;
Chris PeBenito 96ce00
	')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
	domain_auto_trans($1,logrotate_exec_t,logrotate_t)
Chris PeBenito 96ce00
Chris PeBenito 96ce00
	allow $1 logrotate_t:fd use;
Chris PeBenito 96ce00
	allow logrotate_t $1:fd use;
Chris PeBenito 96ce00
	allow logrotate_t $1:fifo_file rw_file_perms;
Chris PeBenito 96ce00
	allow logrotate_t $1:process sigchld;
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
########################################
Chris PeBenito 96ce00
## <summary>
Chris PeBenito 96ce00
##	Execute logrotate in the logrotate domain, and
Chris PeBenito 96ce00
##	allow the specified role the logrotate domain.
Chris PeBenito 96ce00
## </summary>
Chris PeBenito 96ce00
## <param name="domain">
Chris PeBenito 96ce00
##	The type of the process performing this action.
Chris PeBenito 96ce00
## </param>
Chris PeBenito 96ce00
## <param name="role">
Chris PeBenito 96ce00
##	The role to be allowed the logrotate domain.
Chris PeBenito 96ce00
## </param>
Chris PeBenito 96ce00
## <param name="terminal">
Chris PeBenito 96ce00
##	The type of the terminal allow the logrotate domain to use.
Chris PeBenito 96ce00
## </param>
Chris PeBenito 96ce00
#
Chris PeBenito 96ce00
interface(`logrotate_run',`
Chris PeBenito 96ce00
	gen_require(`
Chris PeBenito 96ce00
		type logrotate_t;
Chris PeBenito 96ce00
		class chr_file rw_term_perms;
Chris PeBenito 96ce00
	')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
	logrotate_domtrans($1)
Chris PeBenito 96ce00
	role $2 types logrotate_t;
Chris PeBenito 96ce00
	allow logrotate_t $3:chr_file rw_term_perms;
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
########################################
Chris PeBenito 96ce00
## <summary>
Chris PeBenito 96ce00
##	Execute logrotate in the caller domain.
Chris PeBenito 96ce00
## </summary>
Chris PeBenito 96ce00
## <param name="domain">
Chris PeBenito 96ce00
##	The type of the process performing this action.
Chris PeBenito 96ce00
## </param>
Chris PeBenito 96ce00
#
Chris PeBenito 96ce00
interface(`logrotate_exec',`
Chris PeBenito 96ce00
	gen_require(`
Chris PeBenito 96ce00
		type logrotate_exec_t;
Chris PeBenito 96ce00
	')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
	can_exec($1,logrotate_exec_t)
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
########################################
Chris PeBenito 96ce00
## <summary>
Chris PeBenito 96ce00
##	Do not audit attempts to inherit logrotate file descriptors.
Chris PeBenito 96ce00
## </summary>
Chris PeBenito 96ce00
## <param name="domain">
Chris PeBenito 96ce00
##	The type of the process to not audit.
Chris PeBenito 96ce00
## </param>
Chris PeBenito 96ce00
#
Chris PeBenito 96ce00
interface(`logrotate_dontaudit_use_fd',`
Chris PeBenito 96ce00
	gen_require(`
Chris PeBenito 96ce00
		type logrotate_t;
Chris PeBenito 96ce00
		class fd;
Chris PeBenito 96ce00
	')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
	dontaudit $1 logrotate_t:fd use;
Chris PeBenito 96ce00
')
Chris PeBenito 246839
Chris PeBenito 246839
########################################
Chris PeBenito 246839
## <summary>
Chris PeBenito 246839
##	Read a logrotate temporary files.
Chris PeBenito 246839
## </summary>
Chris PeBenito 246839
## <param name="domain">
Chris PeBenito 246839
##	The type of the process to not audit.
Chris PeBenito 246839
## </param>
Chris PeBenito 246839
#
Chris PeBenito 246839
interface(`logrotate_read_tmp_files',`
Chris PeBenito 246839
	gen_require(`
Chris PeBenito 246839
		type logrotate_tmp_t;
Chris PeBenito 246839
		class file r_file_perms;
Chris PeBenito 246839
	')
Chris PeBenito 246839
Chris PeBenito 246839
	files_search_tmp($1)
Chris PeBenito 246839
	allow $1 logrotate_tmp_t:file r_file_perms;
Chris PeBenito 246839
')