aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile.debian
diff options
context:
space:
mode:
authorAlex Pooley (@zuedev) <zuedev@gmail.com>2026-05-07 23:43:08 +0100
committerAlex Pooley (@zuedev) <zuedev@gmail.com>2026-05-07 23:43:08 +0100
commit56f153db9c87c00ce85d6899b4038b7f0b36eb9c (patch)
treead8d52972b4cc89189c155ec0a485bf2c9bd5fbb /Dockerfile.debian
parent73d50af19ed07afc1a2fa02020d0b4ea167160da (diff)
downloadgit.zue.dev-56f153db9c87c00ce85d6899b4038b7f0b36eb9c.tar
git.zue.dev-56f153db9c87c00ce85d6899b4038b7f0b36eb9c.tar.gz
git.zue.dev-56f153db9c87c00ce85d6899b4038b7f0b36eb9c.tar.bz2
git.zue.dev-56f153db9c87c00ce85d6899b4038b7f0b36eb9c.tar.xz
git.zue.dev-56f153db9c87c00ce85d6899b4038b7f0b36eb9c.zip
Enhance SSH configuration and key management in Docker setup by persisting keys to avoid "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!" issues
Diffstat (limited to 'Dockerfile.debian')
-rw-r--r--Dockerfile.debian12
1 files changed, 10 insertions, 2 deletions
diff --git a/Dockerfile.debian b/Dockerfile.debian
index 3993f22..8bd71de 100644
--- a/Dockerfile.debian
+++ b/Dockerfile.debian
@@ -21,8 +21,16 @@ RUN useradd -m -s /bin/bash git
# Create the repositories directory and set appropriate permissions
RUN mkdir -p /repositories && chown git:git /repositories
-# Disallow password authentication for security reasons
-RUN echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
+# Remove auto-generated SSH host keys so they are not baked into the image.
+# Keys will be generated at container startup and persisted via a volume mount.
+RUN rm -f /etc/ssh/ssh_host_*
+
+# Disallow password authentication for security reasons.
+# Point sshd to the persistent host key location.
+RUN echo "PasswordAuthentication no" >> /etc/ssh/sshd_config && \
+ echo "HostKey /run/ssh/ssh_host_rsa_key" >> /etc/ssh/sshd_config && \
+ echo "HostKey /run/ssh/ssh_host_ecdsa_key" >> /etc/ssh/sshd_config && \
+ echo "HostKey /run/ssh/ssh_host_ed25519_key" >> /etc/ssh/sshd_config
# Copy the entrypoint script into the container
COPY entrypoint.bash /