fix: close server bypass edge cases
This commit is contained in:
@@ -7,12 +7,15 @@ image='golang:1.26.5-bookworm@sha256:1ecb7edf62a0408027bd5729dfd6b1b8766e578e8df
|
||||
|
||||
docker run --rm --volume "$root:/repository:ro" "$image" /bin/bash -ceu '
|
||||
groupadd --gid 10001 thothii
|
||||
useradd --uid 10001 --gid 10001 --no-create-home --shell /usr/sbin/nologin thothii
|
||||
useradd --uid 10001 --gid 10001 --home-dir /srv/thothii --create-home --shell /usr/sbin/nologin thothii
|
||||
# Reproduce the conservative home mode permitted by the documented useradd sequence.
|
||||
chmod 0700 /srv/thothii
|
||||
groupadd --gid 20001 operator-primary
|
||||
groupadd --gid 20002 thothii-ops
|
||||
groupadd --gid 20003 docker
|
||||
useradd --uid 20001 --gid 20001 --groups 20002,20003 --create-home --shell /bin/bash operator
|
||||
|
||||
install -d -o 10001 -g 20002 -m 2750 /srv/thothii
|
||||
install -d -o 10001 -g 20002 -m 2750 /srv/thothii/source
|
||||
install -d -o 10001 -g 20002 -m 2770 /srv/thothii/operator
|
||||
install -d -o 10001 -g 20002 -m 2750 /srv/thothii/secrets
|
||||
@@ -52,8 +55,10 @@ sed -i "s#replace-me#/srv/thothii/source/ThothII#" /srv/thothii/operator/thothii
|
||||
--output /srv/thothii/operator/connector-secrets.server.yaml
|
||||
test -r /srv/thothii/secrets/dwh-password
|
||||
if (printf tamper >> /srv/thothii/secrets/dwh-password) 2>/dev/null; then exit 41; fi
|
||||
if touch /srv/thothii/source/operator-must-not-write 2>/dev/null; then exit 42; fi
|
||||
if touch /srv/thothii/data/operator-must-not-write 2>/dev/null; then exit 43; fi
|
||||
for protected in /srv/thothii /srv/thothii/source /srv/thothii/secrets \
|
||||
/srv/thothii/data /srv/thothii/pi-state /srv/thothii/workspace-registry; do
|
||||
if touch "$protected/operator-must-not-write" 2>/dev/null; then exit 42; fi
|
||||
done
|
||||
THT_THOTHCTL_OUTPUT_DIRECTORY=/srv/thothii/operator/build-output \
|
||||
/srv/thothii/source/ThothII/scripts/build-thothctl.sh
|
||||
if THT_THOTHCTL_OUTPUT_DIRECTORY=relative-output \
|
||||
@@ -70,11 +75,15 @@ rm -f "$root_output_error"
|
||||
|
||||
test "$(stat -c %u:%g /srv/thothii/operator/connector-secrets.server.yaml)" = 20001:20002
|
||||
test "$(stat -c %a /srv/thothii/operator/connector-secrets.server.yaml)" = 660
|
||||
test "$(stat -c %u:%g /srv/thothii)" = 10001:20002
|
||||
test "$(stat -c %a /srv/thothii)" = 2750
|
||||
test "$(stat -c %u:%g /srv/thothii/operator/build-output/thothctl-linux-amd64)" = 20001:20002
|
||||
test "$(stat -c %a /srv/thothii/operator/build-output/thothctl-linux-amd64)" = 750
|
||||
test -f /srv/thothii/operator/start.marker
|
||||
test ! -e /srv/thothii/source/operator-must-not-write
|
||||
test ! -e /srv/thothii/data/operator-must-not-write
|
||||
for protected in /srv/thothii /srv/thothii/source /srv/thothii/secrets \
|
||||
/srv/thothii/data /srv/thothii/pi-state /srv/thothii/workspace-registry; do
|
||||
test ! -e "$protected/operator-must-not-write"
|
||||
done
|
||||
test "$(cat /srv/thothii/secrets/dwh-password)" = operator-readable-secret
|
||||
'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user