spiegel_podman/pkg
Chris Evich c32edd121d
Only prevent VTs to be mounted inside privileged systemd containers
While mounting virtual console devices in a systemd container is a
recipe for disaster (I experienced it first hand), mounting serial
console devices, modems, and others should still be done by default
for privileged systemd-based containers.

v2, addressing the review from @fho:
 - use backticks in the regular expression to remove backslashes
 - pre-compile the regex at the package level
 - drop IsVirtualTerminalDevice (not needed for a one-liner)

v3, addressing the review from @fho and @rhatdan:
 - re-introduce a private function for matching the device names
 - use path.Match rather than a regex not to slow down startup time

Closes #16925.

Fixes: 5a2405ae1b ("Don't mount /dev/tty* inside privileged...")

Cherry-picked from f4c81b0aa5 with
conflict resolution (accept incoming test updates) and additional
systemdMode handling for rootless: only skip /dev/ptmx, /dev/tty,
and virtual consoles (tty0, tty1, ...); pass non-vt TTYs (ttyS0,
ttyACM0, etc.) through to privileged rootless containers.

AI-Attribution: Created/Modified with the assistance of AI: Cursor <Auto>

Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Signed-off-by: Chris Evich <cevich@redhat.com>
Made-with: Cursor
2026-03-30 15:13:41 -04:00
..
annotations fix a number of godot issues 2022-03-22 13:04:35 +01:00
api Add sha256: to images history id for docker compatibility 2026-03-30 15:13:38 -04:00
auth pkg: switch to golang native error wrapping 2022-07-08 08:54:47 +02:00
autoupdate Add build-tagged splits for libimage-dependent code 2026-03-30 15:13:31 -04:00
bindings tests: fix "Storing signatures" check 2026-03-30 15:13:33 -04:00
channel pkg: switch to golang native error wrapping 2022-07-08 08:54:47 +02:00
checkpoint Add build-tagged splits for libimage-dependent code 2026-03-30 15:13:31 -04:00
copy pkg: switch to golang native error wrapping 2022-07-08 08:54:47 +02:00
criu Fix protobuf registration conflict by removing go-criu/v5 dependency 2026-03-30 15:13:31 -04:00
ctime golangci-lint: enable nolintlint 2022-06-14 16:29:42 +02:00
domain Add build-tagged splits for libimage-dependent code 2026-03-30 15:13:31 -04:00
env pkg: switch to golang native error wrapping 2022-07-08 08:54:47 +02:00
errorhandling libpod/runtime: switch to golang native error wrapping 2022-07-04 15:39:00 +02:00
inspect pkg/inspect: remove unused ImageResult type 2022-05-24 16:07:39 +02:00
k8s.io Fix spelling "read only" -> "read-only" 2022-07-02 08:37:43 +02:00
lookup enable gocritic linter 2022-04-26 18:12:22 +02:00
machine check memory test based on range 2022-08-10 16:46:05 -04:00
namespaces Fix spelling "setup" -> "set up" and similar 2022-06-22 18:39:21 +02:00
parallel pkg: switch to golang native error wrapping 2022-07-08 08:54:47 +02:00
ps libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
rootless Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
rootlessport go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
seccomp pkg: switch to golang native error wrapping 2022-07-08 08:54:47 +02:00
selinux Fix SELinux functions names to not be repetitive 2020-04-23 15:57:34 -04:00
servicereaper go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
signal Implement CatchAll and StopCatch in signal_common.go 2022-06-27 13:27:12 +01:00
specgen Use default_ulimits field in containers.conf 2026-03-30 15:13:37 -04:00
specgenutil Use default_ulimits field in containers.conf 2026-03-30 15:13:37 -04:00
systemd podman generate systemd --new: allow -h hostname 2022-08-10 16:46:05 -04:00
terminal move golang.org/x/crypto/ssh/terminal to golang.org/x/term 2022-04-22 12:40:52 +02:00
timetype enable gocritic linter 2022-04-26 18:12:22 +02:00
trust Preserve all unknown PolicyRequirement fields on (podman image trust set) 2022-10-25 23:31:38 +02:00
util Only prevent VTs to be mounted inside privileged systemd containers 2026-03-30 15:13:41 -04:00