Debian Codegraph @

tests/policies/test-deps/base-notmetreq.conf

raw
1 # FLASK
2
3 #
4 # Define the security object classes
5 #
6
7 class security
8 class process
9 class system
10 class capability
11
12 # file-related classes
13 class filesystem
14 class file
15 class dir
16 class fd
17 class lnk_file
18 class chr_file
19 class blk_file
20 class sock_file
21 class fifo_file
22
23 # network-related classes
24 class socket
25 class tcp_socket
26 class udp_socket
27 class rawip_socket
28 class node
29 class netif
30 class netlink_socket
31 class packet_socket
32 class key_socket
33 class unix_stream_socket
34 class unix_dgram_socket
35
36 # sysv-ipc-related classes
37 class msg
38 class msgq
39 class shm
40 class ipc
41
42 # FLASK
43 # FLASK
44
45 #
46 # Define initial security identifiers
47 #
48
49 sid kernel
50
51
52 # FLASK
53 #
54 # Define common prefixes for access vectors
55 #
56 # common common_name { permission_name ... }
57
58
59 #
60 # Define a common prefix for file access vectors.
61 #
62
63 common file
64 {
65 ioctl
66 read
67 write
68 create
69 getattr
70 setattr
71 lock
72 relabelfrom
73 relabelto
74 append
75 unlink
76 link
77 rename
78 execute
79 swapon
80 quotaon
81 mounton
82 }
83
84
85 #
86 # Define a common prefix for socket access vectors.
87 #
88
89 common socket
90 {
91 # inherited from file
92 ioctl
93 read
94 write
95 create
96 getattr
97 setattr
98 lock
99 relabelfrom
100 relabelto
101 append
102 # socket-specific
103 bind
104 connect
105 listen
106 accept
107 getopt
108 setopt
109 shutdown
110 recvfrom
111 sendto
112 recv_msg
113 send_msg
114 name_bind
115 }
116
117 #
118 # Define a common prefix for ipc access vectors.
119 #
120
121 common ipc
122 {
123 create
124 destroy
125 getattr
126 setattr
127 read
128 write
129 associate
130 unix_read
131 unix_write
132 }
133
134 #
135 # Define the access vectors.
136 #
137 # class class_name [ inherits common_name ] { permission_name ... }
138
139
140 #
141 # Define the access vector interpretation for file-related objects.
142 #
143
144 class filesystem
145 {
146 mount
147 remount
148 unmount
149 getattr
150 relabelfrom
151 relabelto
152 transition
153 associate
154 quotamod
155 quotaget
156 }
157
158 class dir
159 inherits file
160 {
161 add_name
162 remove_name
163 reparent
164 search
165 rmdir
166 }
167
168 class file
169 inherits file
170 {
171 execute_no_trans
172 entrypoint
173 }
174
175 class lnk_file
176 inherits file
177
178 class chr_file
179 inherits file
180
181 class blk_file
182 inherits file
183
184 class sock_file
185 inherits file
186
187 class fifo_file
188 inherits file
189
190 class fd
191 {
192 use
193 }
194
195
196 #
197 # Define the access vector interpretation for network-related objects.
198 #
199
200 class socket
201 inherits socket
202
203 class tcp_socket
204 inherits socket
205 {
206 connectto
207 newconn
208 acceptfrom
209 }
210
211 class udp_socket
212 inherits socket
213
214 class rawip_socket
215 inherits socket
216
217 class node
218 {
219 tcp_recv
220 tcp_send
221 udp_recv
222 udp_send
223 rawip_recv
224 rawip_send
225 enforce_dest
226 }
227
228 class netif
229 {
230 tcp_recv
231 tcp_send
232 udp_recv
233 udp_send
234 rawip_recv
235 rawip_send
236 }
237
238 class netlink_socket
239 inherits socket
240
241 class packet_socket
242 inherits socket
243
244 class key_socket
245 inherits socket
246
247 class unix_stream_socket
248 inherits socket
249 {
250 connectto
251 newconn
252 acceptfrom
253 }
254
255 class unix_dgram_socket
256 inherits socket
257
258
259 #
260 # Define the access vector interpretation for process-related objects
261 #
262
263 class process
264 {
265 fork
266 transition
267 sigchld # commonly granted from child to parent
268 sigkill # cannot be caught or ignored
269 sigstop # cannot be caught or ignored
270 signull # for kill(pid, 0)
271 signal # all other signals
272 ptrace
273 getsched
274 setsched
275 getsession
276 getpgid
277 setpgid
278 getcap
279 setcap
280 share
281 }
282
283
284 #
285 # Define the access vector interpretation for ipc-related objects
286 #
287
288 class ipc
289 inherits ipc
290
291 class msgq
292 inherits ipc
293 {
294 enqueue
295 }
296
297 class msg
298 {
299 send
300 }
301
302 class shm
303 inherits ipc
304 {
305 lock
306 }
307
308
309 #
310 # Define the access vector interpretation for the security server.
311 #
312
313 class security
314 {
315 compute_av
316 transition_sid
317 member_sid
318 sid_to_context
319 context_to_sid
320 load_policy
321 get_sids
322 change_sid
323 get_user_sids
324 }
325
326
327 #
328 # Define the access vector interpretation for system operations.
329 #
330
331 class system
332 {
333 ipc_info
334 avc_toggle
335 nfsd_control
336 bdflush
337 syslog_read
338 syslog_mod
339 syslog_console
340 ichsid
341 }
342
343 #
344 # Define the access vector interpretation for controlling capabilities
345 #
346
347 class capability
348 {
349 # The capabilities are defined in include/linux/capability.h
350 # Care should be taken to ensure that these are consistent with
351 # those definitions. (Order matters)
352
353 chown
354 dac_override
355 dac_read_search
356 fowner
357 fsetid
358 kill
359 setgid
360 setuid
361 setpcap
362 linux_immutable
363 net_bind_service
364 net_broadcast
365 net_admin
366 net_raw
367 ipc_lock
368 ipc_owner
369 sys_module
370 sys_rawio
371 sys_chroot
372 sys_ptrace
373 sys_pacct
374 sys_admin
375 sys_boot
376 sys_nice
377 sys_resource
378 sys_time
379 sys_tty_config
380 mknod
381 lease
382 }
383
384 ifdef(`enable_mls',`
385 sensitivity s0;
386
387 #
388 # Define the ordering of the sensitivity levels (least to greatest)
389 #
390 dominance { s0 }
391
392
393 #
394 # Define the categories
395 #
396 # Each category has a name and zero or more aliases.
397 #
398 category c0; category c1; category c2; category c3;
399 category c4; category c5; category c6; category c7;
400 category c8; category c9; category c10; category c11;
401 category c12; category c13; category c14; category c15;
402 category c16; category c17; category c18; category c19;
403 category c20; category c21; category c22; category c23;
404
405 level s0:c0.c23;
406
407 mlsconstrain file { write setattr append unlink link rename ioctl lock execute relabelfrom }
408 ( h1 dom h2 );
409 ')
410
411 ####################################
412 ####################################
413 #####################################
414 # TE RULES
415 attribute domain;
416 attribute system;
417 attribute foo;
418 attribute num;
419 attribute num_exec;
420 attribute files;
421
422 type net_foo_t, foo;
423 type sys_foo_t, foo, system;
424 role system_r;
425 role system_r types sys_foo_t;
426
427 type user_t, domain;
428 role user_r;
429 role user_r types user_t;
430
431 type sysadm_t, domain, system;
432 role sysadm_r;
433 role sysadm_r types sysadm_t;
434
435 type system_t, domain, system, foo;
436 role system_r;
437 role system_r types { system_t sys_foo_t };
438
439 type file_t;
440 type file_exec_t, files;
441 type fs_t;
442 type base_optional_1;
443 type base_optional_2;
444
445 allow sysadm_t file_exec_t: file { execute read write ioctl lock entrypoint };
446
447 optional {
448 require {
449 type base_optional_1, base_optional_2;
450 }
451 allow base_optional_1 base_optional_2 : file { read write };
452 }
453
454 #####################################
455 # Role Allow
456 allow user_r sysadm_r;
457
458 ####################################
459 # Booleans
460 bool allow_ypbind true;
461 bool secure_mode false;
462 bool allow_execheap false;
463 bool allow_execmem true;
464 bool allow_execmod false;
465 bool allow_execstack true;
466 bool optional_bool_1 true;
467 bool optional_bool_2 false;
468
469 #####################################
470 # users
471 gen_user(system_u,, system_r, s0, s0 - s0:c0.c23)
472 gen_user(root,, user_r sysadm_r, s0, s0 - s0:c0.c23)
473 gen_user(joe,, user_r, s0, s0 - s0:c0.c23)
474
475 #####################################
476 # constraints
477
478
479 ####################################
480 #line 1 "initial_sid_contexts"
481
482 sid kernel gen_context(system_u:system_r:sys_foo_t, s0)
483
484
485 ############################################
486 #line 1 "fs_use"
487 #
488 fs_use_xattr ext2 gen_context(system_u:object_r:fs_t, s0);
489 fs_use_xattr ext3 gen_context(system_u:object_r:fs_t, s0);
490 fs_use_xattr reiserfs gen_context(system_u:object_r:fs_t, s0);
491
492
493 genfscon proc / gen_context(system_u:object_r:sys_foo_t, s0)
494
495
496 ####################################
497 #line 1 "net_contexts"
498
499 #portcon tcp 21 system_u:object_r:net_foo_t:s0
500
501 #netifcon lo system_u:object_r:net_foo_t system_u:object_r:net_foo_t:s0
502
503 #
504 #nodecon 127.0.0.1 255.255.255.255 system_u:object_r:net_foo_t:s0
505
506 nodecon ::1 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF gen_context(system_u:object_r:net_foo_t, s0)
507
508
509
510