|
1 |
| -# LAUNCH sshHost |
2 |
| - |
3 |
| -FROM ubuntu@sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322 AS builder |
| 1 | +# LAUNCH ssh_host |
4 | 2 |
|
| 3 | +FROM ubuntu@sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322 AS builder_base |
5 | 4 |
|
6 | 5 | # Install challenge dependencies within the image
|
7 | 6 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
8 | 7 | python3
|
9 | 8 |
|
10 |
| - |
11 | 9 | # Create challenge dir for metadata.json and other file artifacts
|
12 |
| -RUN mkdir /challenge |
13 |
| - |
| 10 | +RUN mkdir /challenge && chmod 700 /challenge |
| 11 | +COPY config-builder.py /challenge/ |
14 | 12 |
|
15 |
| -# Bring in all environment vars from cmgr |
| 13 | +FROM builder_base as builder |
| 14 | +# Bring in cmgr args |
16 | 15 | ARG SEED
|
17 |
| -ARG FLAG_FORMAT |
18 | 16 | ARG FLAG
|
19 | 17 |
|
20 |
| - |
21 |
| -COPY config-builder.py /challenge/config-builder.py |
22 |
| - |
23 | 18 | RUN python3 /challenge/config-builder.py
|
24 | 19 |
|
25 |
| - |
26 |
| - |
27 | 20 | #######################
|
28 | 21 | #### Host: sshHost ####
|
29 | 22 | #######################
|
30 |
| -FROM ubuntu@sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322 AS sshHost |
31 |
| - |
| 23 | +FROM ubuntu@sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322 AS ssh_host_base |
32 | 24 |
|
33 | 25 | # Install challenge dependencies within the image
|
34 | 26 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
35 | 27 | openssh-server \
|
36 |
| - socat \ |
37 |
| - python3 |
| 28 | + python3 \ |
| 29 | + socat |
38 | 30 |
|
| 31 | +COPY config-sshhost.py /challenge/ |
| 32 | +COPY start.sh /opt/ |
| 33 | +COPY profile /home/ctf-player/.profile |
| 34 | +COPY instructions-to-2of3.txt /home/ctf-player/drop-in/ |
| 35 | +COPY instructions-to-3of3.txt / |
| 36 | +COPY --from=builder /challenge/1of3.flag.txt /home/ctf-player/drop-in/ |
| 37 | +COPY --from=builder /challenge/2of3.flag.txt / |
39 | 38 |
|
40 |
| -COPY --from=builder /challenge/password.txt /tmp/password.txt |
41 |
| -COPY config-sshhost.py /challenge/config-sshhost.py |
42 |
| -COPY start.sh /opt/start.sh |
| 39 | +FROM ssh_host_base AS ssh_host |
| 40 | +COPY --from=builder /challenge/password.txt /tmp/ |
43 | 41 |
|
44 |
| -RUN python3 /challenge/config-sshhost.py |
45 |
| -RUN rm -rf /challenge/ |
| 42 | +RUN python3 /challenge/config-sshhost.py && \ |
| 43 | + rm -rf /challenge/ |
46 | 44 |
|
47 |
| -COPY profile /home/ctf-player/.profile |
48 |
| -COPY instructions-to-2of3.txt /home/ctf-player/drop-in/instructions-to-2of3.txt |
49 |
| -COPY instructions-to-3of3.txt /instructions-to-3of3.txt |
50 |
| -COPY --from=builder /challenge/1of3.flag.txt /home/ctf-player/drop-in/1of3.flag.txt |
51 |
| -COPY --from=builder /challenge/2of3.flag.txt /2of3.flag.txt |
52 |
| -COPY --from=builder /challenge/3of3.flag.txt /home/ctf-player/3of3.flag.txt |
| 45 | +COPY --from=builder /challenge/3of3.flag.txt /home/ctf-player/ |
53 | 46 |
|
54 | 47 | EXPOSE 5555
|
55 | 48 | # PUBLISH 5555 AS ssh
|
|
0 commit comments