From 75d44143863e90a7aeff30a3f40128f144df94dd Mon Sep 17 00:00:00 2001 From: Christopher Thomas Date: Sun, 7 Jul 2019 03:57:53 +0200 Subject: [PATCH] Implement the ability to change the ssh port to match what is in the gitea config (#7286) * - 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 --- docker/root/etc/s6/openssh/setup | 7 +++++++ docker/root/etc/{ssh => templates}/sshd_config | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) rename docker/root/etc/{ssh => templates}/sshd_config (93%) diff --git a/docker/root/etc/s6/openssh/setup b/docker/root/etc/s6/openssh/setup index f8ef816a9..10d195b74 100755 --- a/docker/root/etc/s6/openssh/setup +++ b/docker/root/etc/s6/openssh/setup @@ -24,6 +24,13 @@ if [ ! -f /data/ssh/ssh_host_ecdsa_key ]; then 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/* diff --git a/docker/root/etc/ssh/sshd_config b/docker/root/etc/templates/sshd_config similarity index 93% rename from docker/root/etc/ssh/sshd_config rename to docker/root/etc/templates/sshd_config index 6af082c41..ba92e236e 100644 --- a/docker/root/etc/ssh/sshd_config +++ b/docker/root/etc/templates/sshd_config @@ -1,4 +1,4 @@ -Port 22 +Port ${SSH_PORT} Protocol 2 AddressFamily any