2021-02-01 12:28:31 -08:00
|
|
|
FROM ubuntu:bionic
|
|
|
|
|
|
|
|
|
|
WORKDIR /root
|
|
|
|
|
COPY . .
|
|
|
|
|
RUN chmod +x *.sh
|
|
|
|
|
|
2024-10-04 14:35:21 -07:00
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
|
build-essential iputils-ping iproute2 iptables
|
2021-02-04 08:25:44 -08:00
|
|
|
|
|
|
|
|
# Compilation Steps.
|
|
|
|
|
RUN gcc -O2 -o test_copy_up test_copy_up.c
|
|
|
|
|
RUN gcc -O2 -o test_rewinddir test_rewinddir.c
|
|
|
|
|
RUN gcc -O2 -o link_test link_test.c
|
|
|
|
|
RUN gcc -O2 -o test_sticky test_sticky.c
|
2022-11-16 08:23:17 -08:00
|
|
|
RUN gcc -O2 -o host_fd host_fd.c
|
2024-10-04 14:35:21 -07:00
|
|
|
RUN gcc -O2 -o host_connect host_connect.c
|
2024-10-10 11:02:17 -07:00
|
|
|
RUN gcc -O2 -o tcp_server tcp_server.c
|
2024-10-04 14:35:21 -07:00
|
|
|
|
|
|
|
|
# Add nonprivileged regular user named "nonroot".
|
|
|
|
|
RUN groupadd --gid 1337 nonroot && \
|
2024-12-13 20:01:15 +01:00
|
|
|
useradd --uid 1338 --gid 1337 \
|
2024-10-04 14:35:21 -07:00
|
|
|
--create-home \
|
|
|
|
|
--shell $(which bash) \
|
|
|
|
|
--password '' \
|
|
|
|
|
nonroot
|
2024-12-13 20:01:15 +01:00
|
|
|
|
|
|
|
|
# Copy host_connect to /home/nonroot so that "nonroot" can execute it.
|
|
|
|
|
RUN cp host_connect /home/nonroot/host_connect
|