2021-06-13 22:53:53 +00:00
|
|
|
FROM debian:buster
|
|
|
|
|
|
|
|
ARG USERNAME
|
|
|
|
ARG HOST_IP
|
|
|
|
ARG SLBR_PORT
|
|
|
|
ARG INFO_PORT
|
|
|
|
ARG LOG_PORT
|
|
|
|
ARG SSHD_PORT
|
|
|
|
|
|
|
|
RUN (test -n "$USERNAME" || (echo "USERNAME not set" && false)) \
|
|
|
|
&& (test -n "$SLBR_PORT" || (echo "SLBR_PORT not set" && false)) \
|
|
|
|
&& (test -n "$INFO_PORT" || (echo "INFO_PORT not set" && false)) \
|
|
|
|
&& (test -n "$LOG_PORT" || (echo "LOG_PORT not set" && false)) \
|
|
|
|
&& (test -n "$HOST_IP" || (echo "HOST_IP not set" && false))
|
|
|
|
|
|
|
|
COPY --chown=root ./suicidebash.bashrc /etc/bash.bashrc
|
|
|
|
COPY --chown=root ./slbr.env /etc
|
|
|
|
COPY --chown=root ./package.list /package.list
|
|
|
|
COPY --chown=root ./insults.txt /insults.txt
|
|
|
|
|
2021-11-16 18:11:29 +00:00
|
|
|
COPY ./bin/scores /usr/local/bin/
|
2021-06-13 22:53:53 +00:00
|
|
|
COPY ./bin/submit /usr/local/bin/
|
|
|
|
COPY ./banner /etc/motd
|
|
|
|
COPY ./pubkey /pubkey
|
|
|
|
|
|
|
|
RUN apt remove bash-completion \
|
|
|
|
&& rm -rf /usr/share/bash-completion
|
|
|
|
|
|
|
|
RUN apt update \
|
|
|
|
&& apt install -y $(cat /package.list) \
|
2021-11-16 18:11:29 +00:00
|
|
|
&& apt -y remove nano \
|
|
|
|
&& rm /package.list \
|
|
|
|
&& rm /bin/grep \
|
|
|
|
&& rm /bin/tar
|
|
|
|
|
|
|
|
RUN sed -i "s/{{ HOST_IP }}/$HOST_IP/g" /etc/bash.bashrc /usr/local/bin/scores /usr/local/bin/submit \
|
|
|
|
&& sed -i "s/{{ SLBR_PORT }}/$SLBR_PORT/g" /etc/bash.bashrc /usr/local/bin/scores /usr/local/bin/submit \
|
|
|
|
&& sed -i "s/{{ INFO_PORT }}/$INFO_PORT/g" /etc/bash.bashrc /usr/local/bin/scores /usr/local/bin/submit \
|
|
|
|
&& sed -i "s/{{ LOG_PORT }}/$LOG_PORT/g" /etc/bash.bashrc /usr/local/bin/scores /usr/local/bin/submit \
|
2021-06-13 22:53:53 +00:00
|
|
|
&& mkdir /home/$USERNAME \
|
|
|
|
&& mkdir /run/sshd \
|
|
|
|
&& mkdir /home/$USERNAME/.ssh \
|
|
|
|
&& cat /pubkey > /home/$USERNAME/.ssh/authorized_keys \
|
|
|
|
&& rm /pubkey \
|
|
|
|
&& echo "PasswordAuthentication no" >> /etc/ssh/sshd_config \
|
|
|
|
&& echo "Port $SSHD_PORT" >> /etc/ssh/sshd_config
|
|
|
|
|
2021-11-16 18:11:29 +00:00
|
|
|
COPY ./inhere /home/$USERNAME/inhere
|
2021-06-13 22:53:53 +00:00
|
|
|
COPY ./rules.md /home/$USERNAME
|
|
|
|
|
|
|
|
RUN useradd $USERNAME -d /home/$USERNAME \
|
|
|
|
&& chown -R $USERNAME:$USERNAME /home/$USERNAME \
|
|
|
|
&& chmod -R +x /usr/local/bin/ \
|
|
|
|
&& chsh $USERNAME -s /bin/bash
|
|
|
|
|
|
|
|
#USER $USERNAME
|
|
|
|
|
|
|
|
CMD ["/usr/sbin/sshd", "-D"]
|