build.sh: sdk_run: Use :Z to relabel volumes attached to docker#750
Open
philipanda wants to merge 1 commit intodasharofrom
Open
build.sh: sdk_run: Use :Z to relabel volumes attached to docker#750philipanda wants to merge 1 commit intodasharofrom
:Z to relabel volumes attached to docker#750philipanda wants to merge 1 commit intodasharofrom
Conversation
899fe86 to
7106e31
Compare
When the repository is cloned to a directory with a domain that is not accessible by containers by default (like user_home_t), the build might fail due to access denials, or just fail silently.
`ausearch -m avc -ts recent -i` shows violation logs like:
```
type=AVC msg=audit(08/22/2025 09:43:42.740:641) : avc: denied { write } for pid=18611 comm=rm name=coreboot dev="dm-0" ino=85471 scontext=system_u:system_r:container_t:s0:c100,c319 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=dir permissive=1
```
- `container_t` cannot access `user_home_t`, so the access is denied.
Adding `:Z` suffix to the volumes relabels them with a domain that is accessible to `container_t` in SELinux. Specifically `:Z` says that the volumes will be only accessible by this one single container, and not shared between multiple ones. This way the build.sh script can be used without issues on SELinux-enabled systems without changing SELinux enforcement mode.
Source: https://docs.docker.com/engine/storage/bind-mounts/#configure-the-selinux-label
Upstream-Status: Inappropriate [Dasharo downstream]
Signed-off-by: Filip Gołaś <filip.golas@3mdeb.com>
7106e31 to
ffe4dfe
Compare
Contributor
Author
|
@pietrushnic does your system use SELinux? I wonder how this affects systems without it |
Contributor
I don't think so, I didn't enable it on my Debian 12. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the repository is cloned to a directory with a domain that is not accessible by containers by default (like user_home_t), the build might fail due to access denials, or just fail silently.
ausearch -m avc -ts recent -ishows violation logs like:container_tcannot accessuser_home_t, so the access is denied.Adding
:Zsuffix to the volumes relabels them with a domain that is accessible tocontainer_tin SELinux. Specifically:Zsays that the volumes will be only accessible by this one single container, and not shared between multiple ones. This way the build.sh script can be used without issues on SELinux-enabled systems without changing SELinux enforcement mode.Source: https://docs.docker.com/engine/storage/bind-mounts/#configure-the-selinux-label