@@ -84,3 +84,57 @@ project which handles bootloader installs and upgrades. The invocation of
84
84
` bootc install ` will always run ` bootupd ` to perform installations.
85
85
Additionally, ` bootc upgrade ` will currently not upgrade the bootloader;
86
86
you must invoke ` bootupctl update ` .
87
+
88
+ # SELinux
89
+
90
+ Container runtimes such as ` podman ` and ` docker ` commonly
91
+ apply a "coarse" SELinux policy to running containers.
92
+ See [ container-selinux] ( https://github.com/containers/container-selinux/blob/main/container_selinux.8 ) .
93
+ It is very important to understand that non-bootc base
94
+ images do not (usually) have any embedded ` security.selinux ` metadata
95
+ at all; all labels on the toplevel container image
96
+ are * dynamically* generated per container invocation,
97
+ and there are no individually distinct e.g. ` etc_t ` and
98
+ ` usr_t ` types.
99
+
100
+ In contrast, with the current OSTree backend for bootc,
101
+ when the base image is built, label metadata is included
102
+ in special metadata files in ` /sysroot/ostree ` that correspond
103
+ to components of the base image.
104
+
105
+ When a bootc container is deployed, the system
106
+ will use these default SELinux labels.
107
+ Further non-OSTree layers will be dynamically labeled
108
+ using the base policy.
109
+
110
+ Hence, at the current time it will * not* work to override
111
+ the labels for files in derived layers by using e.g.
112
+
113
+ ```
114
+ RUN semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?"
115
+ ```
116
+
117
+ (This command will write to ` /etc/selinux/policy/$policy/ ` )
118
+
119
+ It will * never* work to do e.g.:
120
+
121
+ ```
122
+ RUN chcon -t foo_t /usr/bin/foo
123
+ ```
124
+
125
+ Because the container runtime state will deny the attempt to
126
+ "physically" set the ` security.selinux ` extended attribute.
127
+ In contrast per above, future support for custom labeling
128
+ will by default be done by customizing the policy file_contexts.
129
+
130
+ ### Toplevel directories
131
+
132
+ In particular, a common problem is that inside a container image,
133
+ it's easy to create arbitrary toplevel directories such as
134
+ e.g. ` /app ` or ` /aimodel ` etc. But in some SELinux policies
135
+ such as Fedora derivatives, these will be labeled as ` default_t `
136
+ which few domains can access.
137
+
138
+ References:
139
+
140
+ - < https://github.com/ostreedev/ostree-rs-ext/issues/510 >
0 commit comments