aboutsummaryrefslogtreecommitdiff
blob: 2cc00dd0e29339a082ce2656bc33cdd975696c60 (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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
policy_module(policykit, 1.8.1)

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

attribute policykit_domain;

attribute_role policykit_auth_roles;
attribute_role policykit_grant_roles;

type policykit_t, policykit_domain;
type policykit_exec_t;
init_daemon_domain(policykit_t, policykit_exec_t)

type policykit_auth_t, policykit_domain;
type policykit_auth_exec_t;
init_daemon_domain(policykit_auth_t, policykit_auth_exec_t)
role policykit_auth_roles types policykit_auth_t;

type policykit_grant_t, policykit_domain;
type policykit_grant_exec_t;
init_system_domain(policykit_grant_t, policykit_grant_exec_t)
role policykit_grant_roles types policykit_grant_t;

type policykit_resolve_t, policykit_domain;
type policykit_resolve_exec_t;
init_system_domain(policykit_resolve_t, policykit_resolve_exec_t)

type policykit_reload_t alias polkit_reload_t;
files_type(policykit_reload_t)

type policykit_tmp_t;
files_tmp_file(policykit_tmp_t)

type policykit_unit_t;
init_unit_file(policykit_unit_t)

type policykit_var_lib_t alias polkit_var_lib_t;
files_type(policykit_var_lib_t)

type policykit_var_run_t alias polkit_var_run_t;
files_pid_file(policykit_var_run_t)

#######################################
#
# Common policykit domain local policy
#

allow policykit_domain self:process { execmem getattr };
allow policykit_domain self:fifo_file rw_fifo_file_perms;

kernel_search_proc(policykit_domain)

corecmd_exec_bin(policykit_domain)

dev_read_sysfs(policykit_domain)

files_read_usr_files(policykit_domain)

logging_send_syslog_msg(policykit_domain)

miscfiles_read_localization(policykit_domain)

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

allow policykit_t self:capability { dac_override dac_read_search setgid setuid sys_nice sys_ptrace };
allow policykit_t self:process { getsched setsched signal };
allow policykit_t self:unix_stream_socket { accept connectto listen };

rw_files_pattern(policykit_t, policykit_reload_t, policykit_reload_t)

manage_files_pattern(policykit_t, policykit_var_lib_t, policykit_var_lib_t)

manage_dirs_pattern(policykit_t, policykit_var_run_t, policykit_var_run_t)
manage_files_pattern(policykit_t, policykit_var_run_t, policykit_var_run_t)
files_pid_filetrans(policykit_t, policykit_var_run_t, { file dir })

can_exec(policykit_t, policykit_exec_t)

domtrans_pattern(policykit_t, policykit_auth_exec_t, policykit_auth_t)
domtrans_pattern(policykit_t, policykit_resolve_exec_t, policykit_resolve_t)

kernel_read_crypto_sysctls(policykit_t)
kernel_read_kernel_sysctls(policykit_t)
kernel_read_system_state(policykit_t)

dev_read_urand(policykit_t)
dev_read_urand(policykit_t)

domain_read_all_domains_state(policykit_t)

files_dontaudit_search_all_mountpoints(policykit_t)

fs_getattr_xattr_fs(policykit_t)
fs_list_inotifyfs(policykit_t)
fs_getattr_tmpfs(policykit_t)
fs_getattr_cgroup(policykit_t)

auth_use_nsswitch(policykit_t)

userdom_getattr_all_users(policykit_t)
userdom_read_all_users_state(policykit_t)

optional_policy(`
	dbus_system_domain(policykit_t, policykit_exec_t)
	init_dbus_chat(policykit_t)

	userdom_dbus_send_all_users(policykit_t)

	optional_policy(`
		consolekit_dbus_chat(policykit_t)
	')

	optional_policy(`
		rpm_dbus_chat(policykit_t)
	')

	optional_policy(`
		xserver_dbus_chat_xdm(policykit_t)
	')
')

optional_policy(`
	consolekit_read_pid_files(policykit_t)
')

optional_policy(`
	gnome_read_generic_home_content(policykit_t)
')

optional_policy(`
	kerberos_manage_host_rcache(policykit_t)
	kerberos_tmp_filetrans_host_rcache(policykit_t, file, "host_0")
')

optional_policy(`
	# for /run/systemd/machines
	systemd_read_machines(policykit_t)

	# for /run/systemd/seats/seat*
	systemd_read_logind_sessions_files(policykit_t)

	# for /run/systemd/users/*
	systemd_read_logind_pids(policykit_t)
')

########################################
#
# Auth local policy
#

allow policykit_auth_t self:capability { dac_override ipc_lock setgid setuid sys_nice };
dontaudit policykit_auth_t self:capability { dac_read_search sys_tty_config };
allow policykit_auth_t self:process { getsched setsched signal };
allow policykit_auth_t self:unix_stream_socket { accept listen };

ps_process_pattern(policykit_auth_t, policykit_domain)

rw_files_pattern(policykit_auth_t, policykit_reload_t, policykit_reload_t)

manage_dirs_pattern(policykit_auth_t, policykit_tmp_t, policykit_tmp_t)
manage_files_pattern(policykit_auth_t, policykit_tmp_t, policykit_tmp_t)
files_tmp_filetrans(policykit_auth_t, policykit_tmp_t, { file dir })

manage_files_pattern(policykit_auth_t, policykit_var_lib_t, policykit_var_lib_t)

manage_dirs_pattern(policykit_auth_t, policykit_var_run_t, policykit_var_run_t)
manage_files_pattern(policykit_auth_t, policykit_var_run_t, policykit_var_run_t)
files_pid_filetrans(policykit_auth_t, policykit_var_run_t, { file dir })

can_exec(policykit_auth_t, policykit_auth_exec_t)

kernel_read_system_state(policykit_auth_t)
kernel_dontaudit_search_kernel_sysctl(policykit_auth_t)
kernel_dontaudit_search_sysctl(policykit_auth_t)

dev_read_video_dev(policykit_auth_t)

domain_use_interactive_fds(policykit_auth_t)

files_read_etc_runtime_files(policykit_auth_t)
files_search_home(policykit_auth_t)

fs_getattr_all_fs(policykit_auth_t)
fs_search_tmpfs(policykit_auth_t)

auth_read_shadow(policykit_auth_t)
auth_rw_var_auth(policykit_auth_t)
auth_use_nsswitch(policykit_auth_t)
auth_domtrans_chk_passwd(policykit_auth_t)

miscfiles_read_fonts(policykit_auth_t)
miscfiles_setattr_fonts_cache_dirs(policykit_auth_t)

userdom_dontaudit_read_user_home_content_files(policykit_auth_t)

optional_policy(`
	dbus_system_domain(policykit_auth_t, policykit_auth_exec_t)
	dbus_all_session_bus_client(policykit_auth_t)

	optional_policy(`
		consolekit_dbus_chat(policykit_auth_t)
	')

	optional_policy(`
		policykit_dbus_chat(policykit_auth_t)
	')
')

optional_policy(`
	hal_read_state(policykit_auth_t)
')

optional_policy(`
	kerberos_manage_host_rcache(policykit_auth_t)
	kerberos_tmp_filetrans_host_rcache(policykit_auth_t, file, "host_0")
')

optional_policy(`
	xserver_stream_connect(policykit_auth_t)
	xserver_read_xdm_pid(policykit_auth_t)
	xserver_rw_xsession_log(policykit_auth_t)
')

########################################
#
# Grant local policy
#

allow policykit_grant_t self:capability setuid;
allow policykit_grant_t self:unix_dgram_socket create_socket_perms;
allow policykit_grant_t self:unix_stream_socket create_stream_socket_perms;

ps_process_pattern(policykit_grant_t, policykit_domain)

rw_files_pattern(policykit_grant_t, policykit_reload_t, policykit_reload_t)

manage_files_pattern(policykit_grant_t, policykit_var_run_t, policykit_var_run_t)

manage_files_pattern(policykit_grant_t, policykit_var_lib_t, policykit_var_lib_t)

can_exec(policykit_grant_t, policykit_grant_exec_t)

domtrans_pattern(policykit_grant_t, policykit_auth_exec_t, policykit_auth_t)
domtrans_pattern(policykit_grant_t, policykit_resolve_exec_t, policykit_resolve_t)

auth_domtrans_chk_passwd(policykit_grant_t)
auth_use_nsswitch(policykit_grant_t)

userdom_read_all_users_state(policykit_grant_t)

optional_policy(`
	cron_manage_system_job_lib_files(policykit_grant_t)
')

optional_policy(`
	dbus_system_bus_client(policykit_grant_t)

	optional_policy(`
		consolekit_dbus_chat(policykit_grant_t)
	')
')

########################################
#
# Resolve local policy
#

allow policykit_resolve_t self:capability { setuid sys_nice };
allow policykit_resolve_t self:unix_stream_socket { accept listen };

ps_process_pattern(policykit_resolve_t, policykit_domain)

read_files_pattern(policykit_resolve_t, policykit_reload_t, policykit_reload_t)

read_files_pattern(policykit_resolve_t, policykit_var_lib_t, policykit_var_lib_t)

can_exec(policykit_resolve_t, policykit_resolve_exec_t)

domtrans_pattern(policykit_resolve_t, policykit_auth_exec_t, policykit_auth_t)

mcs_ptrace_all(policykit_resolve_t)

auth_use_nsswitch(policykit_resolve_t)

userdom_read_all_users_state(policykit_resolve_t)

optional_policy(`
	dbus_system_bus_client(policykit_resolve_t)

	optional_policy(`
		consolekit_dbus_chat(policykit_resolve_t)
	')
')

optional_policy(`
	hal_read_state(policykit_resolve_t)
')