Skip to content

Conversation

@ningmingxiao
Copy link
Contributor

@ningmingxiao ningmingxiao commented Dec 6, 2025

@ningmingxiao ningmingxiao force-pushed the selinux_support branch 7 times, most recently from d69b7e0 to 2eaa687 Compare December 6, 2025 15:21
@ningmingxiao ningmingxiao changed the title feature:support selinux use --security-opt label=xxx feature:support selinux Dec 6, 2025
@ningmingxiao ningmingxiao changed the title feature:support selinux feature: support selinux Dec 6, 2025
if err != nil {
output := strings.TrimSpace(string(stdout))
if strings.Contains(output, "container_t") {
t.Fatal(fmt.Errorf("expect label container_t but get %s", output))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The uniqueness of the MCS categories have to be checked too?

Copy link
Contributor Author

@ningmingxiao ningmingxiao Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think how to check? @AkihiroSuda

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just run multiple containers and check that the MCS categories are different

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because nerdctl doesn't save selinux label into db, nerdctl is a brief process, so may have chance to have same MCS categories . may be I should refer container id to keep special.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the disadvantage if 2 containers have same MCS categories ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or we should let containerd call label.InitLabels(labelOpts) instead of let nerdctl create it @AkihiroSuda

@AkihiroSuda AkihiroSuda added this to the v2.3.0 milestone Dec 8, 2025
@ningmingxiao ningmingxiao marked this pull request as draft December 9, 2025 01:52
@ningmingxiao ningmingxiao force-pushed the selinux_support branch 5 times, most recently from ec3feb9 to 977dba6 Compare December 11, 2025 02:14
@ningmingxiao ningmingxiao marked this pull request as ready for review December 11, 2025 06:06
selinux_enabled= true
```

## Properties
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be updated

Copy link
Contributor Author

@ningmingxiao ningmingxiao Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what you meean ? about selinux_enabled= true @AkihiroSuda

{
Description: "test run with selinux-enabled",
Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
return helpers.Command("--selinux-enabled", "run", "-d", "-v", fmt.Sprintf("/%s:/%s:Z", testContainer, testContainer), "--name", testContainer, "sleep", "infinity")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lower z should be tested too
https://docs.docker.com/engine/storage/bind-mounts/#configure-the-selinux-label

The z option indicates that the bind mount content is shared among multiple containers.
The Z option indicates that the bind mount content is private and unshared.

This should be verified by launching multiple containers

@AkihiroSuda
Copy link
Member

Needs rebase

@ningmingxiao ningmingxiao force-pushed the selinux_support branch 3 times, most recently from 565bbde to 59bc5ef Compare December 22, 2025 10:58
@ningmingxiao
Copy link
Contributor Author

Needs rebase

done

Signed-off-by: ningmingxiao <[email protected]>
@ningmingxiao
Copy link
Contributor Author

ningmingxiao commented Dec 25, 2025

do we need add a new api in containerd to manage selinuxlabel ? because " label.InitLabels(labelOptions)" should run on server to keep unique @AkihiroSuda

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants