-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
33 lines (30 loc) · 1.32 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
FROM alpine:3.15
LABEL maintainer "Patrick Baber <patrick.baber@servivum.com>"
# Install openssh-server
RUN apk add --no-cache \
bash \
openssh \
&& \
echo "Removing existing keys…" && \
rm -rf \
/etc/ssh/ssh_host_dsa_key \
/etc/ssh/ssh_host_ecdsa_key \
/etc/ssh/ssh_host_ed25519_key \
/etc/ssh/ssh_host_rsa_key \
&& \
echo "Replacing host key paths…" && \
mkdir -p /etc/ssh/host_keys && \
sed -i 's/#HostKey \/etc\/ssh\/ssh_host_rsa_key/HostKey \/etc\/ssh\/host_keys\/rsa_key/g' /etc/ssh/sshd_config && \
sed -i 's/#HostKey \/etc\/ssh\/ssh_host_dsa_key/HostKey \/etc\/ssh\/host_keys\/dsa_key/g' /etc/ssh/sshd_config && \
sed -i 's/#HostKey \/etc\/ssh\/ssh_host_ecdsa_key/HostKey \/etc\/ssh\/host_keys\/ecdsa_key/g' /etc/ssh/sshd_config && \
sed -i 's/#HostKey \/etc\/ssh\/ssh_host_ed25519_key/HostKey \/etc\/ssh\/host_keys\/ed25519_key/g' /etc/ssh/sshd_config && \
echo "Enabling AllowTcpForwarding…" && \
sed -i 's/AllowTcpForwarding no/AllowTcpForwarding yes/g' /etc/ssh/sshd_config && \
echo "Preparing run direcotry for sshd…" && \
mkdir -p /var/run/sshd
COPY etc/motd /etc/motd
COPY usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
VOLUME /etc/ssh/host_keys/
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
ENTRYPOINT ["docker-entrypoint.sh"]