-
Notifications
You must be signed in to change notification settings - Fork 779
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
Can't connect to Docker daemon when SELinux is in use #135
Comments
Hi @akaihola , Thank you for reporting this. Here is what happens. When dockerd starts it listens on a socket (unix:///var/snap/microk8s/current/docker.sock), selinux is blocking socket communication by default as discussed in https://forum.snapcraft.io/t/selinux-blocking-socket-activation-on-fedora/6931 . You can verify this by temporarily disabling selinux and restarting microk8s:
I am taking a look now how/if we can detect selinux and set it to allow the required socket communication. Thank you for taking the time to report this issue and apologies for any inconvenience. |
Hi @ktsakalozos, Thanks for pointing out SELinux as the reason for my problem. I wonder if there's a manual way to allow the required socket communication which I could use as a temporary work-around? I know the basics of SELinux, so if you can give some pointers, I can probably figure it out and post the work-around here. |
Thank you for volunteering @akaihola. When you have SELinux you get a number of deny audit entries in The part that I would need your help is to translate the audit logs and turn them into a script with appropriate rules. Do you think you could do that? I appreciate your help. Thank you. |
@ktsakalozos, here's an excerpt from my
I'm now running on a freshly installed Fedora 29 box. |
Thank you @akaihola , How do you tell SElinux to allow these operations? I guess I have to do some reading. |
@ktsakalozos, I can't answer that without studying a bit either. I could check if we have more experienced SELinux users at work. |
It sounds to me like Fedora isn't a first-class citizen distro for Snap. Searching for selinux on the Snapcraft forum found several threads that are probably related. |
I ran this command:
and pasted in the lines from
If I run
then microk8s works as described in the README. I hope this is helpful for enabling support for SELinux enabled systems. |
I got some success with the process you describe above @akaihola. However as soon as the first denials were addressed a few others came up. |
@ktsakalozos, you're right, my list wasn't complete. I'll continue exploring this. |
@ktsakalozos It was great to meet you at the cfgmgmt camp. On this subject, I was about to extract all rules I added on my computer, but I know it is not a good option as every container we will create will need a new set of rules. I decide to check how docker / containerd was doing on the subject. They have a pre-defined set of rules inside an rpm ( My idea was first to try to set the selinux container type on the docker in the snap, but unfortunatly I got a small issue: Snap are read only, so the Not sure how to test that. It would be cool if installing the snap requires the |
Nice talking to you face to face @GregoireW . Indeed the file system with the binaries is read only and I read the labels are filesystem metadata. I want to see if I can set labels during the build of the snap package. I will have news on this soon. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Has this changed at all? k3s has made some progress with SELinux support: |
As MicroK8s is a snap most of the AppArmor and SELinux configuration is taken care by the snapcraft underlying layer. On the MicroK8s side we are working towards a strictly confined snap that would comply with the snapcraft best practices and will take advantage of all the security enhancements offered. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
These docs may be helpful for implementing SELinux support at the snapcraft layer: "Formally add support for SELinux (Enforced mode)" k3s-io/k3s#1372 (comment) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
sudo dnf remove docker-ce
and reboot (just in case)sudo snap install --edge --classic microk8s
(also tried--beta
and--stable
)microk8s.inspect
shows everything okmicrok8s.docker -D -l debug <command>
outputs nothing and hangs, no matter what command I try (even--help
)inspection-report-20181016_082316.tar.gz
The text was updated successfully, but these errors were encountered: