seccon22-txtchecker

Seccon 2022 Qualifier Challenge 'Txtchecker'
git clone https://git.sinitax.com/sinitax/seccon22-txtchecker
Log | Files | Refs | sfeed.txt

Dockerfile (647B)


      1FROM ubuntu:jammy
      2
      3RUN apt-get update && apt-get -y install openssh-server file procps
      4
      5WORKDIR /app
      6
      7RUN groupadd -r ctf && useradd -m -r -g ctf ctf
      8RUN echo "ctf:ctf" | chpasswd
      9
     10RUN echo 'ForceCommand "/app/checker.sh"' >> /etc/ssh/sshd_config
     11RUN echo 'Port 2022' >> /etc/ssh/sshd_config
     12RUN mkdir /var/run/sshd
     13
     14COPY flag.txt /
     15COPY checker.sh /app/
     16
     17RUN chmod 444 /flag.txt
     18RUN chmod 555 /app/checker.sh
     19
     20CMD while true; do \
     21        # kill long running processes for ssh
     22        ps -eo comm,pid,etimes | awk '/^checker.sh/ {if ($3 > 10) { print $2 }}' | xargs --no-run-if-empty kill -9; \
     23        sleep 5s; \
     24    done & \
     25    /sbin/sshd -D