docker compose bugfix
This commit is contained in:
@@ -4,7 +4,7 @@ FROM ubuntu:24.04
|
||||
# Build-time args
|
||||
ARG PASSWORD=root
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
WORKDIR /home/ctf/chall
|
||||
WORKDIR /home/ctfuser/chall
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
@@ -18,15 +18,15 @@ RUN apt-get update && \
|
||||
vim \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN useradd -m -d /home/ctf -s /bin/bash ctf && echo "ctf:${PASSWORD}" | chpasswd
|
||||
RUN useradd -m -d /home/ctfuser -s /bin/bash ctfuser && echo "ctfuser:${PASSWORD}" | chpasswd
|
||||
|
||||
RUN mkdir -p /var/run/sshd
|
||||
|
||||
COPY chall/ /home/ctf/chall
|
||||
COPY chall/ /home/ctfuser/chall
|
||||
COPY ./entrypoint.sh /entrypoint.sh
|
||||
|
||||
RUN chmod +x /entrypoint.sh /home/ctf/chall/run.sh && \
|
||||
chown -R root:root /home/ctf/chall && chmod -R 555 /home/ctf/chall
|
||||
RUN chmod +x /entrypoint.sh /home/ctfuser/chall/run.sh && \
|
||||
chown -R root:root /home/ctfuser/chall && chmod -R 555 /home/ctfuser/chall
|
||||
|
||||
EXPOSE 9000 22
|
||||
CMD ["/entrypoint.sh"]
|
||||
@@ -11,7 +11,7 @@ grep -q "^PasswordAuthentication" /etc/ssh/sshd_config && \
|
||||
sed -i "s/^PasswordAuthentication.*/PasswordAuthentication yes/" /etc/ssh/sshd_config || \
|
||||
echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
|
||||
|
||||
echo "AllowUsers ctf" >> /etc/ssh/sshd_config
|
||||
echo "AllowUsers ctfuser" >> /etc/ssh/sshd_config
|
||||
|
||||
/usr/sbin/sshd
|
||||
|
||||
@@ -21,4 +21,4 @@ if [ -n "$FLAG" ]; then
|
||||
chown root:root /flag.txt
|
||||
fi
|
||||
|
||||
exec su -c "cd /home/ctf/chall && ./run.sh" -s /bin/bash ctf
|
||||
exec su -c "cd /home/ctfuser/chall && ./run.sh" -s /bin/bash ctfuser
|
||||
Reference in New Issue
Block a user