Chris PeBenito e32d52
## <summary>Policy for the kernel message logger and system logging daemon.</summary>
Chris PeBenito e181fe
Chris PeBenito b4cd15
#######################################
Chris PeBenito b4cd15
#
Chris PeBenito c9428d
# logging_log_file(domain)
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`logging_log_file',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		attribute logfile;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 8fd367
	files_type($1)
Chris PeBenito 0c73cd
	typeattribute $1 logfile;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito fb1aee
########################################
Chris PeBenito fb1aee
#
Chris PeBenito c9428d
# logging_create_log(domain,privatetype,[class(es)])
Chris PeBenito fb1aee
#
Chris PeBenito 199895
interface(`logging_create_log',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type var_log_t;
Chris PeBenito 139520
		class dir rw_dir_perms;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 var_log_t:dir rw_dir_perms;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	ifelse(`$3',`',`
Chris PeBenito 0c73cd
		type_transition $1 var_log_t:file $2;
Chris PeBenito 0c73cd
	',`
Chris PeBenito 0c73cd
		type_transition $1 var_log_t:$3 $2;
Chris PeBenito 0c73cd
	')
Chris PeBenito fb1aee
')
Chris PeBenito fb1aee
Chris PeBenito b4cd15
#######################################
Chris PeBenito b4cd15
#
Chris PeBenito c9428d
# logging_send_syslog_msg(domain)
Chris PeBenito 8c7717
#
Chris PeBenito 199895
interface(`logging_send_syslog_msg',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type syslogd_t, devlog_t;
Chris PeBenito 139520
		class lnk_file read;
Chris PeBenito 139520
		class sock_file rw_file_perms;
Chris PeBenito 139520
		class unix_dgram_socket { create_socket_perms sendto };
Chris PeBenito 139520
		class unix_stream_socket { create_socket_perms connectto };
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 devlog_t:lnk_file read;
Chris PeBenito cc41a9
	allow $1 devlog_t:sock_file rw_file_perms;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	# the type of socket depends on the syslog daemon
Chris PeBenito 0c73cd
	allow $1 syslogd_t:unix_dgram_socket sendto;
Chris PeBenito 0c73cd
	allow $1 syslogd_t:unix_stream_socket connectto;
Chris PeBenito cc41a9
	allow $1 self:unix_dgram_socket create_socket_perms;
Chris PeBenito cc41a9
	allow $1 self:unix_stream_socket create_socket_perms;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	# cjp: this should most likely be removed:
Chris PeBenito 0fd9dc
	term_use_console($1)
Chris PeBenito 8c7717
')
Chris PeBenito 8c7717
Chris PeBenito daa0e0
########################################
Chris PeBenito 414e41
## <desc>
Chris PeBenito 414e41
##	Allows the domain to open a file in the
Chris PeBenito 414e41
##	log directory, but does not allow the listing
Chris PeBenito 414e41
##	of the contents of the log directory.
Chris PeBenito 414e41
## </desc>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito 3ce6cb
#
Chris PeBenito 199895
interface(`logging_search_logs',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type var_log_t;
Chris PeBenito 139520
		class dir search;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_search_var($1)
Chris PeBenito 0c73cd
	allow $1 var_log_t:dir search;
Chris PeBenito 3ce6cb
')
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
#######################################
Chris PeBenito 96ce00
## <summary>
Chris PeBenito 96ce00
##	Read and write the generic log directory (/var/log).
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(`logging_rw_log_dir',`
Chris PeBenito 96ce00
	gen_require(`
Chris PeBenito 96ce00
		type var_log_t;
Chris PeBenito 96ce00
		class dir rw_dir_perms;
Chris PeBenito 96ce00
	')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
	files_search_var($1)
Chris PeBenito 96ce00
	allow $1 var_log_t:dir rw_dir_perms;
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
#######################################
Chris PeBenito 3ce6cb
#
Chris PeBenito c9428d
# logging_dontaudit_getattr_all_logs(domain)
Chris PeBenito b16c6b
#
Chris PeBenito 199895
interface(`logging_dontaudit_getattr_all_logs',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		attribute logfile;
Chris PeBenito 139520
		class file getattr;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	dontaudit $1 logfile:file getattr;
Chris PeBenito b16c6b
')
Chris PeBenito b16c6b
Chris PeBenito b16c6b
#######################################
Chris PeBenito b16c6b
#
Chris PeBenito 3ce6cb
# logging_append_all_logs(domain)
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`logging_append_all_logs',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		attribute logfile;
Chris PeBenito 139520
		type var_log_t;
Chris PeBenito 139520
		class dir r_dir_perms;
Chris PeBenito 139520
		class file { getattr append };
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_search_var($1)
Chris PeBenito cc41a9
	allow $1 var_log_t:dir r_dir_perms;
Chris PeBenito 0c73cd
	allow $1 logfile:file { getattr append };
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#######################################
Chris PeBenito b4cd15
#
Chris PeBenito 3ce6cb
# logging_read_all_logs(domain)
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`logging_read_all_logs',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		attribute logfile;
Chris PeBenito 139520
		type var_log_t;
Chris PeBenito 139520
		class dir r_dir_perms;
Chris PeBenito 139520
		class file r_file_perms;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_search_var($1)
Chris PeBenito cc41a9
	allow $1 var_log_t:dir r_dir_perms;
Chris PeBenito cc41a9
	allow $1 logfile:file r_file_perms;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito 8fd367
########################################
Chris PeBenito 8fd367
## <summary>
Chris PeBenito 8fd367
##	Execute all log files in the caller domain.
Chris PeBenito 8fd367
## </summary>
Chris PeBenito 8fd367
## <param name="domain">
Chris PeBenito 8fd367
##	The type of the process performing this action.
Chris PeBenito 8fd367
## </param>
Chris PeBenito 96ce00
#
Chris PeBenito 8fd367
# cjp: not sure why this is needed.  This was added
Chris PeBenito 8fd367
# because of logrotate.
Chris PeBenito 96ce00
interface(`logging_exec_all_logs',`
Chris PeBenito 96ce00
	gen_require(`
Chris PeBenito 96ce00
		attribute logfile;
Chris PeBenito 96ce00
		class dir r_dir_perms;
Chris PeBenito 96ce00
	')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
	files_search_var($1)
Chris PeBenito 96ce00
	allow $1 logfile:dir r_dir_perms;
Chris PeBenito 96ce00
	can_exec($1,logfile)
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
#######################################
Chris PeBenito 96ce00
#
Chris PeBenito 96ce00
# logging_manage_all_logs(domain)
Chris PeBenito 96ce00
#
Chris PeBenito 96ce00
interface(`logging_manage_all_logs',`
Chris PeBenito 96ce00
	gen_require(`
Chris PeBenito 96ce00
		attribute logfile;
Chris PeBenito 96ce00
		class dir rw_dir_perms;
Chris PeBenito 96ce00
		class file create_file_perms;
Chris PeBenito 96ce00
	')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
	files_search_var($1)
Chris PeBenito 96ce00
	allow $1 logfile:dir rw_dir_perms;
Chris PeBenito 96ce00
	allow $1 logfile:lnk_file read;
Chris PeBenito 96ce00
	allow $1 logfile:file create_file_perms;
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
Chris PeBenito 96ce00
#######################################
Chris PeBenito 96ce00
#
Chris PeBenito c9428d
# logging_read_generic_logs(domain)
Chris PeBenito 24280a
#
Chris PeBenito 199895
interface(`logging_read_generic_logs',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type var_log_t;
Chris PeBenito 139520
		class dir r_dir_perms;
Chris PeBenito 139520
		class file r_file_perms;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_search_var($1)
Chris PeBenito cc41a9
	allow $1 var_log_t:dir r_dir_perms;
Chris PeBenito cc41a9
	allow $1 var_log_t:file r_file_perms;
Chris PeBenito 24280a
')
Chris PeBenito 24280a
Chris PeBenito 24280a
#######################################
Chris PeBenito 24280a
#
Chris PeBenito c9428d
# logging_write_generic_logs(domain)
Chris PeBenito d490eb
#
Chris PeBenito 199895
interface(`logging_write_generic_logs',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type var_log_t;
Chris PeBenito 139520
		class dir r_dir_perms;
Chris PeBenito 139520
		class file { getattr write };
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_search_var($1)
Chris PeBenito cc41a9
	allow $1 var_log_t:dir r_dir_perms;
Chris PeBenito 0c73cd
	allow $1 var_log_t:file { getattr write };
Chris PeBenito d490eb
')
Chris PeBenito d490eb
Chris PeBenito d490eb
#######################################
Chris PeBenito d490eb
#
Chris PeBenito c9428d
# logging_rw_generic_logs(domain)
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`logging_rw_generic_logs',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type var_log_t;
Chris PeBenito 139520
		class dir r_dir_perms;
Chris PeBenito 139520
		class file rw_file_perms;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_search_var($1)
Chris PeBenito cc41a9
	allow $1 var_log_t:dir r_dir_perms;
Chris PeBenito cc41a9
	allow $1 var_log_t:file rw_file_perms;
Chris PeBenito b4cd15
')