## policy for daemon for playing music
########################################
##
## Execute a domain transition to run mpd.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`mpd_domtrans',`
gen_require(`
type mpd_t, mpd_exec_t;
')
domtrans_pattern($1, mpd_exec_t, mpd_t)
')
########################################
##
## Execute mpd server in the mpd domain.
##
##
##
## Domain allowed access.
##
##
#
interface(`mpd_initrc_domtrans',`
gen_require(`
type mpd_initrc_exec_t;
')
init_labeled_script_domtrans($1, mpd_initrc_exec_t)
')
#######################################
##
## Read mpd data files.
##
##
##
## Domain allowed access.
##
##
#
interface(`mpd_read_data_files',`
gen_require(`
type mpd_data_t;
')
mpd_search_lib($1)
read_files_pattern($1, mpd_data_t, mpd_data_t)
')
#######################################
##
## Read mpd tmpfs files.
##
##
##
## Domain allowed access.
##
##
#
interface(`mpd_read_tmpfs_files',`
gen_require(`
type mpd_tmpfs_t;
')
fs_search_tmpfs($1)
read_files_pattern($1, mpd_tmpfs_t, mpd_tmpfs_t)
')
###################################
##
## Manage mpd tmpfs files.
##
##
##
## Domain allowed access.
##
##
#
interface(`mpd_manage_tmpfs_files',`
gen_require(`
type mpd_tmpfs_t;
')
fs_search_tmpfs($1)
manage_files_pattern($1, mpd_tmpfs_t, mpd_tmpfs_t)
manage_lnk_files_pattern($1, mpd_tmpfs_t, mpd_tmpfs_t)
')
######################################
##
## Manage mpd data files.
##
##
##
## Domain allowed access.
##
##
#
interface(`mpd_manage_data_files',`
gen_require(`
type mpd_data_t;
')
mpd_search_lib($1)
manage_files_pattern($1, mpd_data_t, mpd_data_t)
')
########################################
##
## Search mpd lib directories.
##
##
##
## Domain allowed access.
##
##
#
interface(`mpd_search_lib',`
gen_require(`
type mpd_var_lib_t;
')
allow $1 mpd_var_lib_t:dir search_dir_perms;
files_search_var_lib($1)
')
########################################
##
## Read mpd lib files.
##
##
##
## Domain allowed access.
##
##
#
interface(`mpd_read_lib_files',`
gen_require(`
type mpd_var_lib_t;
')
files_search_var_lib($1)
read_files_pattern($1, mpd_var_lib_t, mpd_var_lib_t)
')
########################################
##
## Create, read, write, and delete
## mpd lib files.
##
##
##
## Domain allowed access.
##
##
#
interface(`mpd_manage_lib_files',`
gen_require(`
type mpd_var_lib_t;
')
files_search_var_lib($1)
manage_files_pattern($1, mpd_var_lib_t, mpd_var_lib_t)
')
#######################################
##
## Create an object in the root directory, with a private
## type using a type transition.
##
##
##
## Domain allowed access.
##
##
##
##
## The type of the object to be created.
##
##
##
##
## The object class of the object being created.
##
##
#
interface(`mpd_var_lib_filetrans',`
gen_require(`
type mpd_var_lib_t;
')
filetrans_pattern($1, mpd_var_lib_t, $2, $3)
')
########################################
##
## Manage mpd lib dirs files.
##
##
##
## Domain allowed access.
##
##
#
interface(`mpd_manage_lib_dirs',`
gen_require(`
type mpd_var_lib_t;
')
files_search_var_lib($1)
manage_dirs_pattern($1, mpd_var_lib_t, mpd_var_lib_t)
')
########################################
##
## All of the rules required to administrate
## an mpd environment
##
##
##
## Domain allowed access.
##
##
##
##
## Role allowed access.
##
##
##
#
interface(`mpd_admin',`
gen_require(`
type mpd_t;
type mpd_initrc_exec_t;
type mpd_etc_t;
type mpd_data_t;
type mpd_log_t;
type mpd_var_lib_t;
type mpd_tmpfs_t;
')
allow $1 mpd_t:process { ptrace signal_perms };
ps_process_pattern($1, mpd_t)
mpd_initrc_domtrans($1)
domain_system_change_exemption($1)
role_transition $2 mpd_initrc_exec_t system_r;
allow $2 system_r;
admin_pattern($1, mpd_etc_t)
files_search_etc($1)
files_search_var_lib($1)
admin_pattern($1, mpd_var_lib_t)
mpd_search_lib($1)
admin_pattern($1, mpd_data_t)
admin_pattern($1, mpd_log_t)
fs_search_tmpfs($1)
admin_pattern($1, mpd_tmpfs_t)
')