feat: generate SSH2 ED25519 HostKey during startup
This commit is contained in:
parent
077eec64ee
commit
78b83de803
@ -10,7 +10,8 @@ RUN set -eux; \
|
||||
net-tools \
|
||||
screen \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
rm /etc/ssh/ssh_host_*key*
|
||||
|
||||
ADD start.sh /
|
||||
|
||||
|
7
start.sh
7
start.sh
@ -45,4 +45,11 @@ while [ "$USERADD" != "$i" ] ;do
|
||||
useradd --home-dir "$BASE_DIR/$USER_NAME" --uid "$USER_UID" --gid "$USER_GID" "$USER_NAME"
|
||||
done
|
||||
|
||||
if [ -z "$(find /etc/ssh/ -maxdepth 1 -name 'ssh_host_*_key' -print -quit)" ]; then
|
||||
echo "Creating SSH2 ED25519 key; this may take some time ..."
|
||||
ssh-keygen -q -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519
|
||||
ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub
|
||||
echo "HostKey /etc/ssh/ssh_host_ed25519_key" >> /etc/ssh/sshd_config
|
||||
fi
|
||||
|
||||
exec /usr/sbin/sshd -D -e
|
||||
|
Loading…
Reference in New Issue
Block a user