12 Commits

Author SHA1 Message Date
Noel Georgi
ea5de19fad
fix: selinux detection
Fix SELinux detection.

Fixes: #10965

Signed-off-by: Noel Georgi <git@frezbo.dev>
2025-05-14 20:35:21 +05:30
Dmitrii Sharshakov
c1bec3cd0d
test: add negative tests for SELinux
Make sure a privileged pod cannot violate some of the important security rules enforced by SELinux.

Fixes #10615

Signed-off-by: Dmitrii Sharshakov <dmitry.sharshakov@siderolabs.com>
2025-04-11 14:15:20 +02:00
Andrey Smirnov
203e02df49
refactor: implement directory and overlay mounts
This complements the previous PRs to implement more volume features:
directory volumes control their permissions, SELinux labels, etc.

Overlay mounts support additional parent relationship.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
2025-04-01 20:51:02 +04:00
Dmitrii Sharshakov
087a85f409
feat: support running with SELinux enforcing
Add more rules alongside supporting code.

Signed-off-by: Dmitrii Sharshakov <dmitry.sharshakov@siderolabs.com>
2025-03-22 14:39:48 +01:00
Dmitry Sharshakov
cd66fc6e8e
feat: use bootstrapped packages for building Talos
Update tools, pkgs and extras to use fully bootstrapped [Stageˣ]-derived toolchain for building Talos and its dependencies.

This brings in changes related to root being usrmerged now, so some paths have changed. Extras have been cleaned up: use only the needed package.

Addresses: #10187

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
2025-02-10 13:00:36 +04:00
Dmitry Sharshakov
a13f82c594
feat: udev: label device nodes
Use udev rules to assign basic device file labels based on their subsystem

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
2024-11-22 12:42:22 +01:00
Dmitry Sharshakov
e899fb37fd
feat: label created files in /etc
Implement SELinux labeling support in EtcFileController, label both squashfs and runtime-created files in /etc and /system/etc.

Add corresponding test cases.

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
2024-11-22 09:16:13 +01:00
Dmitry Sharshakov
1a8cc5f8b2
feat: add SELinux labels to volumes
Label mounted filesystems like ephemeral, overlay mounts, as well as data directories (going to become volumes later).

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
2024-11-21 14:23:43 +01:00
Dmitry Sharshakov
4caeae21e5
refactor: optimize flags and SetLabel
Do not do string lookups in repetitive calls. We do not support changing SELinux status during runtime, so once we read this we can assume status does not change.

Also avoid unneeded FS writes when appropriate label is already set on file.

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
2024-11-21 08:25:49 +01:00
Dmitry Sharshakov
d55a96e8cb
refactor: remove SELinux client_u and client_r
I added those in the early days of the current policy development, yet there was no use for them. This change simplifies the policy and handling of labels.

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
2024-11-18 16:17:03 +01:00
Dmitry Sharshakov
a867f85e4c
feat: label system socket and runtime files
Set SELinux labels so that services could gain access permissions.

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
2024-11-06 07:29:35 +01:00
Dmitry Sharshakov
960a040491
feat: start enabling SELinux
Part of: #9127

Label executables and processes, build, load and manage SELinux policy, enable audit support.

Labeling filesystems, devices and runtime files will be done in further changes, see the full PR.

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
2024-11-04 16:56:53 +01:00