-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (29 loc) · 1.26 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
# SSH froward service
FROM alpine:3.15
RUN apk update && \
apk add --no-cache openssh-server && \
rm /etc/ssh/sshd_config && \
echo 'GatewayPorts yes' >> /etc/ssh/sshd_config && \
echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config && \
echo 'PidFile none' >> /etc/ssh/sshd_config && \
echo 'AllowAgentForwarding no' >> /etc/ssh/sshd_config && \
echo 'PermitTTY no' >> /etc/ssh/sshd_config && \
echo 'ChrootDirectory /none' >> /etc/ssh/sshd_config && \
echo 'Banner none' >> /etc/ssh/sshd_config && \
echo 'AllowUsers forward' >> /etc/ssh/sshd_config && \
echo 'ForceCommand echo Welcome to ssh-forward!' >> /etc/ssh/sshd_config && \
rm /etc/passwd && \
rm /etc/shadow && \
echo 'sshd:x:22:22:sshd:/dev/null:/sbin/nologin' >> /etc/passwd && \
echo 'forward:x:0:0:forward,,,:/home/forward:/sbin/nologin' >> /etc/passwd && \
echo 'sshd:!:::::::' >> /etc/shadow && \
echo 'forward::::::::' >> /etc/shadow && \
mkdir /none && \
mkdir -p /home/forward/.ssh && \
apk del alpine-baselayout alpine-keys musl-utils libc-utils musl && \
mkdir /var/empty && \
rm -rf /var/cache/apk/* && \
rm -rf /usr/bin/ssh-keygen && \
apk del apk-tools busybox
EXPOSE 22
ENTRYPOINT ["/usr/sbin/sshd", "-D"]