Skip to content

Commit 8ab86b6

Browse files
author
Mrunal Patel
committed
Merge pull request #53 from rhatdan/selinux
Add mount label man page content
2 parents 3ee7b3e + 1956b9c commit 8ab86b6

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

man/ocitools-generate.1.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@ inside of the container.
7979
**--mount-cgroups**=[rw|ro|no]
8080
Mount cgroups. The default is `no`.
8181

82+
**--mount-label**=[=*MOUNTLABEL*]]
83+
Mount Label
84+
Depending on your SELinux policy, you would specify a label that looks like
85+
this:
86+
"system_u:object_r:svirt_sandbox_file_t:s0:c1,c2"
87+
88+
Note you would want your ROOTFS directory to be labeled with a context that
89+
this process type can use.
90+
91+
"system_u:object_r:usr_t:s0" might be a good label for a readonly container,
92+
"system_u:system_r:svirt_sandbox_file_t:s0:c1,c2" for a read/write container.
93+
8294
**--network**
8395
Use network namespace
8496

@@ -149,7 +161,7 @@ inside of the container.
149161
this process type can use.
150162

151163
"system_u:object_r:usr_t:s0" might be a good label for a readonly container,
152-
"system_u:system_r:svirt_sandbox_file_t:s0:c1,c2" for a read/write container.
164+
"system_u:object_r:svirt_sandbox_file_t:s0:c1,c2" for a read/write container.
153165

154166
**--sysctl**=SYSCTLSETTING
155167
Add sysctl settings e.g net.ipv4.forward=1, only allowed if the syctl is
@@ -222,7 +234,7 @@ colon:
222234

223235
You can use SELinux to add security to the container. You must specify the process label to run the init process inside of the container using the --selinux-label.
224236

225-
# ocitools generate --bind /var/db:/data1 --selinux-label system_u:system_r:svirt_lxc_net_t:s0:c1,c2 --rootfs /var/lib/containers/fedora --args bash
237+
# ocitools generate --bind /var/db:/data1 --selinux-label system_u:system_r:svirt_lxc_net_t:s0:c1,c2 --mount-label system_u:object_r:svirt_sandbox_file_t:s0:c1,c2 --rootfs /var/lib/containers/fedora --args bash
226238

227239
Not in the above example we used a type of svirt_lxc_net_t and an MCS Label of s0:c1,c2. If you want to guarantee separation between containers, you need to make sure that each container gets launched with a different MCS Label pair.
228240

0 commit comments

Comments
 (0)