-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (41 loc) · 1.39 KB
/
Dockerfile
File metadata and controls
53 lines (41 loc) · 1.39 KB
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
46
47
48
49
50
51
52
53
FROM ubuntu:18.04
RUN apt update && apt install openssh-server sudo -y
RUN apt-get -y install openssh-client
RUN mkdir -p /var/run/sshd
RUN groupadd boss
RUN adduser --no-create-home --disabled-password --gecos "" bob
RUN mkdir -p /home/bob/.ssh
RUN chown bob:bob /home/bob/.ssh
USER bob
RUN ssh-keygen -q -t rsa -N '' -f /home/bob/.ssh/id_rsa
USER root
RUN usermod -g users bob
RUN adduser --disabled-password --gecos "" dylan
RUN mkdir /home/dylan/.ssh
RUN cp /home/bob/.ssh/id_rsa.pub /home/dylan/.ssh/authorized_keys
RUN chown dylan:dylan /home/dylan/.ssh/authorized_keys
RUN usermod -g users dylan
RUN adduser --disabled-password --gecos "" hr
RUN usermod -g boss hr
RUN chmod 760 -R /home/hr/
RUN adduser --disabled-password --gecos "" util
RUN usermod -g boss util
RUN chmod 760 -R /home/util/
RUN echo 'bob:password123' | chpasswd
RUN echo 'dylan:I_h4t3_my_j0b' | chpasswd
RUN echo 'hr:$3cur3_l0l' | chpasswd
COPY note.txt /home/bob/note.txt
RUN chown dylan:dylan /home/bob/note.txt
COPY flag.txt /home/hr/flag.txt
RUN chown hr:hr /home/hr/flag.txt
COPY sudoers /etc/sudoers
COPY howto.txt /etc/motd
COPY passManager /home/util/
RUN ln -sf /dev/null /home/bob/.bash_history
RUN ln -sf /dev/null /home/hr/.bash_history
RUN ln -sf /dev/null /home/dylan/.bash_history
RUN ln -sf /dev/null /home/util/.bash_history
RUN rm -rf /bin/su
RUN chmod -x /etc/update-motd.d/*
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]