summaryrefslogtreecommitdiff
path: root/src/dev/nodedev.cil
blob: b681759a65f19351f0be4db9f1ad191fe7974e38 (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
;; SPDX-FileCopyrightText: © 2023 Dominick Grift <dominick.grift@defensec.nl>
;; SPDX-License-Identifier: Unlicense

(block nodedev

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

  (typeattribute typeattr)

  (macro mounton_all_chr_files ((type ARG1))
	 (allow ARG1 typeattr mounton_chr_file))

  (blockinherit .file.all_macro_template_chr_files)

  (call .dev.type (typeattr))

  (block base_template

    (blockabstract base_template)

    (context nodedev_context (.sys.id .sys.role nodedev lowlevelrange))

    (type nodedev)
    (call .nodedev.type (nodedev)))

  (block except

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

    (blockinherit file.all_macro_template_chr_files)

    (typeattribute typeattr)

    (typeattributeset typeattr
		      (and nodedev.typeattr (not (exception.typeattr)))))

  (block exception

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

    (typeattribute typeattr)

    (call nodedev.type (typeattr))

    (call .dev.exception.type (typeattr)))

  (block macro_template_chr_files

    (blockabstract macro_template_chr_files)

    (macro append_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev append_chr_file))

    (macro appendinherited_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev appendinherited_chr_file))

    (macro create_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev create_chr_file))

    (macro delete_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev delete_chr_file))

    (macro manage_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev manage_chr_file))

    (macro mapexecute_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev mapexecute_chr_file))

    (macro read_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev read_chr_file))

    (macro readinherited_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev readinherited_chr_file))

    (macro readwrite_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev readwrite_chr_file))

    (macro readwriteinherited_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev readwriteinherited_chr_file))

    (macro relabel_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev relabel_chr_file))

    (macro relabelfrom_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev relabelfrom_chr_file))

    (macro relabelto_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev relabelto_chr_file))

    (macro rename_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev rename_chr_file))

    (macro write_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev write_chr_file))

    (macro writeinherited_nodedev_chr_files ((type ARG1))
	   (allow ARG1 nodedev writeinherited_chr_file)))

  (block template

    (blockabstract template)

    (blockinherit .nodedev.base_template)
    (blockinherit .nodedev.macro_template_chr_files))

  (block unconfined

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

    (typeattribute typeattr)

    (allow typeattr nodedev.typeattr (chr_file (not (audit_access execmod))))))