From 411dc9b0851dd3017e60c0a29b87e5de31300107 Mon Sep 17 00:00:00 2001 From: Nuru Date: Thu, 11 Jan 2024 21:46:05 -0800 Subject: [PATCH] Make bindfs mapping bidirectional, remove host USER name from env (#901) --- .github/workflows/label.yml | 2 +- os/debian/Dockerfile.debian | 2 +- rootfs/etc/profile.d/_20-localhost.sh | 2 +- rootfs/etc/profile.d/user.sh | 8 -------- rootfs/templates/wrapper | 1 - 5 files changed, 3 insertions(+), 12 deletions(-) delete mode 100755 rootfs/etc/profile.d/user.sh diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 251a28ccf..8c90f6f64 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -1,5 +1,5 @@ name: Labeler -on: [pull_request] +on: [pull_request_target] jobs: label: diff --git a/os/debian/Dockerfile.debian b/os/debian/Dockerfile.debian index 7c9603e36..6c28e9569 100644 --- a/os/debian/Dockerfile.debian +++ b/os/debian/Dockerfile.debian @@ -55,7 +55,7 @@ RUN python3 -m pip install --upgrade --progress-bar off pip setuptools wheel && pip install --progress-bar off -r /requirements.txt --prefix=/usr/local --no-build-isolation # Remove Python cache files -RUN find / -name __pycache__ -exec rm -rf {} \; -prune +RUN find / -xdev -name __pycache__ -exec rm -rf {} \; -prune # # Geodesic base image diff --git a/rootfs/etc/profile.d/_20-localhost.sh b/rootfs/etc/profile.d/_20-localhost.sh index 2a72f4905..4b48045f6 100644 --- a/rootfs/etc/profile.d/_20-localhost.sh +++ b/rootfs/etc/profile.d/_20-localhost.sh @@ -15,7 +15,7 @@ if [[ $SHLVL == 1 ]] && [[ -n $GEODESIC_HOST_UID ]] && [[ -n $GEODESIC_HOST_GID red "# * Verify that content under /localhost is what you expect." red "# * Report the issue at https://github.com/cloudposse/geodesic/issues" red "# * Include the output of \`env | grep GEODESIC\` and \`df -a\` in your issue description." - elif bindfs -o nonempty ${GEODESIC_BINDFS_OPTIONS} --create-for-user="$GEODESIC_HOST_UID" --create-for-group="$GEODESIC_HOST_GID" "${GEODESIC_LOCALHOST}" /localhost; then + elif bindfs -o nonempty ${GEODESIC_BINDFS_OPTIONS} "--map=${GEODESIC_HOST_UID}/0:@${GEODESIC_HOST_GID}/@0" "${GEODESIC_LOCALHOST}" /localhost; then green "# BindFS mapping of ${GEODESIC_LOCALHOST} to /localhost enabled." green "# Files created under /localhost will have UID:GID ${GEODESIC_HOST_UID}:${GEODESIC_HOST_GID} on host." export GEODESIC_LOCALHOST_MAPPED_DEVICE="${GEODESIC_LOCALHOST}" diff --git a/rootfs/etc/profile.d/user.sh b/rootfs/etc/profile.d/user.sh deleted file mode 100755 index bc28a569c..000000000 --- a/rootfs/etc/profile.d/user.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -id "${USER}" &>/dev/null -if [[ "$?" -ne 0 ]]; then - if [[ -n "${USER_ID}" ]] && [[ -n "${GROUP_ID}" ]]; then - adduser -D -u ${USER_ID} -g ${GROUP_ID} -h ${HOME} ${USER} &>/dev/null - fi -fi diff --git a/rootfs/templates/wrapper b/rootfs/templates/wrapper index 993507dcb..bee68d8f1 100755 --- a/rootfs/templates/wrapper +++ b/rootfs/templates/wrapper @@ -66,7 +66,6 @@ function use() { --env SSH_CLIENT --env SSH_CONNECTION --env SSH_TTY - --env USER --env USER_ID --env GROUP_ID) elif [ "${OS}" == 'Darwin' ] && [ "${GEODESIC_MAC_FORWARD_SOCKET}" == 'true' ]; then