Files
ctf/2026/cscg/misc/one-bit/Dockerfile
2026-04-10 03:31:12 +02:00

30 lines
1.2 KiB
Docker

# syntax=docker/dockerfile:1
FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update --fix-missing && apt-get install -y openssh-server qemu-system git wget cpio curl sudo
RUN mkdir /var/run/sshd
#password for user login
RUN sed -i 's/#Port 22/Port 3000/' /etc/ssh/sshd_config \
&& sed -i 's/#PermitEmptyPasswords no/PermitEmptyPasswords yes/' /etc/ssh/sshd_config \
&& printf "\n\nAuthenticationMethods none\n" >> /etc/ssh/sshd_config
RUN groupadd --system ctf --gid 1000 \
&& useradd --uid 1000 --system --gid ctf --home-dir /home/ctf --create-home --comment "CTF image user" -s /bin/bash ctf \
&& chown -R ctf:ctf /home/ctf \
&& passwd -d ctf && mkdir -p /chall/initfs
WORKDIR /chall
COPY initfs/ ./initfs
RUN git clone --recurse-submodules -j8 https://github.com/MyEyes/basic_linux_env && cd basic_linux_env && ./build.sh && mkdir host
COPY adjust_initramfs.sh run.sh ./
COPY run_qemu.sh ./basic_linux_env
RUN ./adjust_initramfs.sh && chmod -R go-rwx basic_linux_env/* && chmod -R go+rwx basic_linux_env/host && rm -rf initfs
COPY sudoers /etc/sudoers
COPY bzImage ./basic_linux_env
EXPOSE 3000
# Start SSH server
CMD ["/usr/sbin/sshd", "-D"]