From bb70a4685815832a6663cd00e8fb042a26aa5459 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sat, 11 Mar 2023 16:35:36 +0100 Subject: [PATCH] Add back a /sessions volume for sessions persistence Ref: #274 Ref: #198 --- Dockerfile-alpine.template | 5 +++++ Dockerfile-debian.template | 5 +++++ README.md | 8 ++++++++ apache/Dockerfile | 5 +++++ fpm-alpine/Dockerfile | 5 +++++ fpm/Dockerfile | 5 +++++ testing/phpmyadmin_test.py | 3 ++- 7 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 4059e79b..d733d3e1 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -41,6 +41,7 @@ RUN set -ex; \ ENV MAX_EXECUTION_TIME 600 ENV MEMORY_LIMIT 512M ENV UPLOAD_LIMIT 2048K +ENV SESSION_SAVE_PATH /sessions RUN set -ex; \ \ { \ @@ -63,6 +64,7 @@ RUN set -ex; \ echo 'memory_limit=${MEMORY_LIMIT}'; \ echo 'post_max_size=${UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \ + echo 'session.save_path=${SESSION_SAVE_PATH}'; \ } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini # Calculate download URL @@ -85,6 +87,9 @@ RUN set -ex; \ apk add --no-cache --virtual .fetch-deps \ gnupg \ ; \ + mkdir $SESSION_SAVE_PATH; \ + chmod 1777 $SESSION_SAVE_PATH; \ + chown www-data:www-data $SESSION_SAVE_PATH; \ \ export GNUPGHOME="$(mktemp -d)"; \ export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 1a49357c..f3d73a22 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -43,6 +43,7 @@ RUN set -ex; \ ENV MAX_EXECUTION_TIME 600 ENV MEMORY_LIMIT 512M ENV UPLOAD_LIMIT 2048K +ENV SESSION_SAVE_PATH /sessions RUN set -ex; \ \ { \ @@ -65,6 +66,7 @@ RUN set -ex; \ echo 'memory_limit=${MEMORY_LIMIT}'; \ echo 'post_max_size=${UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \ + echo 'session.save_path=${SESSION_SAVE_PATH}'; \ } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini # Calculate download URL @@ -92,6 +94,9 @@ RUN set -ex; \ gnupg \ dirmngr \ ; \ + mkdir $SESSION_SAVE_PATH; \ + chmod 1777 $SESSION_SAVE_PATH; \ + chown www-data:www-data $SESSION_SAVE_PATH; \ \ export GNUPGHOME="$(mktemp -d)"; \ export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ diff --git a/README.md b/README.md index c7ab7643..0f371f78 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,14 @@ See the following links for config file information: Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma.example.net/``) where the reverse proxy makes phpMyAdmin available. +## Sessions persistence + +In order to keep your sessions active between container updates you will need to mount the `/sessions` folder. + +```sh +-v /some/local/directory/sessions:/sessions:rw +``` + ## Environment variables summary * ``PMA_ARBITRARY`` - when set to 1 connection to the arbitrary server will be allowed diff --git a/apache/Dockerfile b/apache/Dockerfile index 43e416fd..130916c2 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -43,6 +43,7 @@ RUN set -ex; \ ENV MAX_EXECUTION_TIME 600 ENV MEMORY_LIMIT 512M ENV UPLOAD_LIMIT 2048K +ENV SESSION_SAVE_PATH /sessions RUN set -ex; \ \ { \ @@ -65,6 +66,7 @@ RUN set -ex; \ echo 'memory_limit=${MEMORY_LIMIT}'; \ echo 'post_max_size=${UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \ + echo 'session.save_path=${SESSION_SAVE_PATH}'; \ } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini # Calculate download URL @@ -92,6 +94,9 @@ RUN set -ex; \ gnupg \ dirmngr \ ; \ + mkdir $SESSION_SAVE_PATH; \ + chmod 1777 $SESSION_SAVE_PATH; \ + chown www-data:www-data $SESSION_SAVE_PATH; \ \ export GNUPGHOME="$(mktemp -d)"; \ export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ diff --git a/fpm-alpine/Dockerfile b/fpm-alpine/Dockerfile index 6fa851cf..14645593 100644 --- a/fpm-alpine/Dockerfile +++ b/fpm-alpine/Dockerfile @@ -41,6 +41,7 @@ RUN set -ex; \ ENV MAX_EXECUTION_TIME 600 ENV MEMORY_LIMIT 512M ENV UPLOAD_LIMIT 2048K +ENV SESSION_SAVE_PATH /sessions RUN set -ex; \ \ { \ @@ -63,6 +64,7 @@ RUN set -ex; \ echo 'memory_limit=${MEMORY_LIMIT}'; \ echo 'post_max_size=${UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \ + echo 'session.save_path=${SESSION_SAVE_PATH}'; \ } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini # Calculate download URL @@ -85,6 +87,9 @@ RUN set -ex; \ apk add --no-cache --virtual .fetch-deps \ gnupg \ ; \ + mkdir $SESSION_SAVE_PATH; \ + chmod 1777 $SESSION_SAVE_PATH; \ + chown www-data:www-data $SESSION_SAVE_PATH; \ \ export GNUPGHOME="$(mktemp -d)"; \ export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ diff --git a/fpm/Dockerfile b/fpm/Dockerfile index 19885a68..68823295 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -43,6 +43,7 @@ RUN set -ex; \ ENV MAX_EXECUTION_TIME 600 ENV MEMORY_LIMIT 512M ENV UPLOAD_LIMIT 2048K +ENV SESSION_SAVE_PATH /sessions RUN set -ex; \ \ { \ @@ -65,6 +66,7 @@ RUN set -ex; \ echo 'memory_limit=${MEMORY_LIMIT}'; \ echo 'post_max_size=${UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \ + echo 'session.save_path=${SESSION_SAVE_PATH}'; \ } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini # Calculate download URL @@ -92,6 +94,9 @@ RUN set -ex; \ gnupg \ dirmngr \ ; \ + mkdir $SESSION_SAVE_PATH; \ + chmod 1777 $SESSION_SAVE_PATH; \ + chown www-data:www-data $SESSION_SAVE_PATH; \ \ export GNUPGHOME="$(mktemp -d)"; \ export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ diff --git a/testing/phpmyadmin_test.py b/testing/phpmyadmin_test.py index 26436ed4..5b78136e 100755 --- a/testing/phpmyadmin_test.py +++ b/testing/phpmyadmin_test.py @@ -104,6 +104,7 @@ def test_php_ini(url, username, password, server): assert(b'upload_max_filesize' in response) assert(b'post_max_size' in response) assert(b'expose_php' in response) + assert(b'session.save_path' in response) assert(b'max_execution_time125125' in response) @@ -111,7 +112,7 @@ def test_php_ini(url, username, password, server): assert(b'post_max_size123M123M' in response) assert(b'expose_phpOffOff' in response) - + assert(b'session.save_path/sessions/sessions' in response) def test_import_from_folder(url, username, password, server, sqlfile): upload_dir = os.environ.get('PMA_UPLOADDIR');