Dominick Grift 68ac47
policy_module(mpd, 1.0.0)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
# Declarations
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
Dan Walsh 3eaa99
type mpd_t;
Dan Walsh 3eaa99
type mpd_exec_t;
Dan Walsh 3eaa99
init_daemon_domain(mpd_t, mpd_exec_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
permissive mpd_t;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
type mpd_initrc_exec_t;
Dan Walsh 3eaa99
init_script_file(mpd_initrc_exec_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
type mpd_etc_t;
Dan Walsh 3eaa99
files_config_file(mpd_etc_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
# type for music content
Dan Walsh 3eaa99
type mpd_data_t;
Dan Walsh 3eaa99
files_type(mpd_data_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
type mpd_log_t;
Dan Walsh 3eaa99
logging_log_file(mpd_log_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
type mpd_tmp_t;
Dan Walsh 3eaa99
files_tmp_file(mpd_tmp_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
type mpd_tmpfs_t;
Dan Walsh 3eaa99
files_tmpfs_file(mpd_tmpfs_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
type mpd_var_lib_t;
Dan Walsh 3eaa99
files_type(mpd_var_lib_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
########################################
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
# mpd local policy
Dan Walsh 3eaa99
#
Dan Walsh 3eaa99
Dan Walsh 3eaa99
#cjp: dac_override bug in mpd relating to mpd.log file
Dan Walsh 3eaa99
allow mpd_t self:capability { dac_override kill setgid setuid };
Dan Walsh 3eaa99
allow mpd_t self:process { getsched setsched setrlimit signal signull };
Dan Walsh 3eaa99
allow mpd_t self:fifo_file rw_fifo_file_perms;
Dan Walsh 3eaa99
allow mpd_t self:unix_stream_socket { connectto create_stream_socket_perms };
Dan Walsh 3eaa99
allow mpd_t self:tcp_socket create_stream_socket_perms;
Dan Walsh 3eaa99
allow mpd_t self:netlink_kobject_uevent_socket create_socket_perms;
Dan Walsh 3eaa99
allow mpd_t self:unix_dgram_socket { create_socket_perms sendto };
Dan Walsh 3eaa99
Dan Walsh 3eaa99
read_files_pattern(mpd_t, mpd_etc_t, mpd_etc_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
manage_dirs_pattern(mpd_t, mpd_data_t, mpd_data_t)
Dan Walsh 3eaa99
manage_files_pattern(mpd_t, mpd_data_t, mpd_data_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
manage_dirs_pattern(mpd_t, mpd_tmp_t, mpd_tmp_t)
Dan Walsh 3eaa99
manage_files_pattern(mpd_t, mpd_tmp_t, mpd_tmp_t)
Dan Walsh 3eaa99
manage_sock_files_pattern(mpd_t, mpd_tmp_t, mpd_tmp_t)
Dan Walsh 3eaa99
files_tmp_filetrans(mpd_t, mpd_tmp_t, { dir file sock_file })
Dan Walsh 3eaa99
Dan Walsh 3eaa99
manage_files_pattern(mpd_t, mpd_tmpfs_t, mpd_tmpfs_t)
Dan Walsh 3eaa99
manage_dirs_pattern(mpd_t, mpd_tmpfs_t, mpd_tmpfs_t)
Dan Walsh 3eaa99
fs_tmpfs_filetrans(mpd_t, mpd_tmpfs_t, file )
Dan Walsh 3eaa99
Dan Walsh 3eaa99
manage_dirs_pattern(mpd_t, mpd_var_lib_t, mpd_var_lib_t)
Dan Walsh 3eaa99
manage_files_pattern(mpd_t, mpd_var_lib_t, mpd_var_lib_t)
Dan Walsh 3eaa99
manage_lnk_files_pattern(mpd_t, mpd_var_lib_t, mpd_var_lib_t)
Dan Walsh 3eaa99
files_var_lib_filetrans(mpd_t, mpd_var_lib_t, { dir file lnk_file })
Dan Walsh 3eaa99
Dan Walsh 3eaa99
kernel_read_system_state(mpd_t)
Dan Walsh 3eaa99
kernel_read_kernel_sysctls(mpd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
corecmd_exec_bin(mpd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
corenet_sendrecv_pulseaudio_client_packets(mpd_t)
Dan Walsh 3eaa99
corenet_tcp_connect_http_port(mpd_t)
Dan Walsh 3eaa99
corenet_tcp_connect_http_cache_port(mpd_t)
Dan Walsh 3eaa99
corenet_tcp_connect_pulseaudio_port(mpd_t)
Dan Walsh 3eaa99
corenet_tcp_bind_mpd_port(mpd_t)
Dan Walsh 3eaa99
corenet_tcp_bind_soundd_port(mpd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
dev_read_sysfs(mpd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
files_read_usr_files(mpd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
fs_getattr_tmpfs(mpd_t)
Dan Walsh 3eaa99
fs_list_inotifyfs(mpd_t)
Dan Walsh 3eaa99
fs_rw_anon_inodefs_files(mpd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
auth_use_nsswitch(mpd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
logging_send_syslog_msg(mpd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
miscfiles_read_localization(mpd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
userdom_read_home_audio_files(mpd_t)
Dan Walsh 3eaa99
userdom_read_user_tmpfs_files(mpd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	dbus_system_bus_client(mpd_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	pulseaudio_exec(mpd_t)
Dominick Grift 68ac47
	pulseaudio_stream_connect(mpd_t)
Dominick Grift 68ac47
	pulseaudio_signull(mpd_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dominick Grift 68ac47
	udev_read_db(mpd_t)
Dan Walsh 3eaa99
')