-
Notifications
You must be signed in to change notification settings - Fork 14
/
pulpcore.te
245 lines (194 loc) · 8.3 KB
/
pulpcore.te
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
policy_module(pulpcore, 2.0.1)
require {
type httpd_config_t;
class dir search;
}
########################################
#
# Declarations
#
type pulpcore_t;
type pulpcore_exec_t;
init_daemon_domain(pulpcore_t, pulpcore_exec_t)
init_nnp_daemon_domain(pulpcore_t)
permissive pulpcore_t;
type pulpcore_server_t;
type pulpcore_server_exec_t;
init_daemon_domain(pulpcore_server_t, pulpcore_server_exec_t)
init_nnp_daemon_domain(pulpcore_server_t)
permissive pulpcore_server_t;
type pulpcore_etc_t;
files_config_file(pulpcore_etc_t)
type pulpcore_log_t;
logging_log_file(pulpcore_log_t)
type pulpcore_var_lib_t;
files_type(pulpcore_var_lib_t)
type pulpcore_server_var_lib_t;
files_type(pulpcore_server_var_lib_t)
type pulpcore_var_run_t;
files_pid_file(pulpcore_var_run_t)
type pulpcore_server_var_run_t;
files_pid_file(pulpcore_server_var_run_t)
type pulpcore_tmp_t;
files_tmp_file(pulpcore_tmp_t)
type pulpcore_server_tmp_t;
files_tmp_file(pulpcore_server_tmp_t)
type pulpcore_server_tmpfs_t;
files_tmpfs_file(pulpcore_server_tmpfs_t);
########################################
#
# pulpcore/pulpcore_server local policy
#
allow pulpcore_t pulpcore_server_exec_t:file getattr;
allow pulpcore_server_t pulpcore_exec_t:file getattr;
allow pulpcore_server_t self:fifo_file rw_fifo_file_perms;
allow pulpcore_server_t self:unix_stream_socket create_stream_socket_perms;
allow pulpcore_server_t self:netlink_route_socket { create_socket_perms nlmsg_read };
allow pulpcore_server_t self:tcp_socket create_stream_socket_perms;
allow pulpcore_server_t self:udp_socket create_stream_socket_perms;
# /etc
read_files_pattern(pulpcore_t, pulpcore_etc_t, pulpcore_etc_t)
read_files_pattern(pulpcore_server_t, pulpcore_etc_t, pulpcore_etc_t)
# /var/lib
manage_dirs_pattern(pulpcore_t, pulpcore_var_lib_t, pulpcore_var_lib_t)
manage_files_pattern(pulpcore_t, pulpcore_var_lib_t, pulpcore_var_lib_t)
manage_lnk_files_pattern(pulpcore_t, pulpcore_var_lib_t, pulpcore_var_lib_t)
manage_dirs_pattern(pulpcore_server_t, pulpcore_server_var_lib_t, pulpcore_server_var_lib_t)
manage_files_pattern(pulpcore_server_t, pulpcore_server_var_lib_t, pulpcore_server_var_lib_t)
manage_dirs_pattern(pulpcore_t, pulpcore_server_var_lib_t, pulpcore_server_var_lib_t)
manage_files_pattern(pulpcore_t, pulpcore_server_var_lib_t, pulpcore_server_var_lib_t)
filetrans_pattern(pulpcore_server_t, pulpcore_var_lib_t, pulpcore_server_var_lib_t, { dir file })
manage_dirs_pattern(pulpcore_server_t, pulpcore_var_lib_t, pulpcore_var_lib_t)
manage_files_pattern(pulpcore_server_t, pulpcore_var_lib_t, pulpcore_var_lib_t)
read_lnk_files_pattern(pulpcore_server_t, pulpcore_var_lib_t, pulpcore_var_lib_t)
write_sock_files_pattern(pulpcore_t, pulpcore_var_lib_t, pulpcore_var_lib_t)
# /var/log
append_files_pattern(pulpcore_t, pulpcore_log_t, pulpcore_log_t)
append_files_pattern(pulpcore_server_t, pulpcore_log_t, pulpcore_log_t)
# /run
manage_dirs_pattern(pulpcore_t, pulpcore_var_run_t, pulpcore_var_run_t)
manage_files_pattern(pulpcore_t, pulpcore_var_run_t, pulpcore_var_run_t)
files_pid_filetrans(pulpcore_t, pulpcore_var_run_t, { dir file sock_file})
manage_dirs_pattern(pulpcore_server_t, pulpcore_server_var_run_t, pulpcore_server_var_run_t)
manage_files_pattern(pulpcore_server_t, pulpcore_server_var_run_t, pulpcore_server_var_run_t)
manage_sock_files_pattern(pulpcore_server_t, pulpcore_server_var_run_t, pulpcore_server_var_run_t)
files_pid_filetrans(pulpcore_server_t, pulpcore_server_var_run_t, { dir file sock_file})
# /tmp
manage_dirs_pattern(pulpcore_t, pulpcore_tmp_t, pulpcore_tmp_t)
manage_files_pattern(pulpcore_t, pulpcore_tmp_t, pulpcore_tmp_t)
manage_lnk_files_pattern(pulpcore_t, pulpcore_tmp_t, pulpcore_tmp_t)
files_tmp_filetrans(pulpcore_t, pulpcore_tmp_t, { file dir })
manage_dirs_pattern(pulpcore_server_t, pulpcore_server_tmp_t, pulpcore_server_tmp_t)
manage_files_pattern(pulpcore_server_t, pulpcore_server_tmp_t, pulpcore_server_tmp_t)
files_tmp_filetrans(pulpcore_server_t, pulpcore_server_tmp_t, { file dir })
# /dev/shm
manage_files_pattern(pulpcore_t, pulpcore_server_tmpfs_t, pulpcore_server_tmpfs_t)
fs_tmpfs_filetrans(pulpcore_t, pulpcore_server_tmpfs_t, file )
allow pulpcore_t pulpcore_server_tmpfs_t:file map;
# interface calls
# Needed for systemd Type=notify support
# Needed when /run/systemd/notify is not appropriately labelled (at least on
# EL7) as kernel_t rather than init_var_run_t
kernel_dgram_send(pulpcore_server_t)
kernel_read_all_proc(pulpcore_t)
kernel_read_all_proc(pulpcore_server_t)
# pulp-2to3-migration plugin
apache_manage_sys_content_rw(pulpcore_t)
apache_read_sys_content_rw_files(pulpcore_t)
# Not needed during migration, but if a user accesses a migrated on-demand repo
# and therefore causes Pulp to download content, pulpcore-content < 3.15.0
# writes the file to /var/lib/pulp/ with the httpd_sys_rw_content_t label.
# And then the file inherits the httpd_sys_rw_content_t label.
# So remove this line once the policy no longer supports pulpcore < 3.15.0
# https://pulp.plan.io/issues/9000
apache_manage_sys_content_rw(pulpcore_server_t)
# pulp-2to3-migration plugin
apache_read_sys_content_rw_dirs(pulpcore_server_t)
# Not needed during migration, but if hardlinked content is read by
# pulpcore-content after migration, it can still have the old label.
apache_read_sys_content_rw_files(pulpcore_server_t)
auth_use_nsswitch(pulpcore_server_t)
auth_use_nsswitch(pulpcore_t)
can_exec(pulpcore_t, pulpcore_var_lib_t)
corecmd_exec_bin(pulpcore_t)
corecmd_exec_shell(pulpcore_t)
corecmd_exec_bin(pulpcore_server_t)
corecmd_exec_shell(pulpcore_server_t)
# mongod for pulp-2to3-migration plugin
corenet_tcp_connect_http_cache_port(pulpcore_t)
corenet_tcp_connect_http_port(pulpcore_t)
corenet_tcp_connect_mongod_port(pulpcore_t)
corenet_tcp_connect_postgresql_port(pulpcore_t)
corenet_tcp_connect_pulpcore_port(pulpcore_t)
corenet_tcp_connect_redis_port(pulpcore_t)
corenet_tcp_connect_squid_port(pulpcore_t)
corenet_tcp_bind_pulpcore_port(pulpcore_server_t)
corenet_tcp_connect_http_port(pulpcore_server_t)
corenet_tcp_connect_mongod_port(pulpcore_server_t)
corenet_tcp_connect_postgresql_port(pulpcore_server_t)
corenet_tcp_connect_redis_port(pulpcore_server_t)
fs_getattr_tmpfs(pulpcore_t)
fs_getattr_xattr_fs(pulpcore_t)
fs_getattr_xattr_fs(pulpcore_server_t)
libs_exec_ldconfig(pulpcore_t)
libs_exec_ldconfig(pulpcore_server_t)
# Block needed for systemd Type=notify support
init_write_pid_socket(pulpcore_server_t)
# This line is used when /run/systemd/notify is appropriately labelled
allow pulpcore_server_t init_var_run_t:unix_dgram_socket { connect create };
allow pulpcore_server_t self:unix_dgram_socket { connect create };
# This line is used when /run/systemd/notify is appropriately labelled
# Need verification that it is actually needed though. I think I observed
# it on a test EL7 system after fixing the labelling.
allow kernel_t init_var_run_t:unix_dgram_socket sendto;
miscfiles_read_generic_certs(pulpcore_t)
sysnet_read_config(pulpcore_t)
# Attempts to read the non-existent /etc/httpd/mime.types with Katello on EL7
# Occurs whenever mailcap isn't installed, which would provide /etc/mime.types
# dontaudit pulpcore_server_t httpd_config_t:dir search;
#
# Instead of just doing that, we have this broader config to allow both pulp
# contexts to be able to read the new pulp certs and keys under /etc/pulp/certs
apache_search_config(pulpcore_t)
apache_search_config(pulpcore_server_t)
allow pulpcore_t httpd_config_t:dir read;
allow pulpcore_server_t httpd_config_t:dir read;
# This allows API/Content to read the kernel keyring for the worker process.
allow pulpcore_server_t pulpcore_t:key { read view };
# And the inverse.
allow pulpcore_t pulpcore_server_t:key { read view };
optional_policy(`
gpg_exec(pulpcore_t)
gpg_exec(pulpcore_server_t)
')
optional_policy(`
kerberos_read_keytab(pulpcore_t)
kerberos_read_keytab(pulpcore_server_t)
')
optional_policy(`
postgresql_stream_connect(pulpcore_t)
postgresql_stream_connect(pulpcore_server_t)
')
optional_policy(`
redis_stream_connect(pulpcore_t)
redis_stream_connect(pulpcore_server_t)
')
optional_policy(`
unconfined_stream_connect(pulpcore_t)
')
########################################
#
# Local policy for external domains
#
optional_policy(`
gen_require(`
type httpd_t;
')
pulpcore_server_stream_connect(httpd_t)
')
optional_policy(`
gen_require(`
type init_t;
')
pulpcore_filetrans_named_content(init_t)
')