1container_selinux(8) SELinux Policy container container_selinux(8)
2
3
4
6 container_selinux - Security Enhanced Linux Policy for the container
7 processes
8
10 Security-Enhanced Linux secures the container processes via flexible
11 mandatory access control.
12
13 The container processes execute with the container_t SELinux type. You
14 can check if you have these processes running by executing the ps com‐
15 mand with the -Z qualifier.
16
17 For example:
18
19 ps -eZ | grep container_t
20
21
22
24 The container_t SELinux type can be entered via the file_type file
25 type.
26
27 The default entrypoint paths for the container_t domain are the follow‐
28 ing:
29
30 all files on the system
31
33 SELinux defines process types (domains) for each process running on the
34 system
35
36 You can see the context of a process using the -Z option to ps
37
38 Policy governs the access confined processes have to files. SELinux
39 container policy is very flexible allowing users to setup their con‐
40 tainer processes in as secure a method as possible.
41
42 The following process types are defined for container:
43
44 container_runtime_t, container_auth_t, container_t
45
46 Note: semanage permissive -a container_t can be used to make the
47 process type container_t permissive. SELinux does not deny access to
48 permissive process types, but the AVC (SELinux denials) messages are
49 still generated.
50
51
53 The SELinux process type container_t is an MCS (Multi Category Secu‐
54 rity) constrained type. Sometimes this separation is referred to as
55 sVirt. These types are usually used for securing multi-tenant environ‐
56 ments, such as virtualization, containers or separation of users. The
57 tools used to launch MCS types, pick out a different MCS label for each
58 process group.
59
60 For example one process might be launched with container_t:s0:c1,c2,
61 and another process launched with container_t:s0:c3,c4. The SELinux
62 kernel only allows these processes can only write to content with a
63 matching MCS label, or a MCS Label of s0. A process running with the
64 MCS level of s0:c1,c2 is not allowed to write to content with the MCS
65 label of s0:c3,c4
66
67
69 SELinux policy is customizable based on least access required. con‐
70 tainer policy is extremely flexible and has several booleans that allow
71 you to manipulate the policy and run container with the tightest access
72 possible.
73
74
75
76 If you want to deny any process from ptracing or debugging any other
77 processes, you must turn on the deny_ptrace boolean. Enabled by
78 default.
79
80 setsebool -P deny_ptrace 1
81
82
83
84 If you want to allow any process to mmap any file on system with
85 attribute file_type, you must turn on the domain_can_mmap_files bool‐
86 ean. Enabled by default.
87
88 setsebool -P domain_can_mmap_files 1
89
90
91
92 If you want to allow all domains write to kmsg_device, while kernel is
93 executed with systemd.log_target=kmsg parameter, you must turn on the
94 domain_can_write_kmsg boolean. Disabled by default.
95
96 setsebool -P domain_can_write_kmsg 1
97
98
99
100 If you want to allow all domains to use other domains file descriptors,
101 you must turn on the domain_fd_use boolean. Enabled by default.
102
103 setsebool -P domain_fd_use 1
104
105
106
107 If you want to allow all domains to have the kernel load modules, you
108 must turn on the domain_kernel_load_modules boolean. Disabled by
109 default.
110
111 setsebool -P domain_kernel_load_modules 1
112
113
114
115 If you want to allow all domains to execute in fips_mode, you must turn
116 on the fips_mode boolean. Enabled by default.
117
118 setsebool -P fips_mode 1
119
120
121
122 If you want to enable reading of urandom for all domains, you must turn
123 on the global_ssp boolean. Disabled by default.
124
125 setsebool -P global_ssp 1
126
127
128
129 If you want to allow sandbox containers manage fuse files, you must
130 turn on the virt_sandbox_use_fusefs boolean. Disabled by default.
131
132 setsebool -P virt_sandbox_use_fusefs 1
133
134
135
136 If you want to allow confined virtual guests to manage nfs files, you
137 must turn on the virt_use_nfs boolean. Disabled by default.
138
139 setsebool -P virt_use_nfs 1
140
141
142
143 If you want to allow confined virtual guests to manage cifs files, you
144 must turn on the virt_use_samba boolean. Disabled by default.
145
146 setsebool -P virt_use_samba 1
147
148
149
151 The SELinux process type container_t can manage files labeled with the
152 following file types. The paths listed are the default paths for these
153 file types. Note the processes UID still need to have DAC permissions.
154
155 cephfs_t
156
157
158 cifs_t
159
160
161 container_file_t
162
163 /var/lib/kubelet(/.*)?
164 /var/lib/docker/vfs(/.*)?
165
166 fusefs_t
167
168 /var/run/user/[^/]*/gvfs
169
170 hugetlbfs_t
171
172 /dev/hugepages
173 /usr/lib/udev/devices/hugepages
174
175 nfs_t
176
177
178
180 SELinux requires files to have an extended attribute to define the file
181 type.
182
183 You can see the context of a file using the -Z option to ls
184
185 Policy governs the access confined processes have to these files.
186 SELinux container policy is very flexible allowing users to setup their
187 container processes in as secure a method as possible.
188
189 EQUIVALENCE DIRECTORIES
190
191
192 container policy stores data with multiple different file context types
193 under the /var/lib/docker directory. If you would like to store the
194 data in a different directory you can use the semanage command to cre‐
195 ate an equivalence mapping. If you wanted to store this data under the
196 /srv dirctory you would execute the following command:
197
198 semanage fcontext -a -e /var/lib/docker /srv/docker
199 restorecon -R -v /srv/docker
200
201 container policy stores data with multiple different file context types
202 under the /var/run/docker directory. If you would like to store the
203 data in a different directory you can use the semanage command to cre‐
204 ate an equivalence mapping. If you wanted to store this data under the
205 /srv dirctory you would execute the following command:
206
207 semanage fcontext -a -e /var/run/docker /srv/docker
208 restorecon -R -v /srv/docker
209
210 STANDARD FILE CONTEXT
211
212 SELinux defines the file context types for the container, if you wanted
213 to store files with these types in a diffent paths, you need to execute
214 the semanage command to sepecify alternate labeling and then use
215 restorecon to put the labels on disk.
216
217 semanage fcontext -a -t container_var_run_t '/srv/mycontainer_con‐
218 tent(/.*)?'
219 restorecon -R -v /srv/mycontainer_content
220
221 Note: SELinux often uses regular expressions to specify labels that
222 match multiple files.
223
224 The following file types are defined for container:
225
226
227
228 container_auth_exec_t
229
230 - Set files with the container_auth_exec_t type, if you want to transi‐
231 tion an executable to the container_auth_t domain.
232
233
234 Paths:
235 /usr/bin/docker-novolume-plugin, /usr/lib/docker/docker-novolume-
236 plugin
237
238
239 container_config_t
240
241 - Set files with the container_config_t type, if you want to treat the
242 files as container configuration data, usually stored under the /etc
243 directory.
244
245
246
247 container_file_t
248
249 - Set files with the container_file_t type, if you want to treat the
250 files as container content.
251
252
253 Paths:
254 /var/lib/kubelet(/.*)?, /var/lib/docker/vfs(/.*)?
255
256
257 container_home_t
258
259 - Set files with the container_home_t type, if you want to store con‐
260 tainer files in the users home directory.
261
262
263
264 container_lock_t
265
266 - Set files with the container_lock_t type, if you want to treat the
267 files as container lock data, stored under the /var/lock directory
268
269
270
271 container_log_t
272
273 - Set files with the container_log_t type, if you want to treat the
274 data as container log data, usually stored under the /var/log direc‐
275 tory.
276
277
278
279 container_plugin_var_run_t
280
281 - Set files with the container_plugin_var_run_t type, if you want to
282 store the container plugin files under the /run or /var/run directory.
283
284
285
286 container_runtime_exec_t
287
288 - Set files with the container_runtime_exec_t type, if you want to
289 transition an executable to the container_runtime_t domain.
290
291
292
293 container_runtime_tmp_t
294
295 - Set files with the container_runtime_tmp_t type, if you want to store
296 container runtime temporary files in the /tmp directories.
297
298
299
300 container_runtime_tmpfs_t
301
302 - Set files with the container_runtime_tmpfs_t type, if you want to
303 store container runtime files on a tmpfs file system.
304
305
306
307 container_share_t
308
309 - Set files with the container_share_t type, if you want to treat the
310 files as container share data.
311
312
313 Paths:
314 /var/lib/docker/.*/config.env, /var/lib/docker/init(/.*)?,
315 /var/lib/docker/overlay(/.*)?, /var/lib/docker/contain‐
316 ers/.*/hosts, /var/lib/docker/containers/.*/hostname
317
318
319 container_unit_file_t
320
321 - Set files with the container_unit_file_t type, if you want to treat
322 the files as container unit content.
323
324
325 Paths:
326 /usr/lib/systemd/system/docker.service, /usr/lib/systemd/sys‐
327 tem/docker-novolume-plugin.service
328
329
330 container_var_lib_t
331
332 - Set files with the container_var_lib_t type, if you want to store the
333 container files under the /var/lib directory.
334
335
336 Paths:
337 /var/lib/docker(/.*)?, /var/lib/kublet(/.*)?, /var/lib/contain‐
338 ers(/.*)?
339
340
341 container_var_run_t
342
343 - Set files with the container_var_run_t type, if you want to store the
344 container files under the /run or /var/run directory.
345
346
347 Paths:
348 /var/run/docker(/.*)?, /var/run/containerd(/.*)?, /var/run/docker-
349 client(/.*)?, /var/run/docker.pid, /var/run/docker.sock
350
351
352 Note: File context can be temporarily modified with the chcon command.
353 If you want to permanently change the file context you need to use the
354 semanage fcontext command. This will modify the SELinux labeling data‐
355 base. You will need to use restorecon to apply the labels.
356
357
359 semanage fcontext can also be used to manipulate default file context
360 mappings.
361
362 semanage permissive can also be used to manipulate whether or not a
363 process type is permissive.
364
365 semanage module can also be used to enable/disable/install/remove pol‐
366 icy modules.
367
368 semanage boolean can also be used to manipulate the booleans
369
370
371 system-config-selinux is a GUI tool available to customize SELinux pol‐
372 icy settings.
373
374
376 This manual page was auto-generated using sepolicy manpage .
377
378
380 selinux(8), container(8), semanage(8), restorecon(8), chcon(1), sepol‐
381 icy(8) , setsebool(8), container_auth_selinux(8), con‐
382 tainer_auth_selinux(8), container_runtime_selinux(8), container_run‐
383 time_selinux(8)
384
385
386
387container 19-04-25 container_selinux(8)