Initial sandbox infrastructure setup.
This commit is contained in:
1 parent
6ac68a7025
commit
0737b28897
10 files changed
+262
No files matched your search
@@ -0,0 +1,27 @@
|
||||
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/*
|
||||
|
||||
# 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 --create-home --shell /bin/bash guest \
|
||||
&& find / -xdev -perm /6000 -type f -exec chmod a-s {} +
|
||||
|
||||
COPY etc/ /etc/
|
||||
COPY --chmod=0755 bin/status /usr/local/bin/status
|
||||
|
||||
ENV PATH=/usr/local/bin:/usr/bin:/bin:/usr/games
|
||||
USER guest
|
||||
WORKDIR /home/guest
|
||||
CMD ["/bin/bash", "-l"]
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -r /var/status/status ]; then
|
||||
cat /var/status/status
|
||||
else
|
||||
echo "server status unavailable"
|
||||
fi
|
||||
|
||||
[ -n "$SESSION_ID" ] && echo "session ${SESSION_ID}"
|
||||
|
||||
if [ -n "$SESSION_EXPIRES_AT" ]; then
|
||||
remaining=$((SESSION_EXPIRES_AT - $(date +%s)))
|
||||
[ "$remaining" -lt 0 ] && remaining=0
|
||||
printf 'expires in %d:%02d\n' $((remaining / 60)) $((remaining % 60))
|
||||
fi
|
||||
@@ -0,0 +1,11 @@
|
||||
[ -z "$PS1" ] && return
|
||||
|
||||
shopt -s checkwinsize histappend
|
||||
HISTSIZE=1000
|
||||
HISTCONTROL=ignoredups
|
||||
|
||||
PS1='\[\e[1;32m\]guest@security-command\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ '
|
||||
|
||||
alias ls='ls --color=auto'
|
||||
alias ll='ls -lah --color=auto'
|
||||
alias grep='grep --color=auto'
|
||||
@@ -0,0 +1,5 @@
|
||||
if [ -r /srv/www/motd ]; then
|
||||
cat /srv/www/motd
|
||||
else
|
||||
printf '%s\n' "Welcome. The content lives in /srv/www, and 'status' shows your session."
|
||||
fi
|
||||
Reference in new issue
Block a user