Dockerfile 809 B

123456789101112131415161718192021222324
  1. FROM debian:bookworm-slim
  2. RUN apt-get update && apt-get install -y --no-install-recommends \
  3. openssh-server && \
  4. rm -rf /var/lib/apt/lists/*
  5. # Compte testuser — mot de passe requis pour déverrouiller le compte PAM
  6. RUN useradd -m -s /bin/bash testuser && \
  7. echo "testuser:testuser" | chpasswd && \
  8. mkdir -p /home/testuser/.ssh && \
  9. chmod 700 /home/testuser/.ssh
  10. # Clé publique gateway → authorized_keys des destinations
  11. # Générée par le script init-keys.sh avant le build
  12. COPY keys/gateway_rsa.pub /home/testuser/.ssh/authorized_keys
  13. RUN chmod 600 /home/testuser/.ssh/authorized_keys && \
  14. chown -R testuser:testuser /home/testuser/.ssh
  15. # sshd_config destination
  16. RUN mkdir -p /run/sshd
  17. COPY dest/sshd_config /etc/ssh/sshd_config
  18. EXPOSE 22
  19. CMD ["/usr/sbin/sshd", "-D", "-e"]