-
Notifications
You must be signed in to change notification settings - Fork 457
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 support for selinux in verbose bind mount specification #911
Conversation
This corresponds to specifying the `z` or `Z` option in the third portion of a terse mount specification (i.e. src:trg:z) Signed-off-by: charliemirabile <46761267+charliemirabile@users.noreply.github.com>
based on seccomp test. Without the selinux option, visiting localhost:8080 will give a 404 error because httpd cannot access the file, but with selinux: z the context for the file will be appropriately updated so httpd can access it Signed-off-by: charliemirabile <46761267+charliemirabile@users.noreply.github.com>
@@ -431,6 +431,11 @@ def mount_desc_to_mount_args(compose, mount_desc, srv_name, cnt_name): # pylint | |||
tmpfs_mode = tmpfs_opts.get("mode", None) | |||
if tmpfs_mode: | |||
opts.append(f"tmpfs-mode={tmpfs_mode}") | |||
if mount_type == "bind": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a test for the function this code lives in in pytests/
@@ -486,6 +491,12 @@ def mount_desc_to_volume_args(compose, mount_desc, srv_name, cnt_name): # pylin | |||
read_only = mount_desc.get("read_only", None) | |||
if read_only is not None: | |||
opts.append("ro" if read_only else "rw") | |||
if mount_type == "bind": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a test for the function this code lives in in pytests/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but needs tests.
@muayyad-alsadi Please don't merge PRs that have unaddressed concerns raised |
Support for setting the selinux flags on a bind mount specified using the verbose syntax was merged as part of containers#911, but at that time the PR lacked unit tests. This commit adds the missing tests Signed-off-by: charliemirabile <46761267+charliemirabile@users.noreply.github.com>
Support for setting the selinux flags on a bind mount specified using the verbose syntax was merged as part of containers#911, but at that time the PR lacked unit tests. This commit adds the missing tests Signed-off-by: charliemirabile <46761267+charliemirabile@users.noreply.github.com>
Support for setting the selinux flags on a bind mount specified using the verbose syntax was merged as part of containers#911, but at that time the PR lacked unit tests. This commit adds the missing tests Signed-off-by: charliemirabile <46761267+charliemirabile@users.noreply.github.com>
Support for setting the selinux flags on a bind mount specified using the verbose syntax was merged as part of containers#911, but at that time the PR lacked unit tests. This commit adds the missing tests Signed-off-by: charliemirabile <46761267+charliemirabile@users.noreply.github.com>
As specified here in the compose schema: https://github.com/compose-spec/compose-spec/blob/c35d19323fdfd7dbf9db30022498e29ef5ebeab2/schema/compose-spec.json#L382-L388
and described here in the compose spec: https://github.com/compose-spec/compose-spec/blob/master/05-services.md#long-syntax-5
it should be possible to specify selinux relabeling for a bind mount specified using the verbose syntax (as opposed to the terse syntax which already works). This PR adds support for this syntax in podman compose to achieve parity with docker compose in this area.