-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
28 lines (23 loc) · 703 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM python:3
ARG directory=/in_prod_this_is_random
# dependencies
RUN apt-get update
RUN apt-get upgrade -y
RUN rm -rf /var/lib/apt/lists/*
RUN pip3 install flask PyJWT
# setup unpriv user
RUN mkdir ${directory}
RUN useradd -M -d ${directory} ctf
# copy files
COPY server.py ${directory}/server.py
COPY flag.txt ${directory}/flag.txt
RUN mkdir -p ${directory}/files
RUN for i in {1..5}; do (echo $(cat /dev/urandom | tr -dc a-f0-9 | fold -w32 | head -n1) > ${directory}/files/$(cat /dev/urandom | tr -dc a-f0-9 | fold -w32 | head -n1)); done
# file perms
RUN chown -R root:ctf ${directory}
RUN chmod -R 750 ${directory}
# run
USER ctf
WORKDIR ${directory}
CMD ["python3", "server.py"]
EXPOSE 1337