-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
39 lines (20 loc) · 778 Bytes
/
dockerfile
File metadata and controls
39 lines (20 loc) · 778 Bytes
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
FROM alpine:3.15
EXPOSE 22/tcp
RUN apk add openssh
RUN mkdir /logs
RUN chmod 003 /logs
RUN touch /logs/log
RUN chmod 222 /logs/log
ADD --chown=root:root ./main /bin/funsh
RUN chmod 111 /bin/funsh
ADD --chown=root:root ./keys/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key
RUN chmod 600 /etc/ssh/ssh_host_rsa_key
RUN adduser --disabled-password --gecos "John Doe" --uid 4357 --shell /bin/funsh jdoe
RUN chown -R root:root /home/jdoe
RUN chmod -R 000 /home/jdoe
RUN chmod 001 /home/jdoe
RUN sed -i 's/jdoe:!:/jdoe:\*:/g' /etc/shadow
ADD --chown=root:root ./keys/user_key.pub /authorized_keys
RUN chmod 644 /authorized_keys
ADD --chown=root:root ./sshd_config /etc/ssh/sshd_config
ENTRYPOINT ["/usr/sbin/sshd","-D","-p","22"]