mrrl-containers

MRRL version of container scripts
git clone https://ccx.te2000.cz/git/mrrl-containers
Log | Files | Refs

commit 58beb5e4ad093dbcf5ac63cc6c4031eb11dad9fe
parent efba15354b8c747b793d207d5f7ff9ffb3a8ee83
Author: Jan Pobrislo <ccx@te2000.cz>
Date:   Wed,  5 Aug 2026 21:43:41 +0000

Run user setup before pivot_root but after prepare_chroot

Diffstat:
Mservice_scripts/generic/run | 34+++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/service_scripts/generic/run b/service_scripts/generic/run @@ -50,28 +50,32 @@ unshare -m -u -i # new mount, UTS and IPC namespaces $PID1_EXEC -foreground { printf "Seccomp profile to be used:" } -foreground { - ls -lhA ./mnt/ns/bin/seccomp-${CONTAINER_SECCOMP_PROFILE}.bpf -} - emptyenv -c ns_run_unshared data/root { # pre pivot-root commands - if { mount -o bind,ro /etc/passwd ./etc/passwd } - if { mount -o bind,ro /etc/group ./etc/group } - $PREPARE_CHROOT -} + if { s6-mount -o bind,ro,nodev,nosuid /etc/passwd ./etc/passwd } + if { s6-mount -o remount,bind,ro,nodev,nosuid _ ./etc/passwd } -# Run user's setup script (optional) -if { - ifelse { test -x ${CONTAINER_USER_HOME}/container-setup } { - env HOME=${CONTAINER_USER_HOME} USER=${CONTAINER_USER} - applyuidgid-caps -U "" - ${CONTAINER_USER_HOME}/container-setup ${CONTAINER_TMPFS} ${CONTAINER_NAME} + if { s6-mount -o bind,ro,nodev,nosuid /etc/group ./etc/group } + if { s6-mount -o remount,bind,ro,nodev,nosuid _ ./etc/group } + + if { $PREPARE_CHROOT } + # Run user's setup script (optional) + if { + ifelse { test -x ${CONTAINER_USER_HOME}/container-setup } { + env HOME=${CONTAINER_USER_HOME} USER=${CONTAINER_USER} + applyuidgid-caps -U "" + ${CONTAINER_USER_HOME}/container-setup ${CONTAINER_TMPFS} ${CONTAINER_NAME} + } + } + + foreground { printf "Seccomp profile to be used:" } + foreground { + ls -lhA ./mnt/ns/bin/seccomp-${CONTAINER_SECCOMP_PROFILE}.bpf } } + # This runs with changed / so use absolute paths before dropping privs /mnt/ns/bin/applyuidgid-caps -U $CONTAINER_CAPS /mnt/ns/bin/seccomp-run /mnt/ns/bin/seccomp-${CONTAINER_SECCOMP_PROFILE}.bpf