]> source.dussan.org Git - gitea.git/commitdiff
Implement the ability to change the ssh port to match what is in the gitea config...
authorChristopher Thomas <chris.thomas@antimatter-studios.com>
Sun, 7 Jul 2019 01:57:53 +0000 (03:57 +0200)
committertechknowlogick <techknowlogick@gitea.io>
Sun, 7 Jul 2019 01:57:53 +0000 (21:57 -0400)
* - 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
docker/root/etc/ssh/sshd_config [deleted file]
docker/root/etc/templates/sshd_config [new file with mode: 0644]

index f8ef816a9566b34e0880a88376ef2dcd6adf1f9a..10d195b74f70db2cf0a1fd14ed9c4d6ab5726f59 100755 (executable)
@@ -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/ssh/sshd_config
deleted file mode 100644 (file)
index 6af082c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-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
diff --git a/docker/root/etc/templates/sshd_config b/docker/root/etc/templates/sshd_config
new file mode 100644 (file)
index 0000000..ba92e23
--- /dev/null
@@ -0,0 +1,33 @@
+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