forked from OwlCyberDefense/refpolicy-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshutdown.if
127 lines (114 loc) · 2.33 KB
/
shutdown.if
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
## <summary>System shutdown command.</summary>
########################################
## <summary>
## Role access for shutdown.
## </summary>
## <param name="role">
## <summary>
## Role allowed access.
## </summary>
## </param>
## <param name="domain">
## <summary>
## User domain for the role.
## </summary>
## </param>
#
interface(`shutdown_role',`
gen_require(`
type shutdown_t;
')
shutdown_run($2, $1)
allow $2 shutdown_t:process { ptrace signal_perms };
ps_process_pattern($2, shutdown_t)
')
########################################
## <summary>
## Execute a domain transition to run shutdown.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`shutdown_domtrans',`
gen_require(`
type shutdown_t, shutdown_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, shutdown_exec_t, shutdown_t)
')
########################################
## <summary>
## Execute shutdown in the shutdown
## domain, and allow the specified role
## the shutdown domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
## <param name="role">
## <summary>
## Role allowed access.
## </summary>
## </param>
#
interface(`shutdown_run',`
gen_require(`
attribute_role shutdown_roles;
')
shutdown_domtrans($1)
roleattribute $2 shutdown_roles;
')
########################################
## <summary>
## Send generic signals to shutdown.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`shutdown_signal',`
gen_require(`
type shutdown_t;
')
allow shutdown_t $1:process signal;
')
########################################
## <summary>
## Send SIGCHLD signals to shutdown.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`shutdown_sigchld',`
gen_require(`
type shutdown_t;
')
allow $1 shutdown_t:process sigchld;
')
########################################
## <summary>
## Get attributes of shutdown executable files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`shutdown_getattr_exec_files',`
gen_require(`
type shutdown_exec_t;
')
corecmd_search_bin($1)
allow $1 shutdown_exec_t:file getattr_file_perms;
')