-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add runc_dmz_selinux_compat build tag
Add a new build tag, runc_dmz_selinux_compat, that enables a workaround for dmz vs selinux. Document it in the top-level and libct/dmz READMEs. Use the new tag in our CI builds for Fedora, CentOS 7, and CentOS Stream 8. Do not use it for CS9 since it already has container-selinux 2.224.0 available. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
- Loading branch information
Showing
6 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//go:build !runc_dmz_selinux_compat || !linux | ||
|
||
package dmz | ||
|
||
import "github.com/opencontainers/runc/libcontainer/configs" | ||
|
||
// WorksWithSELinux tells whether runc-dmz can work with SELinux. | ||
func WorksWithSELinux(*configs.Config) bool { | ||
return true | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//go:build linux && runc_dmz_selinux_compat | ||
|
||
package dmz | ||
|
||
import ( | ||
"github.com/opencontainers/runc/libcontainer/configs" | ||
"github.com/opencontainers/selinux/go-selinux" | ||
) | ||
|
||
// WorksWithSELinux tells whether runc-dmz can work with SELinux. | ||
// | ||
// Older SELinux policy can prevent runc to execute the dmz binary. The issue is | ||
// fixed in container-selinux >= 2.224.0: | ||
// | ||
// - https://github.com/containers/container-selinux/issues/274 | ||
// - https://github.com/containers/container-selinux/pull/280 | ||
// | ||
// Alas, there is is no easy way to do a runtime check if dmz works with | ||
// SELinux, so distributions that do not have the above fix have to build runc | ||
// with runc_dmz_selinux_compat build flag. If the flag is set, the code below | ||
// is used, which results in disabling dmz in case container SELinux label is | ||
// set and the selinux is in enforced mode. | ||
func WorksWithSELinux(c *configs.Config) bool { | ||
return c.ProcessLabel == "" || selinux.EnforceMode() != selinux.Enforcing | ||
} |