-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlocal.Dockerfile
31 lines (22 loc) · 973 Bytes
/
local.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
FROM runtime as local
USER root
RUN apk add --update --no-cache openssh
RUN ssh-keygen -A \
&& mkdir -p /root/.ssh \
&& touch /root/.ssh/authorized_keys \
&& chmod 700 /root/.ssh \
&& chmod 600 /root/.ssh/authorized_keys
COPY id_rsa.pub /root/.ssh/authorized_keys
RUN sed -i '/^AllowTcpForwarding/d' /etc/ssh/sshd_config \
&& sed -i '/^GatewayPorts/d' /etc/ssh/sshd_config \
&& echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config \
&& echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config \
&& echo 'PermitEmptyPasswords yes' >> /etc/ssh/sshd_config \
&& echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config \
&& echo 'ChallengeResponseAuthentication no' >> /etc/ssh/sshd_config \
&& echo 'GatewayPorts clientspecified' >> /etc/ssh/sshd_config
RUN sed -i '/UsePAM/d' /etc/ssh/sshd_config
# Set root password (optional, for testing purposes)
RUN echo 'root:password' | chpasswd
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]