selinux-refpolicy/policy/modules/system/logging.if

619 lines
12 KiB
Plaintext

## <summary>Policy for the kernel message logger and system logging daemon.</summary>
#######################################
## <summary>
## Make the specified type a file
## used for logs.
## </summary>
## <param name="file_type">
## <summary>
## Type of the file to be used as a log.
## </summary>
## </param>
#
interface(`logging_log_file',`
gen_require(`
attribute logfile;
')
files_type($1)
files_associate_tmp($1)
fs_associate_tmpfs($1)
typeattribute $1 logfile;
')
#######################################
## <summary>
## Send audit messages.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_send_audit_msgs',`
allow $1 self:capability audit_write;
allow $1 self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
')
########################################
## <summary>
## Read the audit log.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`logging_read_audit_log',`
gen_require(`
type auditd_log_t;
')
files_search_var($1)
read_files_pattern($1,auditd_log_t,auditd_log_t)
allow $1 auditd_log_t:dir list_dir_perms;
')
########################################
## <summary>
## Execute auditctl in the auditctl domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_domtrans_auditctl',`
gen_require(`
type auditctl_t, auditctl_exec_t;
')
domtrans_pattern($1,auditctl_exec_t,auditctl_t)
')
########################################
## <summary>
## Execute auditctl in the auditctl domain, and
## allow the specified role the auditctl domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <param name="role">
## <summary>
## The role to be allowed the auditctl domain.
## </summary>
## </param>
## <param name="terminal">
## <summary>
## The type of the terminal allow the auditctl domain to use.
## </summary>
## </param>
## <rolecap/>
#
interface(`logging_run_auditctl',`
gen_require(`
type auditctl_t;
')
logging_domtrans_auditctl($1)
role $2 types auditctl_t;
allow auditctl_t $3:chr_file rw_term_perms;
')
########################################
## <summary>
## Execute auditd in the auditd domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_domtrans_auditd',`
gen_require(`
type auditd_t, auditd_exec_t;
')
domtrans_pattern($1,auditd_exec_t,auditd_t)
')
########################################
## <summary>
## Execute auditd in the auditd domain, and
## allow the specified role the auditd domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <param name="role">
## <summary>
## The role to be allowed the auditd domain.
## </summary>
## </param>
## <param name="terminal">
## <summary>
## The type of the terminal allow the auditd domain to use.
## </summary>
## </param>
#
interface(`logging_run_auditd',`
gen_require(`
type auditd_t;
')
logging_domtrans_auditd($1)
role $2 types auditd_t;
allow auditd_t $3:chr_file rw_term_perms;
')
########################################
## <summary>
## Connect to auditdstored over an unix stream socket.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_stream_connect_auditd',`
gen_require(`
type auditd_t, auditd_var_run_t;
')
files_search_pids($1)
stream_connect_pattern($1,auditd_var_run_t,auditd_var_run_t,auditd_t)
')
########################################
## <summary>
## Manage the auditd configuration files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`logging_manage_audit_config',`
gen_require(`
type auditd_etc_t;
')
files_search_etc($1)
manage_files_pattern($1,auditd_etc_t,auditd_etc_t)
')
########################################
## <summary>
## Manage the audit log.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`logging_manage_audit_log',`
gen_require(`
type auditd_log_t;
')
files_search_var($1)
manage_dirs_pattern($1,auditd_log_t,auditd_log_t)
manage_files_pattern($1,auditd_log_t,auditd_log_t)
')
########################################
## <summary>
## Execute klogd in the klog domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_domtrans_klog',`
gen_require(`
type klogd_t, klogd_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1,klogd_exec_t,klogd_t)
')
########################################
## <summary>
## Execute syslogd in the syslog domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_domtrans_syslog',`
gen_require(`
type syslogd_t, syslogd_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1,syslogd_exec_t,syslogd_t)
')
########################################
## <summary>
## Create an object in the log directory, with a private
## type using a type transition.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <param name="private type">
## <summary>
## The type of the object to be created.
## </summary>
## </param>
## <param name="object">
## <summary>
## The object class of the object being created.
## </summary>
## </param>
#
interface(`logging_log_filetrans',`
gen_require(`
type var_log_t;
')
files_search_var($1)
filetrans_pattern($1,var_log_t,$2,$3)
')
########################################
## <summary>
## Send system log messages.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_send_syslog_msg',`
gen_require(`
type syslogd_t, devlog_t;
')
allow $1 devlog_t:lnk_file read;
allow $1 devlog_t:sock_file rw_file_perms;
# the type of socket depends on the syslog daemon
allow $1 syslogd_t:unix_dgram_socket sendto;
allow $1 syslogd_t:unix_stream_socket connectto;
allow $1 self:unix_dgram_socket create_socket_perms;
allow $1 self:unix_stream_socket create_socket_perms;
# cjp: this should most likely be removed:
term_use_console($1)
')
########################################
## <summary>
## Read the auditd configuration files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`logging_read_audit_config',`
gen_require(`
type auditd_etc_t;
')
files_search_etc($1)
read_files_pattern($1,auditd_etc_t,auditd_etc_t)
allow $1 auditd_etc_t:dir list_dir_perms;
')
########################################
## <summary>
## dontaudit search of auditd configuration files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`logging_dontaudit_search_audit_config',`
gen_require(`
type auditd_etc_t;
')
dontaudit $1 auditd_etc_t:dir search_dir_perms;
')
########################################
## <summary>
## Allows the domain to open a file in the
## log directory, but does not allow the listing
## of the contents of the log directory.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_search_logs',`
gen_require(`
type var_log_t;
')
files_search_var($1)
allow $1 var_log_t:dir search_dir_perms;
')
#######################################
## <summary>
## Do not audit attempts to search the var log directory.
## </summary>
## <param name="domain">
## <summary>
## Domain not to audit.
## </summary>
## </param>
#
interface(`logging_dontaudit_search_logs',`
gen_require(`
type var_log_t;
')
dontaudit $1 var_log_t:dir search_dir_perms;
')
#######################################
## <summary>
## List the contents of the generic log directory (/var/log).
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_list_logs',`
gen_require(`
type var_log_t;
')
files_search_var($1)
allow $1 var_log_t:dir list_dir_perms;
')
#######################################
## <summary>
## Read and write the generic log directory (/var/log).
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_rw_generic_log_dirs',`
gen_require(`
type var_log_t;
')
files_search_var($1)
allow $1 var_log_t:dir rw_dir_perms;
')
########################################
## <summary>
## Do not audit attempts to get the atttributes
## of any log files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_dontaudit_getattr_all_logs',`
gen_require(`
attribute logfile;
')
dontaudit $1 logfile:file getattr;
')
########################################
## <summary>
## Append to all log files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_append_all_logs',`
gen_require(`
attribute logfile;
type var_log_t;
')
files_search_var($1)
allow $1 var_log_t:dir list_dir_perms;
allow $1 logfile:file { getattr append };
')
########################################
## <summary>
## Read all log files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`logging_read_all_logs',`
gen_require(`
attribute logfile;
type var_log_t;
')
files_search_var($1)
allow $1 var_log_t:dir list_dir_perms;
read_files_pattern($1,logfile, logfile)
')
########################################
## <summary>
## Execute all log files in the caller domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
# cjp: not sure why this is needed. This was added
# because of logrotate.
interface(`logging_exec_all_logs',`
gen_require(`
attribute logfile;
')
files_search_var($1)
allow $1 logfile:dir list_dir_perms;
can_exec($1,logfile)
')
########################################
## <summary>
## Create, read, write, and delete all log files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`logging_manage_all_logs',`
gen_require(`
attribute logfile;
')
files_search_var($1)
manage_files_pattern($1,logfile,logfile)
read_lnk_files_pattern($1,logfile,logfile)
')
########################################
## <summary>
## Read generic log files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`logging_read_generic_logs',`
gen_require(`
type var_log_t;
')
files_search_var($1)
allow $1 var_log_t:dir list_dir_perms;
read_files_pattern($1,var_log_t,var_log_t)
')
########################################
## <summary>
## Write generic log files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_write_generic_logs',`
gen_require(`
type var_log_t;
')
files_search_var($1)
allow $1 var_log_t:dir list_dir_perms;
write_files_pattern($1,var_log_t,var_log_t)
')
########################################
## <summary>
## Read and write generic log files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`logging_rw_generic_logs',`
gen_require(`
type var_log_t;
')
files_search_var($1)
allow $1 var_log_t:dir list_dir_perms;
rw_files_pattern($1,var_log_t,var_log_t)
')
########################################
## <summary>
## Create, read, write, and delete
## generic log files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`logging_manage_generic_logs',`
gen_require(`
type var_log_t;
')
files_search_var($1)
manage_files_pattern($1,var_log_t,var_log_t)
')