Skip to content

build_library: set correct SELinux contexts in final images#368

Closed
tormath1 wants to merge 1 commit intomainfrom
tormath1/selinux
Closed

build_library: set correct SELinux contexts in final images#368
tormath1 wants to merge 1 commit intomainfrom
tormath1/selinux

Conversation

@tormath1
Copy link
Copy Markdown
Contributor

@tormath1 tormath1 commented Jul 7, 2022

build_packages: use setfiles to label the system

setfiles can be used to directly set the SELinux labels on a root filesystem based on the values in file_contexts.


$ tar --selinux --xattrs -xf $(readlink -f docker\:20.10.torcx.tgz)
$ find -context "*unlabeled*"
$

build_packages Outdated
# build and label the system before generating torcx image.
info "Label the build root"
sudo chroot "${BOARD_ROOT}" bash -c "cd /usr/share/selinux/mcs && semodule -s mcs -i *.pp"
sudo setfiles -Dv -r "${BOARD_ROOT}" "${BOARD_ROOT}"/etc/selinux/mcs/contexts/files/file_contexts "${BOARD_ROOT}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

setfiles is a cool idea, but doing it in build_packages is not useful, because the images are not built from the files in BOARD_ROOT. This would have to happen somewhere in build_image and in build_torcx_store.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@tormath1 tormath1 force-pushed the tormath1/selinux branch 2 times, most recently from b7d9a63 to 42ff444 Compare August 18, 2022 11:50
@tormath1 tormath1 force-pushed the tormath1/selinux branch 7 times, most recently from 5134d91 to b510a48 Compare November 4, 2022 09:14
@tormath1 tormath1 force-pushed the tormath1/selinux branch 3 times, most recently from 174c2a9 to 1b9c992 Compare November 14, 2022 15:57
@tormath1 tormath1 force-pushed the tormath1/selinux branch 3 times, most recently from 0eb84a0 to d7e8a99 Compare November 24, 2022 11:53
`setfiles` can be used to directly set the SELinux labels on a root
filesystem based on the values in `file_contexts`.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
@tormath1
Copy link
Copy Markdown
Contributor Author

tormath1 commented Feb 28, 2023

Closed in favor of #666 (:imp:)

@tormath1 tormath1 closed this Feb 28, 2023
@pothos
Copy link
Copy Markdown
Member

pothos commented Mar 1, 2023

Closed in favor of #666 (imp)

Can you rather rebase? My PR only did the labeling for /etc which was what I needed to prevent overlay upcopies but most of your PR is still relevant, to fix any /usr labels and also produce correct torcx labels.

t-lo pushed a commit that referenced this pull request Apr 17, 2023
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.

3 participants