summaryrefslogtreecommitdiff
path: root/src/dev/termdev/ptytermdev.cil
blob: 1818854d597955297891723c7c4aa1e1a066a1fb (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: © 2024 Dominick Grift <dominick.grift@defensec.nl>
;; SPDX-License-Identifier: Unlicense

(block ptytermdev

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

  (typeattribute typeattr)

  (blockinherit .file.all_macro_template_chr_files)

  (call .devpts.associate_fs (typeattr))

  (call .termdev.type (typeattr))

  (block base_template

    (blockabstract base_template)

    (context ptytermdev_context (.sys.id .sys.role ptytermdev lowlevelrange))

    (type ptytermdev)
    (call .ptytermdev.type (ptytermdev)))

  (block macro_template_chr_files

    (blockabstract macro_template_chr_files)

    (macro append_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev append_chr_file))

    (macro appendinherited_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev appendinherited_chr_file)
	   (allowx ARG1 ptytermdev IOCTLCONSOLE)
	   (allowx ARG1 ptytermdev IOCTLTTY_NOT_TIOCSTI)
	   (allowx ARG1 ptytermdev IOCTLVT))

    (macro create_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev create_chr_file))

    (macro delete_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev delete_chr_file))

    (macro manage_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev manage_chr_file))

    (macro mapexecute_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev mapexecute_chr_file))

    (macro read_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev read_chr_file))

    (macro readinherited_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev readinherited_chr_file))

    (macro readwrite_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev readwrite_chr_file))

    (macro readwriteinherited_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev readwriteinherited_chr_file)
	   (allowx ARG1 ptytermdev IOCTLCONSOLE)
	   (allowx ARG1 ptytermdev IOCTLTTY_NOT_TIOCSTI)
	   (allowx ARG1 ptytermdev IOCTLVT))

    (macro relabel_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev relabel_chr_file))

    (macro relabelfrom_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev relabelfrom_chr_file))

    (macro relabelto_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev relabelto_chr_file))

    (macro rename_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev rename_chr_file))

    (macro write_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev write_chr_file))

    (macro writeinherited_ptytermdev_chr_files ((type ARG1))
	   (allow ARG1 ptytermdev writeinherited_chr_file)
	   (allowx ARG1 ptytermdev IOCTLCONSOLE)
	   (allowx ARG1 ptytermdev IOCTLTTY_NOT_TIOCSTI)
	   (allowx ARG1 ptytermdev IOCTLVT)))

  (block template

    (blockabstract template)

    (blockinherit .ptytermdev.base_template)
    (blockinherit .ptytermdev.macro_template_chr_files))

  (block unconfined

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

    (typeattribute typeattr)

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

(in after ptytermdev.appendinherited_all_chr_files
    (allowx ARG1 typeattr IOCTLCONSOLE)
    (allowx ARG1 typeattr IOCTLTTY_NOT_TIOCSTI)
    (allowx ARG1 typeattr IOCTLVT))

(in after ptytermdev.readwriteinherited_all_chr_files
    (allowx ARG1 typeattr IOCTLCONSOLE)
    (allowx ARG1 typeattr IOCTLTTY_NOT_TIOCSTI)
    (allowx ARG1 typeattr IOCTLVT))

(in after ptytermdev.writeinherited_all_chr_files
    (allowx ARG1 typeattr IOCTLCONSOLE)
    (allowx ARG1 typeattr IOCTLTTY_NOT_TIOCSTI)
    (allowx ARG1 typeattr IOCTLVT))