|
@@ -29,8 +29,24 @@ if [[ -z "${SSH_PORT:-}" ]]; then
|
|
disable_ssh="true"
|
|
disable_ssh="true"
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
+if [[ ! -f "/app/data/sshd/ssh_host_ed25519_key" ]]; then
|
|
|
|
+ echo "Generating ssh host keys"
|
|
|
|
+ mkdir -p /app/data/sshd
|
|
|
|
+ ssh-keygen -qt rsa1 -N '' -f /app/data/sshd/ssh_host_key
|
|
|
|
+ ssh-keygen -qt rsa -N '' -f /app/data/sshd/ssh_host_rsa_key
|
|
|
|
+ ssh-keygen -qt dsa -N '' -f /app/data/sshd/ssh_host_dsa_key
|
|
|
|
+ ssh-keygen -qt ecdsa -N '' -f /app/data/sshd/ssh_host_ecdsa_key
|
|
|
|
+ ssh-keygen -qt ed25519 -N '' -f /app/data/sshd/ssh_host_ed25519_key
|
|
|
|
+else
|
|
|
|
+ echo "Reusing existing host keys"
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
+chmod 0600 /app/data/sshd/*_key
|
|
|
|
+chmod 0644 /app/data/sshd/*.pub
|
|
|
|
+
|
|
sed -e "s/^Port .*/Port ${SSH_PORT}/" \
|
|
sed -e "s/^Port .*/Port ${SSH_PORT}/" \
|
|
-e "s/^#ListenAddress .*/ListenAddress 0.0.0.0/" \
|
|
-e "s/^#ListenAddress .*/ListenAddress 0.0.0.0/" \
|
|
|
|
+ -e "s,^HostKey /etc/ssh/,HostKey /app/data/sshd/," \
|
|
/etc/ssh/sshd_config > /run/gogs/sshd_config
|
|
/etc/ssh/sshd_config > /run/gogs/sshd_config
|
|
|
|
|
|
sed -e "s/##DOMAIN/${APP_DOMAIN}/g" \
|
|
sed -e "s/##DOMAIN/${APP_DOMAIN}/g" \
|