* - rearrange the templates to make it more logical because now ssh_config is a template
- implemented the updating of the port to the same as the port sent to the gitea config
* change the filename back
ssh-keygen -t ecdsa -b 256 -f /data/ssh/ssh_host_ecdsa_key -N "" > /dev/null
fi
+if [ -d /etc/ssh ]; then
+ SSH_PORT=${SSH_PORT:-"22"} \
+ envsubst < /etc/templates/sshd_config > /etc/ssh/sshd_config
+
+ chmod 0644 /etc/ssh/sshd_config
+fi
+
chown root:root /data/ssh/*
chmod 0700 /data/ssh
chmod 0600 /data/ssh/*
+++ /dev/null
-Port 22
-Protocol 2
-
-AddressFamily any
-ListenAddress 0.0.0.0
-ListenAddress ::
-
-LogLevel INFO
-
-HostKey /data/ssh/ssh_host_ed25519_key
-HostKey /data/ssh/ssh_host_rsa_key
-HostKey /data/ssh/ssh_host_dsa_key
-HostKey /data/ssh/ssh_host_ecdsa_key
-
-AuthorizedKeysFile .ssh/authorized_keys
-
-UseDNS no
-AllowAgentForwarding no
-AllowTcpForwarding no
-PrintMotd no
-
-PermitUserEnvironment yes
-PermitRootLogin no
-ChallengeResponseAuthentication no
-PasswordAuthentication no
-PermitEmptyPasswords no
-
-AllowUsers git
-
-Banner none
-Subsystem sftp /usr/lib/ssh/sftp-server
-
-AcceptEnv GIT_PROTOCOL
\ No newline at end of file
--- /dev/null
+Port ${SSH_PORT}
+Protocol 2
+
+AddressFamily any
+ListenAddress 0.0.0.0
+ListenAddress ::
+
+LogLevel INFO
+
+HostKey /data/ssh/ssh_host_ed25519_key
+HostKey /data/ssh/ssh_host_rsa_key
+HostKey /data/ssh/ssh_host_dsa_key
+HostKey /data/ssh/ssh_host_ecdsa_key
+
+AuthorizedKeysFile .ssh/authorized_keys
+
+UseDNS no
+AllowAgentForwarding no
+AllowTcpForwarding no
+PrintMotd no
+
+PermitUserEnvironment yes
+PermitRootLogin no
+ChallengeResponseAuthentication no
+PasswordAuthentication no
+PermitEmptyPasswords no
+
+AllowUsers git
+
+Banner none
+Subsystem sftp /usr/lib/ssh/sftp-server
+
+AcceptEnv GIT_PROTOCOL
\ No newline at end of file