-
Notifications
You must be signed in to change notification settings - Fork 71
/
Dockerfile
45 lines (38 loc) · 1.3 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Use an official Python runtime as a parent image
# FROM python:3.8
ARG LINUX_DISTRO=ubuntu:latest
ARG PYTHON_VERSION=3.8
FROM python:${PYTHON_VERSION}
# Set the working directory in the container
RUN apt-get update -y
RUN apt-get install -y zip
RUN apt-get install -y cron
RUN apt-get install -y nano
RUN apt-get install -y nmap
RUN apt-get install -y vim
RUN apt-get install -y supervisor
RUN apt-get install -y openssh-server
RUN apt-get install -y sudo
RUN pip install pytest pytest-cov
RUN chmod u+s $(which find)
RUN chmod u+s $(which nmap)
RUN chmod u+s $(which cp)
RUN chmod u+s $(which tee)
RUN chmod u+s $(which dd)
RUN chmod u+s $(which mv)
RUN chmod u+s $(which rbash)
RUN pip install mock
RUN useradd -ms /bin/bash lowpriv
RUN useradd -ms /bin/bash higherpriv
RUN ssh-keygen -N '' -f /root/.ssh/id_rsa
RUN cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
RUN echo "ONLY_ROOT_CAN_READ_THIS" > /root/proof.txt
RUN echo "lowpriv ALL=(ALL) NOPASSWD: /usr/bin/head" >> /etc/sudoers
RUN echo "lowpriv ALL=(higherpriv) NOPASSWD: /usr/bin/vim" >> /etc/sudoers
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN mkdir /run/sshd
# USER lowpriv
WORKDIR /home/lowpriv/
COPY --chown=lowpriv:lowpriv . .
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
#CMD ["pytest", "-v"]