From c18d0b1f44819b92ed97863e68292e063d30e3b9 Mon Sep 17 00:00:00 2001 From: Adam Vest Date: Fri, 15 Nov 2024 23:52:22 -0500 Subject: [PATCH] Enable TLS connection for Redis Signed-off-by: Adam Vest --- 28/apache/config/redis.config.php | 2 +- 28/apache/entrypoint.sh | 4 ++-- 28/fpm-alpine/config/redis.config.php | 2 +- 28/fpm-alpine/entrypoint.sh | 4 ++-- 28/fpm/config/redis.config.php | 2 +- 28/fpm/entrypoint.sh | 4 ++-- 29/apache/config/redis.config.php | 2 +- 29/apache/entrypoint.sh | 4 ++-- 29/fpm-alpine/config/redis.config.php | 2 +- 29/fpm-alpine/entrypoint.sh | 4 ++-- 29/fpm/config/redis.config.php | 2 +- 29/fpm/entrypoint.sh | 4 ++-- 30/apache/config/redis.config.php | 2 +- 30/apache/entrypoint.sh | 4 ++-- 30/fpm-alpine/config/redis.config.php | 2 +- 30/fpm-alpine/entrypoint.sh | 4 ++-- 30/fpm/config/redis.config.php | 2 +- 30/fpm/entrypoint.sh | 4 ++-- docker-entrypoint.sh | 4 ++-- 19 files changed, 29 insertions(+), 29 deletions(-) diff --git a/28/apache/config/redis.config.php b/28/apache/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/28/apache/config/redis.config.php +++ b/28/apache/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/28/apache/entrypoint.sh b/28/apache/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/28/apache/entrypoint.sh +++ b/28/apache/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/28/fpm-alpine/config/redis.config.php b/28/fpm-alpine/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/28/fpm-alpine/config/redis.config.php +++ b/28/fpm-alpine/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/28/fpm-alpine/entrypoint.sh b/28/fpm-alpine/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/28/fpm-alpine/entrypoint.sh +++ b/28/fpm-alpine/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/28/fpm/config/redis.config.php b/28/fpm/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/28/fpm/config/redis.config.php +++ b/28/fpm/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/28/fpm/entrypoint.sh b/28/fpm/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/28/fpm/entrypoint.sh +++ b/28/fpm/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/29/apache/config/redis.config.php b/29/apache/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/29/apache/config/redis.config.php +++ b/29/apache/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/29/apache/entrypoint.sh b/29/apache/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/29/apache/entrypoint.sh +++ b/29/apache/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/29/fpm-alpine/config/redis.config.php b/29/fpm-alpine/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/29/fpm-alpine/config/redis.config.php +++ b/29/fpm-alpine/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/29/fpm-alpine/entrypoint.sh b/29/fpm-alpine/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/29/fpm-alpine/entrypoint.sh +++ b/29/fpm-alpine/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/29/fpm/config/redis.config.php b/29/fpm/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/29/fpm/config/redis.config.php +++ b/29/fpm/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/29/fpm/entrypoint.sh b/29/fpm/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/29/fpm/entrypoint.sh +++ b/29/fpm/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/30/apache/config/redis.config.php b/30/apache/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/30/apache/config/redis.config.php +++ b/30/apache/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/30/apache/entrypoint.sh b/30/apache/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/30/apache/entrypoint.sh +++ b/30/apache/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/30/fpm-alpine/config/redis.config.php b/30/fpm-alpine/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/30/fpm-alpine/config/redis.config.php +++ b/30/fpm-alpine/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/30/fpm-alpine/entrypoint.sh b/30/fpm-alpine/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/30/fpm-alpine/entrypoint.sh +++ b/30/fpm-alpine/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/30/fpm/config/redis.config.php b/30/fpm/config/redis.config.php index a5b13da6f..f90499245 100644 --- a/30/fpm/config/redis.config.php +++ b/30/fpm/config/redis.config.php @@ -4,7 +4,7 @@ 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( - 'host' => getenv('REDIS_HOST'), + 'host' => ($_ENV['REDIS_PROTOCOL'] ?? 'tcp') . "://" . getenv('REDIS_HOST'), 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/30/fpm/entrypoint.sh b/30/fpm/entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/30/fpm/entrypoint.sh +++ b/30/fpm/entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8e178f2ec..ab4e94889 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -120,9 +120,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP fi # check if redis password has been set elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" else - echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" + echo "session.save_path = \"${REDIS_PROTOCOL:=tcp}://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" fi echo "redis.session.locking_enabled = 1" echo "redis.session.lock_retries = -1"