Files
security-command.org/sandbox/Dockerfile
T

33 lines
1.3 KiB
Docker

FROM debian:trixie-slim
ENV LANG=C.UTF-8
# Slim images exclude man pages through a dpkg path filter. Removing it and
# reinstalling the preinstalled essentials restores their man pages.
RUN rm -f /etc/dpkg/dpkg.cfg.d/docker \
&& apt-get update \
&& apt-get install -y --no-install-recommends --reinstall \
bash coreutils findutils grep sed \
&& apt-get install -y --no-install-recommends \
gawk less tree file vim-tiny nano man-db manpages jq procps htop \
figlet cowsay fortune-mod fortunes-min sl curl wget \
&& rm -rf /var/lib/apt/lists/*
# The content directory is mounted read only as the home directory, so all
# shell configuration lives in /etc.
# Setuid binaries are useless under no-new-privileges, so they are stripped
# to keep the attack surface minimal even if that option is ever dropped.
RUN useradd --uid 1000 --no-create-home --home-dir /home/agent --shell /bin/bash agent \
&& mkdir /home/agent \
&& find / -xdev -perm /6000 -type f -exec chmod a-s {} +
COPY etc/ /etc/
COPY --chmod=0755 bin/ /usr/local/bin/
ENV PATH=/usr/local/bin:/usr/bin:/bin:/usr/games
USER agent
WORKDIR /home/agent
# Debian's bash always reads /etc/bash.bashrc. Startup files in the home
# directory belong to the content, so an empty file replaces ~/.bashrc.
CMD ["/bin/bash", "--rcfile", "/dev/null", "-i"]