summaryrefslogtreecommitdiff
path: root/src/misc/av/systemav.cil
blob: 61d8f8a7a68b6bd442891512e4f8026d7c6f295c (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
;; SPDX-FileCopyrightText: M-BM-) 2025 Dominick Grift <dominick.grift@defensec.nl>
;; SPDX-License-Identifier: Unlicense

(class system
    (halt ipc_info module_load module_request reboot reload start status
	stop syslog_console syslog_mod syslog_read))
(classorder (unordered system))

(in sys

    (macro ipcinfo_system ((type ARG1))
	(allow ARG1 subj (system (ipc_info))))

    (macro modulerequest_system ((type ARG1))
	(allow ARG1 subj (system (module_request))))

    (macro syslogconsole_system ((type ARG1))
	(allow ARG1 subj (system (syslog_console))))

    (macro syslogmod_system ((type ARG1))
	(allow ARG1 subj (system (syslog_mod))))

    (macro syslogread_system ((type ARG1))
	(allow ARG1 subj (system (syslog_read))))

    (block moduleload

	(macro type ((type ARG1))
	    (typeattributeset typeattr ARG1))

	(typeattribute not_typeattr)
	(typeattribute typeattr)

	(typeattributeset not_typeattr (not typeattr))

	(neverallow not_typeattr self (system (module_load))))

    (block unconfined

	(macro type ((type ARG1))
	    (typeattributeset typeattr ARG1))

	(typeattribute typeattr)

	(allow typeattr self (system (module_load)))
	(allow typeattr subj
	    (system (ipc_info module_request syslog_console syslog_mod
		    syslog_read)))

	;; potentially happens in autorelabel.target on policy model change
	(allow typeattr .invalid (system (module_load)))

	;; potentially happens in autorelabel.target on fresh install
	(allow typeattr .unlabeled (system (module_load)))

	(call moduleload.type (typeattr))))

(in unconfined

    (call .sys.unconfined.type (typeattr)))