summaryrefslogtreecommitdiff
path: root/src/misc.cil
blob: a543f5794615fab6d6cabde9fa026847caff4d18 (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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
;; SPDX-FileCopyrightText: M-BM-) 2025 Dominick Grift <dominick.grift@defensec.nl>
;; SPDX-License-Identifier: Unlicense

(sidcontext init (sys.id sys.role sys.subj sys.lowlow)) ;; userspace_initial_context

(in hugetlb

    (filecon "/dev/hugepages" dir ())
    (filecon "/dev/hugepages/.*" any ())

    (allow fs self (filesystem (associate))))

(in lib

    (filecon "/usr/lib" dir file_context)
    (filecon "/usr/lib/.*" any file_context)

    (macro data_file_type_transition_file ((type ARG1))
	(call .data.file_type_transition
	    (ARG1 file dir "lib"))
	(call .data.file_type_transition
	    (ARG1 file dir "lib64")))

    (macro root_file_type_transition_file ((type ARG1))
	(call .root.file_type_transition
	    (ARG1 file dir "lib"))
	(call .root.file_type_transition
	    (ARG1 file dir "lib64"))))

(in log

    (filecon "/var/log" dir file_context)
    (filecon "/var/log/.*" any file_context)

    (macro var_file_type_transition_file ((type ARG1))
	(call .var.file_type_transition
	    (ARG1 file dir "log")))

    (call .tmp.associate_fs (file)))

(in lostfound

    (filecon "/\.journal" file ())
    (filecon "/lost\+found" dir file_context)

    (filecon "/boot/\.journal" file ())
    (filecon "/boot/lost\+found" dir file_context)

    (filecon "/etc/\.journal" file ())
    (filecon "/etc/lost\+found" dir file_context)

    (filecon "/home/\.journal" file ())
    (filecon "/home/lost\+found" dir file_context)

    (filecon "/opt/\.journal" file ())
    (filecon "/opt/lost\+found" dir file_context)

    (filecon "/run/\.journal" file ())
    (filecon "/run/lost\+found" dir file_context)

    (filecon "/srv/\.journal" file ())
    (filecon "/srv/lost\+found" dir file_context)

    (filecon "/tmp/\.journal" file ())
    (filecon "/tmp/lost\+found" dir file_context)

    (filecon "/usr/\.journal" file ())
    (filecon "/usr/lost\+found" dir file_context)

    (filecon "/usr/tmp/\.journal" file ())
    (filecon "/usr/tmp/lost\+found" dir file_context)

    (filecon "/var/\.journal" file ())
    (filecon "/var/lost\+found" dir file_context)

    (filecon "/var/cache/\.journal" file ())
    (filecon "/var/cache/lost\+found" dir file_context)

    (filecon "/var/db/\.journal" file ())
    (filecon "/var/db/lost\+found" dir file_context)

    (filecon "/var/lib/\.journal" file ())
    (filecon "/var/lib/lost\+found" dir file_context)

    (filecon "/var/log/\.journal" file ())
    (filecon "/var/log/lost\+found" dir file_context)

    (filecon "/var/run/\.journal" file ())
    (filecon "/var/run/lost\+found" dir file_context)

    (filecon "/var/spool/\.journal" file ())
    (filecon "/var/spool/lost\+found" dir file_context)

    (filecon "/var/tmp/\.journal" file ())
    (filecon "/var/tmp/lost\+found" dir file_context)

    (macro boot_file_type_transition_file ((type ARG1))
	(call .boot.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro cache_file_type_transition_file ((type ARG1))
	(call .cache.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro conf_file_type_transition_file ((type ARG1))
	(call .conf.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro data_file_type_transition_file ((type ARG1))
	(call .data.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro db_file_type_transition_file ((type ARG1))
	(call .db.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro home_file_type_transition_file ((type ARG1))
	(call .home.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro log_file_type_transition_file ((type ARG1))
	(call .log.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro root_file_type_transition_file ((type ARG1))
	(call .root.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro run_file_type_transition_file ((type ARG1))
	(call .run.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro spool_file_type_transition_file ((type ARG1))
	(call .spool.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro state_file_type_transition_file ((type ARG1))
	(call .state.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro tmp_file_type_transition_file ((type ARG1))
	(call .tmp.file_type_transition
	    (ARG1 file dir "lost+found")))

    (macro var_file_type_transition_file ((type ARG1))
	(call .var.file_type_transition
	    (ARG1 file dir "lost+found"))))

(in mail.spool

    (filecon "/var/spool/mail" dir file_context)
    (filecon "/var/spool/mail/.*" any file_context)

    (macro spool_file_type_transition_file ((type ARG1))
	(call .spool.file_type_transition
	    (ARG1 file dir "mail")))

    (macro var_file_type_transition_file ((type ARG1))
	(call .var.file_type_transition
	    (ARG1 file dir "mail"))))

(in media

    (filecon "/media" dir file_context)
    (filecon "/media/cdrom" symlink file_context)
    (filecon "/media/.*" any ())

    (filecon "/mnt" dir file_context)
    (filecon "/mnt/.*" any ())

    (filecon "/run/media" dir file_context)
    (filecon "/run/media/.*" any ())

    (macro root_file_type_transition_file ((type ARG1))
	(call .root.file_type_transition
	    (ARG1 file dir "media"))
	(call .root.file_type_transition
	    (ARG1 file dir "mnt")))

    (macro run_file_type_transition_file ((type ARG1))
	(call .run.file_type_transition
	    (ARG1 file dir "media")))

    (call .tmp.associate_fs (file)))

(in mod

    (filecon "/usr/lib/modules" dir file_context)
    (filecon "/usr/lib/modules/.*" any file_context)

    (macro lib_file_type_transition_file ((type ARG1))
	(call .lib.file_type_transition
	    (ARG1 file dir "modules"))))

(in mqueue

    (filecon "/dev/mqueue" dir ())
    (filecon "/dev/mqueue/.*" any ())

    (allow fs self (filesystem (associate))))

(in proc

    (filecon "/proc" dir fs_context)
    (filecon "/proc/.*" any ())

    (macro root_file_type_transition_fs ((type ARG1))
	(call .root.file_type_transition
	    (ARG1 fs dir "proc")))

    (call .xattr.associate_fs (fs)))

(in pstore

    (filecon "/sys/fs/pstore" dir ())
    (filecon "/sys/fs/pstore/.*" any ()))

(in root

    (filecon "/usr/bin" symlink file_context)
    (filecon "/usr/lib" symlink file_context)

    (allow fs self (filesystem (associate))))

(in rpcpipe

    (filecon "/run/rpc_pipefs" dir ())
    (filecon "/run/rpc_pipefs/.*" any ()))

(in run

    (filecon "/run" dir file_context)
    (filecon "/run/.*" any file_context)

    (macro root_file_type_transition_file ((type ARG1))
	(call .root.file_type_transition
	    (ARG1 file dir "run")))

    (macro var_file_type_transition_file ((type ARG1))
	(call .var.file_type_transition
	    (ARG1 file dir "run")))

    (call .root.associate_fs (file)))

(in runlock

    (filecon "/run/lock" dir file_context)
    (filecon "/run/lock/.*" any ())

    (filecon "/run/lock/subsys" dir file_context)

    (macro run_file_type_transition_file ((type ARG1))
	(call .run.file_type_transition
	    (ARG1 file dir "lock")))

    (macro var_file_type_transition_file ((type ARG1))
	(call .var.file_type_transition
	    (ARG1 file dir "lock"))))

(in runuser

    (filecon "/run/user" dir file_context)
    (filecon "/run/user/.*" any file_context)

    (macro run_file_type_transition_file ((type ARG1))
	(call .run.file_type_transition
	    (ARG1 file dir "user"))))

(in security

    (filecon "/sys/kernel/security" dir ())
    (filecon "/sys/kernel/security/.*" any ()))

(in selinux

    (filecon "/sys/fs/selinux" dir ())
    (filecon "/sys/fs/selinux/.*" any ()))

(in spool

    (filecon "/var/spool" dir file_context)
    (filecon "/var/spool/.*" any file_context)

    (macro var_file_type_transition_file ((type ARG1))
	(call .var.file_type_transition
	    (ARG1 file dir "spool"))))

(in src

    (filecon "/usr/src" dir file_context)
    (filecon "/usr/src/.*" any file_context)

    (macro data_file_type_transition_file ((type ARG1))
	(call .data.file_type_transition
	    (ARG1 file dir "src"))))

(in state

    (filecon "/var/lib" dir file_context)
    (filecon "/var/lib/.*" any file_context)

    (macro var_file_type_transition_file ((type ARG1))
	(call .var.file_type_transition
	    (ARG1 file dir "lib")))

    (call .root.associate_fs (file)))

(in sys

    (filecon "/sys" dir fs_context)
    (filecon "/sys/.*" any ())

    (macro root_file_type_transition_fs ((type ARG1))
	(call .root.file_type_transition
	    (ARG1 fs dir "sys")))

    (allow fs self (filesystem (associate)))

    (call hugetlbfs.hugetlb_fs_type_transition_file (subj "*"))

    (call mqueuefs.mqueue_fs_type_transition_file (subj "*"))

    (call tmp.tmp_file_type_transition_file (subj dir "*"))
    (call tmp.tmp_file_type_transition_file (subj fifo_file "*"))
    (call tmp.tmp_file_type_transition_file (subj file "*"))
    (call tmp.tmp_file_type_transition_file (subj lnk_file "*"))
    (call tmp.tmp_file_type_transition_file (subj sock_file "*"))

    (call tmpfs.tmp_fs_type_transition_file (subj dir "*"))
    (call tmpfs.tmp_fs_type_transition_file (subj fifo_file "*"))
    (call tmpfs.tmp_fs_type_transition_file (subj file "*"))
    (call tmpfs.tmp_fs_type_transition_file (subj lnk_file "*"))
    (call tmpfs.tmp_fs_type_transition_file (subj sock_file "*"))

    (call .tmp.sys_tmp_file_type_transition_file (subj))

    (call .xattr.associate_fs (fs)))

(in sys.home

    (filecon "/root" dir file_context)
    (filecon "/root/.*" any file_context)

    (macro root_file_type_transition_file ((type ARG1))
	(call .root.fs_type_transition
	    (ARG1 file dir "root"))))

(in sys.hugetlbfs

    (macro hugetlb_fs_type_transition_file ((type ARG1)(name ARG2))
	(call .hugetlb.fs_type_transition
	    (ARG1 file file ARG2))))

(in sys.mqueuefs

    (macro mqueue_fs_type_transition_file ((type ARG1)(name ARG2))
	(call .mqueue.fs_type_transition
	    (ARG1 file file ARG2))))

(in sys.tmp

    (macro tmp_file_type_transition_file ((type ARG1)(class ARG2)(name ARG3))
	(call .tmp.file_type_transition
	    (ARG1 file ARG2 ARG3))))

(in sys.tmpfs

    (macro tmp_fs_type_transition_file ((type ARG1)(class ARG2)(name ARG3))
	(call .tmp.fs_type_transition
	    (ARG1 file ARG2 ARG3))))

(in sys.unconfined

    (allow typeattr subj (system (reboot reload start status stop))))

(in tmp

    (filecon "/dev/shm" dir fs_context)
    (filecon "/dev/shm/.*" any ())

    (filecon "/run/initramfs/.*" any ())

    (filecon "/tmp" dir file_context)
    (filecon "/tmp/.*" any ())

    (filecon "/tmp/\.font-unix" dir file_context)
    (filecon "/tmp/\.font-unix/.*" any ())
    (filecon "/tmp/\.ICE-unix" dir file_context)
    (filecon "/tmp/\.ICE-unix/.*" any ())
    (filecon "/tmp/\.Test-unix" dir file_context)
    (filecon "/tmp/\.Test-unix/.*" any ())
    (filecon "/tmp/\.X11-unix" dir file_context)
    (filecon "/tmp/\.X11-unix/.*" any ())
    (filecon "/tmp/\.XIM-unix" dir file_context)
    (filecon "/tmp/\.XIM-unix/.*" any ())

    (macro data_file_type_transition_file ((type ARG1))
	(call .data.file_type_transition
	    (ARG1 file dir "tmp")))

    (macro root_file_type_transition_file ((type ARG1))
	(call .root.file_type_transition
	    (ARG1 file dir "tmp")))

    (macro sys_tmp_file_type_transition_file ((type ARG1))
	(call .sys.tmp.file_type_transition
	    (ARG1 file dir "tmp")))

    (macro var_file_type_transition_file ((type ARG1))
	(call .var.file_type_transition
	    (ARG1 file dir "tmp")))

    (allow fs self (filesystem (associate)))

    (call .devtmp.associate_fs (fs)))

(in trace

    (filecon "/sys/kernel/tracing" dir ())
    (filecon "/sys/kernel/tracing/.*" any ()))

(in var

    (filecon "/run" symlink file_context)
    (filecon "/run/lock" symlink file_context)

    (filecon "/srv" dir file_context)
    (filecon "/srv/.*" any file_context)

    (filecon "/var" dir file_context)
    (filecon "/var/.*" any file_context)

    (filecon "/var/spool/mail" symlink file_context)

    (macro root_file_type_transition_file ((type ARG1))
	(call .root.file_type_transition
	    (ARG1 file dir "srv"))
	(call .root.file_type_transition
	    (ARG1 file dir "var"))))

(typealias dpkg_script_t)
(in sys (typealiasactual dpkg_script_t subj))

(boolean xserver_object_manager false)