Commit ea19f8e2 authored by nimrod's avatar nimrod
Browse files

SSH daemon WIP.

parent ca3e38c9
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -105,3 +105,18 @@ push-httpd-bullseye:
  needs:
    - job: build-httpd-bullseye
      artifacts: true

# sshd image:

build-sshd:
  extends: .build
  variables:
    CONTEXT: sshd

push-sshd:
  extends: .push
  variables:
    IMAGE: sshd
  needs:
    - job: build-sshd
      artifacts: true

sshd/.dockerignore

0 → 100644
+2 −0
Original line number Diff line number Diff line
*
!entrypoint

sshd/Dockerfile

0 → 100644
+17 −0
Original line number Diff line number Diff line
ARG BASEIMAGE=debian:testing-slim
FROM ${BASEIMAGE}
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        netcat-openbsd \
        openssh-server \
    && \
    rm -f /etc/ssh/ssh_host_* && \
    echo > /etc/ssh/sshd_config && \
    rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/*
COPY entrypoint /entrypoint
EXPOSE 22
ENTRYPOINT ["/entrypoint"]
HEALTHCHECK --start-period=5m CMD echo | nc localhost 22 | grep -q 'SSH-2.0-OpenSSH'
ENV SSHD_ARGS="-De -o 'PermitRootLogin no' -o 'PasswordAuthentication no' -o 'ChallengeResponseAuthentication no' -o 'PrintMotd no' -o 'PidFile none' -o 'Subsystem sftp /usr/lib/openssh/sftp-server'"
ENV EXTRA_SSHD_ARGS=""
CMD ["/usr/sbin/sshd", "$SSHD_ARGS", "$EXTRAS_SSHD_ARGS"]

sshd/README.md

0 → 100644
+3 −0
Original line number Diff line number Diff line
# sshd

> A dockerized SSH daemon.

sshd/entrypoint

0 → 100755
+13 −0
Original line number Diff line number Diff line
#!/bin/sh
set -eux

if [ ! -f /etc/ssh/moduli ]
then
    ssh-keygen -G /etc/ssh/moduli.candidates
    ssh-keygen -T /etc/ssh/moduli -f /etc/ssh/moduli.candidates
    rm /etc/ssh/moduli.candidates
fi
ssh-keygen -A
mkdir -p /run/sshd

eval 'exec "$@"'