From dea5d7e6bd2e40fdc3c3285b642a2cd6e21b6d4b Mon Sep 17 00:00:00 2001 From: Dominic Feliton <127802411+dafeliton@users.noreply.github.com> Date: Sun, 13 Oct 2024 00:13:12 -0700 Subject: [PATCH] add loop for mapped execs --- images/rstudio-notebook/Dockerfile | 33 ++++++++++++------------------ 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/images/rstudio-notebook/Dockerfile b/images/rstudio-notebook/Dockerfile index 537fad4c..82205aa9 100644 --- a/images/rstudio-notebook/Dockerfile +++ b/images/rstudio-notebook/Dockerfile @@ -37,26 +37,19 @@ ENV PATH="${PATH}:/usr/lib/rstudio-server/bin" \ LD_LIBRARY_PATH="/opt/conda/lib:/usr/lib/x86_64-linux-gnu" ### OpenSSL Conda Workarounds -# ssh-keygen -RUN mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen.orig -RUN echo '#!/bin/bash' > /usr/bin/ssh-keygen && \ - echo 'export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu' >> /usr/bin/ssh-keygen && \ - echo 'exec /usr/bin/ssh-keygen.orig "$@"' >> /usr/bin/ssh-keygen && \ - chmod +x /usr/bin/ssh-keygen - -# git -RUN mv /usr/bin/git /usr/bin/git.orig -RUN echo '#!/bin/bash' > /usr/bin/git && \ - echo 'export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu' >> /usr/bin/git && \ - echo 'exec /usr/bin/git.orig "$@"' >> /usr/bin/git && \ - chmod +x /usr/bin/git - -# ssh -RUN mv /usr/bin/ssh /usr/bin/ssh.orig -RUN echo '#!/bin/bash' > /usr/bin/ssh && \ - echo 'export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu' >> /usr/bin/ssh && \ - echo 'exec /usr/bin/ssh.orig "$@"' >> /usr/bin/ssh && \ - chmod +x /usr/bin/ssh +# List of binaries you want to wrap +ENV FORCED_BINARIES="ssh ssh-add ssh-agent ssh-copy-id ssh-keygen ssh-keyscan sshd git" + +# Loop over each binary and apply the wrapper +RUN for bin in $FORCED_BINARIES; do \ + if [ -f /usr/bin/$bin ]; then \ + mv /usr/bin/$bin /usr/bin/$bin.orig && \ + echo '#!/bin/bash' > /usr/bin/$bin && \ + echo 'export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu' >> /usr/bin/$bin && \ + echo 'exec /usr/bin/'$bin'.orig "$@"' >> /usr/bin/$bin && \ + chmod +x /usr/bin/$bin; \ + fi; \ + done COPY ./lib /opt/k8s-support/lib