aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorChristopher Thomas2019-07-07 03:57:53 +0200
committertechknowlogick2019-07-06 21:57:53 -0400
commit75d44143863e90a7aeff30a3f40128f144df94dd (patch)
tree91d0e484ecc2ceb441206e33da02324a5672906c /docker
parentb282d4e1216964eae54a7b5d10c2ec2feb88a11e (diff)
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
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/root/etc/s6/openssh/setup7
-rw-r--r--docker/root/etc/templates/sshd_config (renamed from docker/root/etc/ssh/sshd_config)2
2 files changed, 8 insertions, 1 deletions
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
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