aboutsummaryrefslogtreecommitdiff
blob: 7c8afccf70527d237742de228d75e03307f3017e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
policy_module(mpd, 1.0.4)

########################################
#
# Declarations
#

## <desc>
##	<p>
##	Determine whether mpd can traverse
##	user home directories.
##	</p>
## </desc>
gen_tunable(mpd_enable_homedirs, false)

## <desc>
##	<p>
##	Determine whether mpd can use
##	cifs file systems.
##	</p>
## </desc>
gen_tunable(mpd_use_cifs, false)

## <desc>
##	<p>
##	Determine whether mpd can use
##	nfs file systems.
##	</p>
## </desc>
gen_tunable(mpd_use_nfs, false)

type mpd_t;
type mpd_exec_t;
init_daemon_domain(mpd_t, mpd_exec_t)
application_executable_file(mpd_exec_t)

type mpd_data_t;
files_type(mpd_data_t)

type mpd_etc_t;
files_config_file(mpd_etc_t)

type mpd_initrc_exec_t;
init_script_file(mpd_initrc_exec_t)

type mpd_log_t;
logging_log_file(mpd_log_t)

type mpd_tmp_t;
files_tmp_file(mpd_tmp_t)

type mpd_tmpfs_t;
files_tmpfs_file(mpd_tmpfs_t)

optional_policy(`
	pulseaudio_tmpfs_content(mpd_tmpfs_t)
')

type mpd_var_lib_t;
files_type(mpd_var_lib_t)

type mpd_user_data_t;
userdom_user_home_content(mpd_user_data_t) # customizable

########################################
#
# Local policy
#

allow mpd_t self:capability { dac_override kill setgid setuid };
allow mpd_t self:process { getsched setsched setrlimit signal signull };
allow mpd_t self:fifo_file rw_fifo_file_perms;
allow mpd_t self:unix_stream_socket { accept connectto listen };
allow mpd_t self:unix_dgram_socket sendto;
allow mpd_t self:tcp_socket { accept listen };
allow mpd_t self:netlink_kobject_uevent_socket create_socket_perms;

allow mpd_t mpd_data_t:dir manage_dir_perms;
allow mpd_t mpd_data_t:file manage_file_perms;
allow mpd_t mpd_data_t:lnk_file read_lnk_file_perms;

read_files_pattern(mpd_t, mpd_etc_t, mpd_etc_t)

allow mpd_t mpd_log_t:dir setattr_dir_perms;
append_files_pattern(mpd_t, mpd_log_t, mpd_log_t)
create_files_pattern(mpd_t, mpd_log_t, mpd_log_t)
setattr_files_pattern(mpd_t, mpd_log_t, mpd_log_t)
logging_log_filetrans(mpd_t, mpd_log_t, { dir file })

manage_dirs_pattern(mpd_t, mpd_tmp_t, mpd_tmp_t)
manage_files_pattern(mpd_t, mpd_tmp_t, mpd_tmp_t)
manage_sock_files_pattern(mpd_t, mpd_tmp_t, mpd_tmp_t)
files_tmp_filetrans(mpd_t, mpd_tmp_t, { dir file sock_file })

allow mpd_t mpd_tmpfs_t:file manage_file_perms;
fs_tmpfs_filetrans(mpd_t, mpd_tmpfs_t, file)

allow mpd_t mpd_user_data_t:dir list_dir_perms;
allow mpd_t mpd_user_data_t:file read_file_perms;
allow mpd_t mpd_user_data_t:lnk_file read_lnk_file_perms;

manage_dirs_pattern(mpd_t, mpd_var_lib_t, mpd_var_lib_t)
manage_files_pattern(mpd_t, mpd_var_lib_t, mpd_var_lib_t)
manage_lnk_files_pattern(mpd_t, mpd_var_lib_t, mpd_var_lib_t)
files_var_lib_filetrans(mpd_t, mpd_var_lib_t, dir)

kernel_getattr_proc(mpd_t)
kernel_read_system_state(mpd_t)
kernel_read_kernel_sysctls(mpd_t)

corecmd_exec_bin(mpd_t)

corenet_all_recvfrom_unlabeled(mpd_t)
corenet_all_recvfrom_netlabel(mpd_t)
corenet_tcp_sendrecv_generic_if(mpd_t)
corenet_tcp_sendrecv_generic_node(mpd_t)
corenet_tcp_bind_generic_node(mpd_t)

corenet_sendrecv_mpd_server_packets(mpd_t)
corenet_tcp_bind_mpd_port(mpd_t)
corenet_tcp_sendrecv_mpd_port(mpd_t)

corenet_sendrecv_soundd_server_packets(mpd_t)
corenet_tcp_bind_soundd_port(mpd_t)
corenet_sendrecv_soundd_client_packets(mpd_t)
corenet_tcp_connect_soundd_port(mpd_t)
corenet_tcp_sendrecv_soundd_port(mpd_t)

corenet_sendrecv_http_client_packets(mpd_t)
corenet_tcp_connect_http_port(mpd_t)
corenet_tcp_sendrecv_http_port(mpd_t)

corenet_sendrecv_http_cache_client_packets(mpd_t)
corenet_tcp_connect_http_cache_port(mpd_t)
corenet_tcp_sendrecv_http_cache_port(mpd_t)

dev_read_urand(mpd_t)
dev_read_sound(mpd_t)
dev_write_sound(mpd_t)
dev_read_sysfs(mpd_t)

files_read_usr_files(mpd_t)

fs_getattr_all_fs(mpd_t)
fs_list_inotifyfs(mpd_t)
fs_rw_anon_inodefs_files(mpd_t)
fs_search_auto_mountpoints(mpd_t)

auth_use_nsswitch(mpd_t)

logging_send_syslog_msg(mpd_t)

miscfiles_read_localization(mpd_t)

tunable_policy(`mpd_enable_homedirs',`
	userdom_search_user_home_dirs(mpd_t)
')

tunable_policy(`mpd_enable_homedirs && use_nfs_home_dirs',`
	fs_read_nfs_files(mpd_t)
	fs_read_nfs_symlinks(mpd_t)
')

tunable_policy(`mpd_enable_homedirs && use_samba_home_dirs',`
	fs_read_cifs_files(mpd_t)
	fs_read_cifs_symlinks(mpd_t)
')

tunable_policy(`mpd_use_cifs',`
	fs_manage_cifs_dirs(mpd_t)
	fs_manage_cifs_files(mpd_t)
	fs_manage_cifs_symlinks(mpd_t)
')

tunable_policy(`mpd_use_nfs',`
	fs_manage_nfs_dirs(mpd_t)
	fs_manage_nfs_files(mpd_t)
	fs_manage_nfs_symlinks(mpd_t)
')

optional_policy(`
	alsa_read_rw_config(mpd_t)
')

optional_policy(`
	dbus_system_bus_client(mpd_t)

	optional_policy(`
		consolekit_dbus_chat(mpd_t)
	')
')

optional_policy(`
	pulseaudio_domtrans(mpd_t)
')

optional_policy(`
	rpc_search_nfs_state_data(mpd_t)
')

optional_policy(`
	udev_read_db(mpd_t)
')

optional_policy(`
	xserver_stream_connect(mpd_t)
	xserver_read_xdm_pid(mpd_t)
')