-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add option to checkpoint to specify SELinux label #1992
Conversation
Signed-off-by: Adrian Reber <areber@redhat.com>
To checkpoint a process CRIU injects a parasite code into the process to be checkpointed. This parasite code tries to communicate over a socket with the main CRIU process. To SELinux this looks like a process inside of a container tries to open a socket to another process. This adds an option to runc to call setsockcreatecon() before running CRIU to label all sockets with a certain label. Having the possibility to specify a certain label makes it easier to write corresponding policies. Signed-off-by: Adrian Reber <areber@redhat.com>
@rhatdan as discussed in containers/podman#2334 |
I don't think we need an option here. runc should just be setting the socket label to match the process label if the process label is set. This indicates that the socket is to be used by the container process. |
Unfortunately this does not work at all. I was using an instrumented CRIU which did the setsockcreatecon() just before creating the socket without noticing it. I think I have to do this directly in CRIU because if I do setsockcreatecon() in runc before calling CRIU and if I then do a getsockcreatecon() in CRIU I get a null. It seems setsockcreatecon() does not survive exec(), right? |
From the man page of setsockcreatecon(3):
Would it be possible to pass the value of |
Thanks for that pointer. So it cannot work with setsockcreatecon() from the parent application.
So far I tried setexeccon() before calling CRIU, but that failed and I kind of expected that, because CRIU is then running in the wrong context. The problem I also detected is that the restore process is running in the wrong context anyway, so this needs some work on CRIU. As far as I understand it
I have also looked at this code already 😁 . |
Closing this as it does not work and I have a change in CRIU to do it correctly: checkpoint-restore/criu#648 |
To checkpoint a process CRIU injects a parasite code into the process to
be checkpointed. This parasite code tries to communicate over a socket
with the main CRIU process. To SELinux this looks like a process inside
of a container tries to open a socket to another process.
This adds an option to runc to call setsockcreatecon() before running
CRIU to label all sockets with a certain label. Having the possibility
to specify a certain label makes it easier to write corresponding
policies.