From fd6c5502694b24248abdfd30d4ed05bcc18bdb10 Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 13 Dec 2017 21:54:20 +1100 Subject: [PATCH] Added SSHD to the image with user lamp --- Dockerfile | 10 ++++++++++ sshd_config.patch | 20 ++++++++++++++++++++ start | 8 ++++++++ 3 files changed, 38 insertions(+) create mode 100644 sshd_config.patch create mode 100755 start diff --git a/Dockerfile b/Dockerfile index c6a7466..44f5d90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,3 +6,13 @@ RUN echo "deb http://deb.debian.org/debian jessie non-free" >> /etc/apt/sources. && download-mibs \ && docker-php-ext-configure gd --with-freetype-dir=/usr/include/freetype2 --with-jpeg-dir=/usr/include/ \ && docker-php-ext-install -j$(nproc) pdo_mysql bz2 gettext sockets gmp gd pcntl snmp + +RUN apt-get install -y openssh-server && useradd -c "Hosting Admin User" -u 1000 -g users -G www-data -d /var/www/html -M lamp +EXPOSE 9000/tcp 22/tcp + +COPY sshd_config.patch /tmp +RUN (cd / && patch -p0 ) < /tmp/sshd_config.patch && rm /tmp/sshd_config.patch + +COPY start /usr/local/sbin +ENTRYPOINT [ "/usr/local/sbin/start" ] +CMD ["php-fpm"] diff --git a/sshd_config.patch b/sshd_config.patch new file mode 100644 index 0000000..a67df94 --- /dev/null +++ b/sshd_config.patch @@ -0,0 +1,20 @@ +--- /etc/ssh/sshd_config.orig 2017-12-13 10:12:21.098005827 +0000 ++++ /etc/ssh/sshd_config 2017-12-13 10:14:11.461687661 +0000 +@@ -25,7 +25,7 @@ + + # Authentication: + LoginGraceTime 120 +-PermitRootLogin without-password ++PermitRootLogin no + StrictModes yes + + RSAAuthentication yes +@@ -49,7 +49,7 @@ + ChallengeResponseAuthentication no + + # Change to no to disable tunnelled clear text passwords +-#PasswordAuthentication yes ++PasswordAuthentication no + + # Kerberos options + #KerberosAuthentication no diff --git a/start b/start new file mode 100755 index 0000000..c9f92a1 --- /dev/null +++ b/start @@ -0,0 +1,8 @@ +#!/bin/sh +set -ex + +[ ! -d /var/run/sshd ] && mkdir /var/run/sshd +[ -x /usr/sbin/sshd ] && start-stop-daemon --start --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- -p 22 + +echo "Starting php [$@]" +exec /usr/local/bin/docker-php-entrypoint "$@"