Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[buildx] - SELinux policy denied #2295

Open
ldelossa opened this issue Aug 4, 2021 · 3 comments
Open

[buildx] - SELinux policy denied #2295

ldelossa opened this issue Aug 4, 2021 · 3 comments

Comments

@ldelossa
Copy link

ldelossa commented Aug 4, 2021

Hello,

I am working on a Fedora 34 machine with moby engine installed.

My work uses buildx to create our containers locally on our workstations.

When SELinux is enabled, building with buildx fails.

Aug 03 19:33:58 fedora audit[629437]: AVC avc:  denied  { entrypoint } for  pid=629437 comm="runc:[2:INIT]" path="/bin/dockerfile-frontend" dev="nvme0n1p2" ino=260 scontext=system_u:system_r:container_t:s0:c675,c1001 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file permissive=0

Since /bin/dockerfile-frontend does not exist on my localhost, I'm assuming buildx is launching a process in it's own namespaces and attempting to access a file in its own mount namespace.

I'm to assume at first glance that whereever /bin/dockerfile-frontend lands on the host file system, it is not being labeled with the container_t domain and the policy is blocking execution.

@ldelossa
Copy link
Author

ldelossa commented Aug 4, 2021

The follow policy will fix this issue:

echo 'AVC avc:  denied  { entrypoint } for  pid=629437 comm="runc:[2:INIT]" path="/bin/dockerfile-frontend" dev="nvme0n1p2" ino=260 scontext=system_u:system_r:container_t:s0:c675,c1001 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file permissive=0' | audit2allow 


#============= container_t ==============
allow container_t unlabeled_t:file entrypoint;

However this seems over-reaching and still seems like buildx/buildkit is not labeling files correctly.

@thaJeztah
Copy link
Member

/cc @kolyshkin

@randomvariable
Copy link

Can confirm this is still an issue on fresh installs of Fedora 35.

An example is running make test-e2e-image in https://github.com/kubernetes-sigs/cluster-api-provider-aws

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants