## Devicekit modular hardware abstraction layer
########################################
##
## Execute a domain transition to run devicekit.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`devicekit_domtrans',`
gen_require(`
type devicekit_t, devicekit_exec_t;
')
domtrans_pattern($1, devicekit_exec_t, devicekit_t)
')
########################################
##
## Execute a domain transition to run devicekit_disk.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`devicekit_domtrans_disk',`
gen_require(`
type devicekit_disk_t, devicekit_disk_exec_t;
')
domtrans_pattern($1, devicekit_disk_exec_t, devicekit_disk_t)
')
########################################
##
## Send to devicekit over a unix domain
## datagram socket.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_dgram_send',`
gen_require(`
type devicekit_t;
')
allow $1 devicekit_t:unix_dgram_socket sendto;
')
########################################
##
## Send and receive messages from
## devicekit over dbus.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_dbus_chat',`
gen_require(`
type devicekit_t;
class dbus send_msg;
')
allow $1 devicekit_t:dbus send_msg;
allow devicekit_t $1:dbus send_msg;
')
########################################
##
## Send and receive messages from
## devicekit disk over dbus.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_dbus_chat_disk',`
gen_require(`
type devicekit_disk_t;
class dbus send_msg;
')
allow $1 devicekit_disk_t:dbus send_msg;
allow devicekit_disk_t $1:dbus send_msg;
')
########################################
##
## Use file descriptors for devicekit_disk.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_use_fds_disk',`
gen_require(`
type devicekit_disk_t;
')
allow $1 devicekit_disk_t:fd use;
')
########################################
##
## Dontaudit Send and receive messages from
## devicekit disk over dbus.
##
##
##
## Domain to not audit.
##
##
#
interface(`devicekit_dontaudit_dbus_chat_disk',`
gen_require(`
type devicekit_disk_t;
class dbus send_msg;
')
dontaudit $1 devicekit_disk_t:dbus send_msg;
dontaudit devicekit_disk_t $1:dbus send_msg;
')
#####################################
##
## Read and write devicekit disk semaphores.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_rw_semaphores_disk',`
gen_require(`
type devicekit_disk_t;
')
allow $1 devicekit_disk_t:sem rw_sem_perms;
')
########################################
##
## Send signal devicekit power
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_signal_power',`
gen_require(`
type devicekit_power_t;
')
allow $1 devicekit_power_t:process signal;
')
########################################
##
## Send and receive messages from
## devicekit power over dbus.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_dbus_chat_power',`
gen_require(`
type devicekit_power_t;
class dbus send_msg;
')
allow $1 devicekit_power_t:dbus send_msg;
allow devicekit_power_t $1:dbus send_msg;
')
#######################################
##
## Use and inherit devicekit power
## file descriptors.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_use_fds_power',`
gen_require(`
type devicekit_power_t;
')
allow $1 devicekit_power_t:fd use;
')
#######################################
##
## Append inherited devicekit log files.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_append_inherited_log_files',`
gen_require(`
type devicekit_var_log_t;
')
logging_search_logs($1)
allow $1 devicekit_var_log_t:file append_inherited_file_perms;
devicekit_use_fds_power($1)
')
#######################################
##
## Allow read devicekit log files.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_read_log_files',`
gen_require(`
type devicekit_var_log_t;
')
logging_search_logs($1)
allow $1 devicekit_var_log_t:file read_file_perms;
')
#######################################
##
## Do not audit attempts to write the devicekit
## log files.
##
##
##
## Domain to not audit.
##
##
#
interface(`devicekit_dontaudit_rw_log',`
gen_require(`
type devicekit_var_log_t;
')
dontaudit $1 devicekit_var_log_t:file rw_file_perms;
')
########################################
##
## Allow the domain to read devicekit_power state files in /proc.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_read_state_power',`
gen_require(`
type devicekit_power_t;
')
kernel_search_proc($1)
ps_process_pattern($1, devicekit_power_t)
')
########################################
##
## Read devicekit PID files.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_read_pid_files',`
gen_require(`
type devicekit_var_run_t;
')
files_search_pids($1)
read_files_pattern($1, devicekit_var_run_t, devicekit_var_run_t)
')
########################################
##
## Do not audit attempts to read
## devicekit PID files.
##
##
##
## Domain to not audit.
##
##
#
interface(`devicekit_dontaudit_read_pid_files',`
gen_require(`
type devicekit_var_run_t;
')
dontaudit $1 devicekit_var_run_t:file read_inherited_file_perms;
')
########################################
##
## Manage devicekit PID files.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_manage_pid_files',`
gen_require(`
type devicekit_var_run_t;
')
files_search_pids($1)
manage_dirs_pattern($1, devicekit_var_run_t, devicekit_var_run_t)
manage_files_pattern($1, devicekit_var_run_t, devicekit_var_run_t)
files_pid_filetrans($1, devicekit_var_run_t, dir, "pm-utils")
')
#######################################
##
## Relabel devicekit LOG files.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_relabel_log_files',`
gen_require(`
type devicekit_var_log_t;
')
logging_search_logs($1)
relabel_files_pattern($1, devicekit_var_log_t, devicekit_var_log_t)
')
########################################
##
## Manage devicekit LOG files.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_manage_log_files',`
gen_require(`
type devicekit_var_log_t;
')
logging_search_logs($1)
manage_files_pattern($1, devicekit_var_log_t, devicekit_var_log_t)
#logging_log_filetrans($1, devicekit_var_log_t, file, "pm-powersave.log")
#logging_log_filetrans($1, devicekit_var_log_t, file, "pm-suspend.log")
')
########################################
##
## All of the rules required to administrate
## an devicekit environment
##
##
##
## Domain allowed access.
##
##
##
#
interface(`devicekit_admin',`
gen_require(`
type devicekit_t, devicekit_disk_t, devicekit_power_t;
type devicekit_var_lib_t, devicekit_var_run_t, devicekit_tmp_t;
')
allow $1 devicekit_t:process signal_perms;
ps_process_pattern($1, devicekit_t)
tunable_policy(`deny_ptrace',`',`
allow $1 devicekit_t:process ptrace;
allow $1 devicekit_disk_t:process ptrace;
allow $1 devicekit_power_t:process ptrace;
')
allow $1 devicekit_disk_t:process signal_perms;
ps_process_pattern($1, devicekit_disk_t)
allow $1 devicekit_power_t:process signal_perms;
ps_process_pattern($1, devicekit_power_t)
admin_pattern($1, devicekit_tmp_t)
files_list_tmp($1)
admin_pattern($1, devicekit_var_lib_t)
files_list_var_lib($1)
admin_pattern($1, devicekit_var_run_t)
files_list_pids($1)
')
########################################
##
## Transition to devicekit named content
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_filetrans_named_content',`
gen_require(`
type devicekit_var_run_t, devicekit_var_log_t;
')
files_pid_filetrans($1, devicekit_var_run_t, dir, "pm-utils")
logging_log_filetrans($1, devicekit_var_log_t, file, "pm-powersave.log")
logging_log_filetrans($1, devicekit_var_log_t, file, "pm-suspend.log")
')
########################################
##
## Mounton devicekit lib directory.
##
##
##
## Domain allowed access.
##
##
#
interface(`devicekit_mounton_var_lib',`
gen_require(`
type devicekit_var_lib_t;
')
allow $1 devicekit_var_lib_t:dir mounton;
')