Skip to content

Commit

Permalink
Don't stow .viminfo
Browse files Browse the repository at this point in the history
The .viminfo cannot be a symbolic link for security reasons.
Thus it is ignored by stow and manually copied from /home/tooling/ to /home/user/ instead.

Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
  • Loading branch information
AObuchow committed Oct 13, 2023
1 parent 7225e21 commit a9669fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions base/ubi8/.stow-local-ignore
@@ -0,0 +1,2 @@
# .viminfo cannot be a symlink for security reasons
\.viminfo
5 changes: 4 additions & 1 deletion base/ubi8/Dockerfile
Expand Up @@ -92,6 +92,7 @@ RUN \
rm -rf "${TEMP_DIR}"

COPY --chown=0:0 entrypoint.sh /
COPY --chown=0:0 .stow-local-ignore /home/tooling/
RUN \
# add user and configure it
useradd -u 10001 -G wheel,root -d /home/user --shell /bin/bash -m user && \
Expand All @@ -110,7 +111,9 @@ RUN \
chmod -R g=u /etc/passwd /etc/group /home && \
chmod +x /entrypoint.sh && \
# Create symbolic links from /home/tooling/ -> /home/user/
stow . -t /home/user/ -d /home/tooling/ --no-folding
stow . -t /home/user/ -d /home/tooling/ --no-folding && \
# .viminfo cannot be a symbolic link for security reasons, so copy it to /home/user/
cp /home/tooling/.viminfo /home/user/.viminfo

USER 10001
ENV HOME=/home/user
Expand Down
2 changes: 2 additions & 0 deletions universal/ubi8/entrypoint.sh
Expand Up @@ -4,6 +4,8 @@
if mountpoint -q /home/user/; then
# Create symbolic links from /home/tooling/ -> /home/user/
stow . -t /home/user/ -d /home/tooling/ --no-folding
# A symbolic link for .viminfo is not created for security reasons, so manually copy it
cp /home/tooling/.viminfo /home/user/.viminfo
fi

# Kubedock
Expand Down

0 comments on commit a9669fa

Please sign in to comment.