Skip to content

Conversation

@ipilcher
Copy link

@ipilcher ipilcher commented Dec 5, 2025

Currently, there is no simple way for a system administrator to share files between containerized and non-containerized services (e.g., a containerized media server and a non-containerized web server). This PR adds two new booleans that enable read-only or read/write (plus create, rename, etc.) access by containers to files labeled as public_content_t or public_content_rw_t .

Summary by Sourcery

Document new SELinux booleans for allowing containers to access shared public content.

Documentation:

  • Describe how to enable read-only access for containers to files labeled as public_content_t and public_content_rw_t via the container_read_public_content boolean.
  • Describe how to enable read/write access for containers to files labeled as public_content_rw_t via the container_manage_public_content boolean.

@sourcery-ai
Copy link

sourcery-ai bot commented Dec 5, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds SELinux policy booleans and documentation to let container domains read or manage files labeled as public_content_t / public_content_rw_t, enabling shared content between containerized and non-containerized services while defaulting to secure behavior.

File-Level Changes

Change Details Files
Introduce SELinux booleans to control container access (read-only vs read-write) to shared public content types.
  • Define new booleans for container_read_public_content and container_manage_public_content in the container policy
  • Grant conditional allow rules for container domains to read public_content_t and public_content_rw_t when the read boolean is enabled
  • Grant conditional allow/manage rules (read, write, create, rename, etc.) for container domains on public_content_rw_t when the manage boolean is enabled
container.te
Document how to enable container access to shared public content via the new booleans.
  • Add a manpage section describing container_read_public_content for read-only access to public_content_t/public_content_rw_t
  • Add a manpage section describing container_manage_public_content for read/write management of public_content_rw_t
  • Include example setsebool commands in the manpage for both booleans
container_selinux.8

Possibly linked issues

  • #: The PR adds the exact SELinux booleans requested, enabling containers to access shared public_content/public_content_rw files.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gemini-code-assist
Copy link

Summary of Changes

Hello @ipilcher, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the flexibility of SELinux policies for containerized environments by providing system administrators with explicit control over how containers interact with shared public content. It introduces two new booleans that allow for either read-only or full read/write access to specifically labeled public files, thereby simplifying file sharing between containerized and non-containerized services.

Highlights

  • New SELinux Booleans: Introduced container_read_public_content and container_manage_public_content to control container access to shared public files.
  • Read-Only Access: The container_read_public_content boolean, when enabled, grants containers read-only access to files labeled public_content_t and public_content_rw_t.
  • Read/Write Access: The container_manage_public_content boolean, when enabled, allows containers to read, write, create, and rename files labeled public_content_rw_t.
  • Documentation Update: The container_selinux.8 man page has been updated to include detailed explanations and usage instructions for these new booleans.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • In the man page example for container_manage_public_content, set sebool has an extra space and should be setsebool to match the actual command and the earlier example.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the man page example for `container_manage_public_content`, `set sebool` has an extra space and should be `setsebool` to match the actual command and the earlier example.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces two new SELinux booleans, container_read_public_content and container_manage_public_content, to allow containers read-only or read-write access to shared public content. The changes in container.te correctly define and implement the policy for these booleans. The documentation in container_selinux.8 is also updated accordingly. My review found a minor typo in an example command in the man page, which I've suggested a fix for.

@packit-as-a-service
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@packit-as-a-service
Copy link

Tests failed. @containers/packit-build please check.

@ipilcher
Copy link
Author

ipilcher commented Dec 5, 2025

/packit retest-failed

Copy link
Member

@lsm5 lsm5 left a comment

Choose a reason for hiding this comment

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

LGTM.

@ipilcher would be nice to add a test as a shell / beakerlib script. Not a blocker for this PR.

@haircommander @rhatdan PTAL

@openshift-ci
Copy link

openshift-ci bot commented Dec 10, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ipilcher, lsm5, sourcery-ai[bot]

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@lsm5 lsm5 mentioned this pull request Dec 10, 2025
@ipilcher
Copy link
Author

@ipilcher would be nice to add a test as a shell / beakerlib script. Not a blocker for this PR.

Can you point me to some examples?

@lsm5
Copy link
Member

lsm5 commented Dec 10, 2025

Can you point me to some examples?

@ipilcher There's nothing in this repo itself. But in the testing-farm jobs in CI, we run this: https://github.com/containers/container-selinux/blob/main/test/podman-rootless-tests.sh (among others) which runs test files from podman, for example: https://github.com/containers/podman/blob/main/test/system/410-selinux.bats

Again, this could be an item for later. Just that I'm trying to improve CI test coverage for this repo. This PR could totally go in without it.

Add 2 new booleans to enable access:

* container_read_public_content allows read-only access to files
  labeled as public_content_t or public_content_rw_t.
* container_manage_public_content allows full read, write, create,
  etc., access to files labeled as public_content_rw_t.

Fixes containers#406

Signed-off-by: Ian Pilcher <arequipeno@gmail.com>
Add descriptions of the container_read_public_content and
container_manage_public_content booleans.

Signed-off-by: Ian Pilcher <arequipeno@gmail.com>
Signed-off-by: Ian Pilcher <arequipeno@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants