From c703a8fa544d80ac57b49997a3b204e0f834fd1b Mon Sep 17 00:00:00 2001 From: Italo Israel Baeza Cabrera Date: Fri, 29 Nov 2024 19:32:41 -0300 Subject: [PATCH 1/5] [1.x] Adds SSH Server (opt-in) --- runtimes/8.0/Dockerfile | 10 ++++++++++ runtimes/8.0/supervisord.conf | 9 +++++++++ runtimes/8.1/Dockerfile | 10 ++++++++++ runtimes/8.1/supervisord.conf | 9 +++++++++ runtimes/8.2/Dockerfile | 10 ++++++++++ runtimes/8.2/supervisord.conf | 9 +++++++++ runtimes/8.3/Dockerfile | 10 ++++++++++ runtimes/8.3/supervisord.conf | 9 +++++++++ runtimes/8.4/Dockerfile | 11 +++++++++++ runtimes/8.4/supervisord.conf | 9 +++++++++ stubs/docker-compose.stub | 1 + 11 files changed, 97 insertions(+) diff --git a/runtimes/8.0/Dockerfile b/runtimes/8.0/Dockerfile index 23fb2ace..92a38b48 100644 --- a/runtimes/8.0/Dockerfile +++ b/runtimes/8.0/Dockerfile @@ -12,6 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" +ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -60,6 +61,15 @@ RUN userdel -r ubuntu RUN groupadd --force -g $WWWGROUP sail RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail +RUN apt-get update && apt-get upgrade -y \ + && apt-get install -y openssh-server \ + && apt-get -y autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN mkdir /var/run/sshd +RUN useradd -m -s /bin/bash sail && echo "sail:sail" | chpasswd && usermod -aG sudo sail +RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config + COPY start-container /usr/local/bin/start-container COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY php.ini /etc/php/8.0/cli/conf.d/99-sail.ini diff --git a/runtimes/8.0/supervisord.conf b/runtimes/8.0/supervisord.conf index 656da8a9..f81f18fe 100644 --- a/runtimes/8.0/supervisord.conf +++ b/runtimes/8.0/supervisord.conf @@ -12,3 +12,12 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 + +[program:ssh] +command=%(ENV_SUPERVISOR_SSH_COMMAND)s +user=root +environment=LARAVEL_SAIL="1" +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/runtimes/8.1/Dockerfile b/runtimes/8.1/Dockerfile index 2261ab86..ee9613c2 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -12,6 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" +ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -59,6 +60,15 @@ RUN userdel -r ubuntu RUN groupadd --force -g $WWWGROUP sail RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail +RUN apt-get update && apt-get upgrade -y \ + && apt-get install -y openssh-server \ + && apt-get -y autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN mkdir /var/run/sshd +RUN useradd -m -s /bin/bash sail && echo "sail:sail" | chpasswd && usermod -aG sudo sail +RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config + COPY start-container /usr/local/bin/start-container COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini diff --git a/runtimes/8.1/supervisord.conf b/runtimes/8.1/supervisord.conf index 656da8a9..f81f18fe 100644 --- a/runtimes/8.1/supervisord.conf +++ b/runtimes/8.1/supervisord.conf @@ -12,3 +12,12 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 + +[program:ssh] +command=%(ENV_SUPERVISOR_SSH_COMMAND)s +user=root +environment=LARAVEL_SAIL="1" +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/runtimes/8.2/Dockerfile b/runtimes/8.2/Dockerfile index 88d497ab..c3b41001 100644 --- a/runtimes/8.2/Dockerfile +++ b/runtimes/8.2/Dockerfile @@ -12,6 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" +ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -60,6 +61,15 @@ RUN userdel -r ubuntu RUN groupadd --force -g $WWWGROUP sail RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail +RUN apt-get update && apt-get upgrade -y \ + && apt-get install -y openssh-server \ + && apt-get -y autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN mkdir /var/run/sshd +RUN useradd -m -s /bin/bash sail && echo "sail:sail" | chpasswd && usermod -aG sudo sail +RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config + COPY start-container /usr/local/bin/start-container COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY php.ini /etc/php/8.2/cli/conf.d/99-sail.ini diff --git a/runtimes/8.2/supervisord.conf b/runtimes/8.2/supervisord.conf index 656da8a9..f81f18fe 100644 --- a/runtimes/8.2/supervisord.conf +++ b/runtimes/8.2/supervisord.conf @@ -12,3 +12,12 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 + +[program:ssh] +command=%(ENV_SUPERVISOR_SSH_COMMAND)s +user=root +environment=LARAVEL_SAIL="1" +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/runtimes/8.3/Dockerfile b/runtimes/8.3/Dockerfile index af5cb8e7..904fbfab 100644 --- a/runtimes/8.3/Dockerfile +++ b/runtimes/8.3/Dockerfile @@ -13,6 +13,7 @@ ENV DEBIAN_FRONTEND=noninteractive ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" +ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -61,6 +62,15 @@ RUN userdel -r ubuntu RUN groupadd --force -g $WWWGROUP sail RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail +RUN apt-get update && apt-get upgrade -y \ + && apt-get install -y openssh-server \ + && apt-get -y autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN mkdir /var/run/sshd +RUN useradd -m -s /bin/bash sail && echo "sail:sail" | chpasswd && usermod -aG sudo sail +RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config + COPY start-container /usr/local/bin/start-container COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY php.ini /etc/php/8.3/cli/conf.d/99-sail.ini diff --git a/runtimes/8.3/supervisord.conf b/runtimes/8.3/supervisord.conf index 656da8a9..f81f18fe 100644 --- a/runtimes/8.3/supervisord.conf +++ b/runtimes/8.3/supervisord.conf @@ -12,3 +12,12 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 + +[program:ssh] +command=%(ENV_SUPERVISOR_SSH_COMMAND)s +user=root +environment=LARAVEL_SAIL="1" +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/runtimes/8.4/Dockerfile b/runtimes/8.4/Dockerfile index 8707873e..84b2037c 100644 --- a/runtimes/8.4/Dockerfile +++ b/runtimes/8.4/Dockerfile @@ -13,6 +13,8 @@ ENV DEBIAN_FRONTEND=noninteractive ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" +ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" + RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -62,6 +64,15 @@ RUN userdel -r ubuntu RUN groupadd --force -g $WWWGROUP sail RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail +RUN apt-get update && apt-get upgrade -y \ + && apt-get install -y openssh-server \ + && apt-get -y autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN mkdir /var/run/sshd +RUN useradd -m -s /bin/bash sail && echo "sail:sail" | chpasswd && usermod -aG sudo sail +RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config + COPY start-container /usr/local/bin/start-container COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY php.ini /etc/php/8.4/cli/conf.d/99-sail.ini diff --git a/runtimes/8.4/supervisord.conf b/runtimes/8.4/supervisord.conf index 656da8a9..f81f18fe 100644 --- a/runtimes/8.4/supervisord.conf +++ b/runtimes/8.4/supervisord.conf @@ -12,3 +12,12 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 + +[program:ssh] +command=%(ENV_SUPERVISOR_SSH_COMMAND)s +user=root +environment=LARAVEL_SAIL="1" +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/stubs/docker-compose.stub b/stubs/docker-compose.stub index c574efcb..a97e2ddc 100644 --- a/stubs/docker-compose.stub +++ b/stubs/docker-compose.stub @@ -10,6 +10,7 @@ services: extra_hosts: - 'host.docker.internal:host-gateway' ports: + # - '${SSH_PORT:-2222}:22' - '${APP_PORT:-80}:80' - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' environment: From 57accbd6c4c980d8c165302233c990183bc40ac3 Mon Sep 17 00:00:00 2001 From: Italo Israel Baeza Cabrera Date: Fri, 29 Nov 2024 22:22:32 -0300 Subject: [PATCH 2/5] Fixes user default password --- runtimes/8.0/Dockerfile | 4 ++-- runtimes/8.1/Dockerfile | 4 ++-- runtimes/8.2/Dockerfile | 4 ++-- runtimes/8.3/Dockerfile | 4 ++-- runtimes/8.4/Dockerfile | 5 ++--- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/runtimes/8.0/Dockerfile b/runtimes/8.0/Dockerfile index 92a38b48..9dc82f2f 100644 --- a/runtimes/8.0/Dockerfile +++ b/runtimes/8.0/Dockerfile @@ -13,6 +13,7 @@ ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" +ENV SSH_PASSWORD="sail" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -66,8 +67,7 @@ RUN apt-get update && apt-get upgrade -y \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir /var/run/sshd -RUN useradd -m -s /bin/bash sail && echo "sail:sail" | chpasswd && usermod -aG sudo sail +RUN mkdir /var/run/sshd && RUN echo "sail:${SSH_PASSWORD}" | chpasswd && usermod -aG sudo sail RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config COPY start-container /usr/local/bin/start-container diff --git a/runtimes/8.1/Dockerfile b/runtimes/8.1/Dockerfile index ee9613c2..99e0dd1e 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -13,6 +13,7 @@ ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" +ENV SSH_PASSWORD="sail" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -65,8 +66,7 @@ RUN apt-get update && apt-get upgrade -y \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir /var/run/sshd -RUN useradd -m -s /bin/bash sail && echo "sail:sail" | chpasswd && usermod -aG sudo sail +RUN mkdir /var/run/sshd && RUN echo "sail:${SSH_PASSWORD}" | chpasswd && usermod -aG sudo sail RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config COPY start-container /usr/local/bin/start-container diff --git a/runtimes/8.2/Dockerfile b/runtimes/8.2/Dockerfile index c3b41001..7e0d0aa3 100644 --- a/runtimes/8.2/Dockerfile +++ b/runtimes/8.2/Dockerfile @@ -13,6 +13,7 @@ ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" +ENV SSH_PASSWORD="sail" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -66,8 +67,7 @@ RUN apt-get update && apt-get upgrade -y \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir /var/run/sshd -RUN useradd -m -s /bin/bash sail && echo "sail:sail" | chpasswd && usermod -aG sudo sail +RUN mkdir /var/run/sshd && RUN echo "sail:${SSH_PASSWORD}" | chpasswd && usermod -aG sudo sail RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config COPY start-container /usr/local/bin/start-container diff --git a/runtimes/8.3/Dockerfile b/runtimes/8.3/Dockerfile index 904fbfab..759de612 100644 --- a/runtimes/8.3/Dockerfile +++ b/runtimes/8.3/Dockerfile @@ -14,6 +14,7 @@ ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" +ENV SSH_PASSWORD="sail" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -67,8 +68,7 @@ RUN apt-get update && apt-get upgrade -y \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir /var/run/sshd -RUN useradd -m -s /bin/bash sail && echo "sail:sail" | chpasswd && usermod -aG sudo sail +RUN mkdir /var/run/sshd && RUN echo "sail:${SSH_PASSWORD}" | chpasswd && usermod -aG sudo sail RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config COPY start-container /usr/local/bin/start-container diff --git a/runtimes/8.4/Dockerfile b/runtimes/8.4/Dockerfile index 84b2037c..d12c6081 100644 --- a/runtimes/8.4/Dockerfile +++ b/runtimes/8.4/Dockerfile @@ -14,7 +14,7 @@ ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" - +ENV SSH_PASSWORD="sail" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -69,8 +69,7 @@ RUN apt-get update && apt-get upgrade -y \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir /var/run/sshd -RUN useradd -m -s /bin/bash sail && echo "sail:sail" | chpasswd && usermod -aG sudo sail +RUN mkdir /var/run/sshd && RUN echo "sail:${SSH_PASSWORD}" | chpasswd && usermod -aG sudo sail RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config COPY start-container /usr/local/bin/start-container From c1d62f1746ae15ec49de8b0700371f99b28bf00f Mon Sep 17 00:00:00 2001 From: Italo Israel Baeza Cabrera Date: Fri, 29 Nov 2024 23:50:01 -0300 Subject: [PATCH 3/5] Moves user password to container startup --- runtimes/8.0/Dockerfile | 3 +-- runtimes/8.0/start-container | 4 ++++ runtimes/8.1/Dockerfile | 3 +-- runtimes/8.1/start-container | 4 ++++ runtimes/8.2/Dockerfile | 3 +-- runtimes/8.2/start-container | 4 ++++ runtimes/8.3/Dockerfile | 3 +-- runtimes/8.3/start-container | 4 ++++ runtimes/8.4/Dockerfile | 3 +-- runtimes/8.4/start-container | 4 ++++ stubs/docker-compose.stub | 1 + 11 files changed, 26 insertions(+), 10 deletions(-) diff --git a/runtimes/8.0/Dockerfile b/runtimes/8.0/Dockerfile index 9dc82f2f..3afbbe57 100644 --- a/runtimes/8.0/Dockerfile +++ b/runtimes/8.0/Dockerfile @@ -13,7 +13,6 @@ ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" -ENV SSH_PASSWORD="sail" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -67,7 +66,7 @@ RUN apt-get update && apt-get upgrade -y \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir /var/run/sshd && RUN echo "sail:${SSH_PASSWORD}" | chpasswd && usermod -aG sudo sail +RUN mkdir /var/run/sshd RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config COPY start-container /usr/local/bin/start-container diff --git a/runtimes/8.0/start-container b/runtimes/8.0/start-container index 40c55dfe..7593ee73 100644 --- a/runtimes/8.0/start-container +++ b/runtimes/8.0/start-container @@ -9,6 +9,10 @@ if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi +if [ ! -z "$SSH_PASSWORD"]; then + echo "sail:$SSH_PASSWORD" | chpasswd +fi + if [ ! -d /.composer ]; then mkdir /.composer fi diff --git a/runtimes/8.1/Dockerfile b/runtimes/8.1/Dockerfile index 99e0dd1e..8342d706 100644 --- a/runtimes/8.1/Dockerfile +++ b/runtimes/8.1/Dockerfile @@ -13,7 +13,6 @@ ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" -ENV SSH_PASSWORD="sail" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -66,7 +65,7 @@ RUN apt-get update && apt-get upgrade -y \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir /var/run/sshd && RUN echo "sail:${SSH_PASSWORD}" | chpasswd && usermod -aG sudo sail +RUN mkdir /var/run/sshd RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config COPY start-container /usr/local/bin/start-container diff --git a/runtimes/8.1/start-container b/runtimes/8.1/start-container index 40c55dfe..7593ee73 100644 --- a/runtimes/8.1/start-container +++ b/runtimes/8.1/start-container @@ -9,6 +9,10 @@ if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi +if [ ! -z "$SSH_PASSWORD"]; then + echo "sail:$SSH_PASSWORD" | chpasswd +fi + if [ ! -d /.composer ]; then mkdir /.composer fi diff --git a/runtimes/8.2/Dockerfile b/runtimes/8.2/Dockerfile index 7e0d0aa3..3cc8bfa2 100644 --- a/runtimes/8.2/Dockerfile +++ b/runtimes/8.2/Dockerfile @@ -13,7 +13,6 @@ ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" -ENV SSH_PASSWORD="sail" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -67,7 +66,7 @@ RUN apt-get update && apt-get upgrade -y \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir /var/run/sshd && RUN echo "sail:${SSH_PASSWORD}" | chpasswd && usermod -aG sudo sail +RUN mkdir /var/run/sshd RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config COPY start-container /usr/local/bin/start-container diff --git a/runtimes/8.2/start-container b/runtimes/8.2/start-container index 40c55dfe..7593ee73 100644 --- a/runtimes/8.2/start-container +++ b/runtimes/8.2/start-container @@ -9,6 +9,10 @@ if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi +if [ ! -z "$SSH_PASSWORD"]; then + echo "sail:$SSH_PASSWORD" | chpasswd +fi + if [ ! -d /.composer ]; then mkdir /.composer fi diff --git a/runtimes/8.3/Dockerfile b/runtimes/8.3/Dockerfile index 759de612..b9fad561 100644 --- a/runtimes/8.3/Dockerfile +++ b/runtimes/8.3/Dockerfile @@ -14,7 +14,6 @@ ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" -ENV SSH_PASSWORD="sail" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -68,7 +67,7 @@ RUN apt-get update && apt-get upgrade -y \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir /var/run/sshd && RUN echo "sail:${SSH_PASSWORD}" | chpasswd && usermod -aG sudo sail +RUN mkdir /var/run/sshd RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config COPY start-container /usr/local/bin/start-container diff --git a/runtimes/8.3/start-container b/runtimes/8.3/start-container index 40c55dfe..7593ee73 100644 --- a/runtimes/8.3/start-container +++ b/runtimes/8.3/start-container @@ -9,6 +9,10 @@ if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi +if [ ! -z "$SSH_PASSWORD"]; then + echo "sail:$SSH_PASSWORD" | chpasswd +fi + if [ ! -d /.composer ]; then mkdir /.composer fi diff --git a/runtimes/8.4/Dockerfile b/runtimes/8.4/Dockerfile index d12c6081..ab9dcbdb 100644 --- a/runtimes/8.4/Dockerfile +++ b/runtimes/8.4/Dockerfile @@ -14,7 +14,6 @@ ENV TZ=UTC ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80" ENV SUPERVISOR_PHP_USER="sail" ENV SUPERVISOR_SSH_COMMAND="/usr/sbin/sshd -D" -ENV SSH_PASSWORD="sail" RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -69,7 +68,7 @@ RUN apt-get update && apt-get upgrade -y \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN mkdir /var/run/sshd && RUN echo "sail:${SSH_PASSWORD}" | chpasswd && usermod -aG sudo sail +RUN mkdir /var/run/sshd RUN sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config COPY start-container /usr/local/bin/start-container diff --git a/runtimes/8.4/start-container b/runtimes/8.4/start-container index 40c55dfe..7593ee73 100644 --- a/runtimes/8.4/start-container +++ b/runtimes/8.4/start-container @@ -9,6 +9,10 @@ if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi +if [ ! -z "$SSH_PASSWORD"]; then + echo "sail:$SSH_PASSWORD" | chpasswd +fi + if [ ! -d /.composer ]; then mkdir /.composer fi diff --git a/stubs/docker-compose.stub b/stubs/docker-compose.stub index a97e2ddc..c29fdaa8 100644 --- a/stubs/docker-compose.stub +++ b/stubs/docker-compose.stub @@ -14,6 +14,7 @@ services: - '${APP_PORT:-80}:80' - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' environment: + # SSH_PASSWORD: 'sail' WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' From daa124847ee29d89422de19cf2c2ba7c432571f6 Mon Sep 17 00:00:00 2001 From: Italo Israel Baeza Cabrera Date: Sat, 30 Nov 2024 02:12:40 -0300 Subject: [PATCH 4/5] Fixes if condition syntax --- runtimes/8.0/start-container | 2 +- runtimes/8.1/start-container | 2 +- runtimes/8.2/start-container | 2 +- runtimes/8.3/start-container | 2 +- runtimes/8.4/start-container | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/runtimes/8.0/start-container b/runtimes/8.0/start-container index 7593ee73..8fbe2ea8 100644 --- a/runtimes/8.0/start-container +++ b/runtimes/8.0/start-container @@ -9,7 +9,7 @@ if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi -if [ ! -z "$SSH_PASSWORD"]; then +if [ ! -z "$SSH_PASSWORD" ]; then echo "sail:$SSH_PASSWORD" | chpasswd fi diff --git a/runtimes/8.1/start-container b/runtimes/8.1/start-container index 7593ee73..8fbe2ea8 100644 --- a/runtimes/8.1/start-container +++ b/runtimes/8.1/start-container @@ -9,7 +9,7 @@ if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi -if [ ! -z "$SSH_PASSWORD"]; then +if [ ! -z "$SSH_PASSWORD" ]; then echo "sail:$SSH_PASSWORD" | chpasswd fi diff --git a/runtimes/8.2/start-container b/runtimes/8.2/start-container index 7593ee73..8fbe2ea8 100644 --- a/runtimes/8.2/start-container +++ b/runtimes/8.2/start-container @@ -9,7 +9,7 @@ if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi -if [ ! -z "$SSH_PASSWORD"]; then +if [ ! -z "$SSH_PASSWORD" ]; then echo "sail:$SSH_PASSWORD" | chpasswd fi diff --git a/runtimes/8.3/start-container b/runtimes/8.3/start-container index 7593ee73..8fbe2ea8 100644 --- a/runtimes/8.3/start-container +++ b/runtimes/8.3/start-container @@ -9,7 +9,7 @@ if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi -if [ ! -z "$SSH_PASSWORD"]; then +if [ ! -z "$SSH_PASSWORD" ]; then echo "sail:$SSH_PASSWORD" | chpasswd fi diff --git a/runtimes/8.4/start-container b/runtimes/8.4/start-container index 7593ee73..8fbe2ea8 100644 --- a/runtimes/8.4/start-container +++ b/runtimes/8.4/start-container @@ -9,7 +9,7 @@ if [ ! -z "$WWWUSER" ]; then usermod -u $WWWUSER sail fi -if [ ! -z "$SSH_PASSWORD"]; then +if [ ! -z "$SSH_PASSWORD" ]; then echo "sail:$SSH_PASSWORD" | chpasswd fi From 993800bf182d2431003f92656a29d9260ff533b7 Mon Sep 17 00:00:00 2001 From: Italo Israel Baeza Cabrera Date: Sat, 30 Nov 2024 02:23:36 -0300 Subject: [PATCH 5/5] Removes default password. --- stubs/docker-compose.stub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/docker-compose.stub b/stubs/docker-compose.stub index c29fdaa8..eee7c78f 100644 --- a/stubs/docker-compose.stub +++ b/stubs/docker-compose.stub @@ -14,7 +14,7 @@ services: - '${APP_PORT:-80}:80' - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' environment: - # SSH_PASSWORD: 'sail' + # SSH_PASSWORD: WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'