From 3ada56d44469f26a0081ab35ae8dc9800e54b8f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Pecchia?= <179218+mabeett@users.noreply.github.com> Date: Sun, 18 Aug 2024 22:21:05 +0200 Subject: [PATCH 1/4] Secrets handling via entrypoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Secrets files handled only in the entrypoint, converted during initial execuition. Solves #1148 Signed-off-by: Matías Pecchia <179218+mabeett@users.noreply.github.com> --- .config/autoconfig.php | 14 -------------- .config/redis.config.php | 2 +- .config/s3.config.php | 12 +++--------- .config/smtp.config.php | 6 ++---- 28/apache/config/autoconfig.php | 14 -------------- 28/apache/config/redis.config.php | 2 +- 28/apache/config/s3.config.php | 12 +++--------- 28/apache/config/smtp.config.php | 6 ++---- 28/apache/entrypoint.sh | 27 ++++++++++++++++++++++----- 28/fpm-alpine/config/autoconfig.php | 14 -------------- 28/fpm-alpine/config/redis.config.php | 2 +- 28/fpm-alpine/config/s3.config.php | 12 +++--------- 28/fpm-alpine/config/smtp.config.php | 6 ++---- 28/fpm-alpine/entrypoint.sh | 27 ++++++++++++++++++++++----- 28/fpm/config/autoconfig.php | 14 -------------- 28/fpm/config/redis.config.php | 2 +- 28/fpm/config/s3.config.php | 12 +++--------- 28/fpm/config/smtp.config.php | 6 ++---- 28/fpm/entrypoint.sh | 27 ++++++++++++++++++++++----- 29/apache/config/autoconfig.php | 14 -------------- 29/apache/config/redis.config.php | 2 +- 29/apache/config/s3.config.php | 12 +++--------- 29/apache/config/smtp.config.php | 6 ++---- 29/apache/entrypoint.sh | 27 ++++++++++++++++++++++----- 29/fpm-alpine/config/autoconfig.php | 14 -------------- 29/fpm-alpine/config/redis.config.php | 2 +- 29/fpm-alpine/config/s3.config.php | 12 +++--------- 29/fpm-alpine/config/smtp.config.php | 6 ++---- 29/fpm-alpine/entrypoint.sh | 27 ++++++++++++++++++++++----- 29/fpm/config/autoconfig.php | 14 -------------- 29/fpm/config/redis.config.php | 2 +- 29/fpm/config/s3.config.php | 12 +++--------- 29/fpm/config/smtp.config.php | 6 ++---- 29/fpm/entrypoint.sh | 27 ++++++++++++++++++++++----- docker-entrypoint.sh | 27 ++++++++++++++++++++++----- 35 files changed, 196 insertions(+), 231 deletions(-) diff --git a/.config/autoconfig.php b/.config/autoconfig.php index 92ad2a1c..f01f18d6 100644 --- a/.config/autoconfig.php +++ b/.config/autoconfig.php @@ -6,13 +6,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbtype'] = 'sqlite'; $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE'); $autoconfig_enabled = true; -} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) { - $AUTOCONFIG['dbtype'] = 'mysql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); - $autoconfig_enabled = true; } elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) { $AUTOCONFIG['dbtype'] = 'mysql'; $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE'); @@ -20,13 +13,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD'); $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); $autoconfig_enabled = true; -} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) { - $AUTOCONFIG['dbtype'] = 'pgsql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST'); - $autoconfig_enabled = true; } elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) { $AUTOCONFIG['dbtype'] = 'pgsql'; $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB'); diff --git a/.config/redis.config.php b/.config/redis.config.php index a5b13da6..a5fde3c7 100644 --- a/.config/redis.config.php +++ b/.config/redis.config.php @@ -5,7 +5,7 @@ if (getenv('REDIS_HOST')) { 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( 'host' => getenv('REDIS_HOST'), - 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + 'password' => (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/.config/s3.config.php b/.config/s3.config.php index 9941c562..b7dabf32 100644 --- a/.config/s3.config.php +++ b/.config/s3.config.php @@ -24,25 +24,19 @@ if (getenv('OBJECTSTORE_S3_BUCKET')) { ) ); - if (getenv('OBJECTSTORE_S3_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_KEY')) { + if (getenv('OBJECTSTORE_S3_KEY')) { $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY'); } else { $CONFIG['objectstore']['arguments']['key'] = ''; } - if (getenv('OBJECTSTORE_S3_SECRET_FILE')) { - $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SECRET')) { + if (getenv('OBJECTSTORE_S3_SECRET')) { $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET'); } else { $CONFIG['objectstore']['arguments']['secret'] = ''; } - if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { + if (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY'); } } diff --git a/.config/smtp.config.php b/.config/smtp.config.php index 66a2ef7e..40cfdf94 100644 --- a/.config/smtp.config.php +++ b/.config/smtp.config.php @@ -5,16 +5,14 @@ if (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) 'mail_smtphost' => getenv('SMTP_HOST'), 'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25), 'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '', - 'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')), + 'mail_smtpauth' => getenv('SMTP_NAME') && getenv('SMTP_PASSWORD'), 'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN', 'mail_smtpname' => getenv('SMTP_NAME') ?: '', 'mail_from_address' => getenv('MAIL_FROM_ADDRESS'), 'mail_domain' => getenv('MAIL_DOMAIN'), ); - if (getenv('SMTP_PASSWORD_FILE')) { - $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE'))); - } elseif (getenv('SMTP_PASSWORD')) { + if (getenv('SMTP_PASSWORD')) { $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD'); } else { $CONFIG['mail_smtppassword'] = ''; diff --git a/28/apache/config/autoconfig.php b/28/apache/config/autoconfig.php index 92ad2a1c..f01f18d6 100644 --- a/28/apache/config/autoconfig.php +++ b/28/apache/config/autoconfig.php @@ -6,13 +6,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbtype'] = 'sqlite'; $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE'); $autoconfig_enabled = true; -} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) { - $AUTOCONFIG['dbtype'] = 'mysql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); - $autoconfig_enabled = true; } elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) { $AUTOCONFIG['dbtype'] = 'mysql'; $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE'); @@ -20,13 +13,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD'); $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); $autoconfig_enabled = true; -} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) { - $AUTOCONFIG['dbtype'] = 'pgsql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST'); - $autoconfig_enabled = true; } elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) { $AUTOCONFIG['dbtype'] = 'pgsql'; $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB'); diff --git a/28/apache/config/redis.config.php b/28/apache/config/redis.config.php index a5b13da6..a5fde3c7 100644 --- a/28/apache/config/redis.config.php +++ b/28/apache/config/redis.config.php @@ -5,7 +5,7 @@ if (getenv('REDIS_HOST')) { 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( 'host' => getenv('REDIS_HOST'), - 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + 'password' => (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/28/apache/config/s3.config.php b/28/apache/config/s3.config.php index 9941c562..b7dabf32 100644 --- a/28/apache/config/s3.config.php +++ b/28/apache/config/s3.config.php @@ -24,25 +24,19 @@ if (getenv('OBJECTSTORE_S3_BUCKET')) { ) ); - if (getenv('OBJECTSTORE_S3_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_KEY')) { + if (getenv('OBJECTSTORE_S3_KEY')) { $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY'); } else { $CONFIG['objectstore']['arguments']['key'] = ''; } - if (getenv('OBJECTSTORE_S3_SECRET_FILE')) { - $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SECRET')) { + if (getenv('OBJECTSTORE_S3_SECRET')) { $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET'); } else { $CONFIG['objectstore']['arguments']['secret'] = ''; } - if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { + if (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY'); } } diff --git a/28/apache/config/smtp.config.php b/28/apache/config/smtp.config.php index 66a2ef7e..40cfdf94 100644 --- a/28/apache/config/smtp.config.php +++ b/28/apache/config/smtp.config.php @@ -5,16 +5,14 @@ if (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) 'mail_smtphost' => getenv('SMTP_HOST'), 'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25), 'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '', - 'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')), + 'mail_smtpauth' => getenv('SMTP_NAME') && getenv('SMTP_PASSWORD'), 'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN', 'mail_smtpname' => getenv('SMTP_NAME') ?: '', 'mail_from_address' => getenv('MAIL_FROM_ADDRESS'), 'mail_domain' => getenv('MAIL_DOMAIN'), ); - if (getenv('SMTP_PASSWORD_FILE')) { - $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE'))); - } elseif (getenv('SMTP_PASSWORD')) { + if (getenv('SMTP_PASSWORD')) { $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD'); } else { $CONFIG['mail_smtppassword'] = ''; diff --git a/28/apache/entrypoint.sh b/28/apache/entrypoint.sh index 4e06fcc4..f925a7ee 100755 --- a/28/apache/entrypoint.sh +++ b/28/apache/entrypoint.sh @@ -63,14 +63,16 @@ file_env() { local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 + echo "Warning: both $var and $fileVar are set ($fileVar takes precedence)" fi - if [ -n "${varValue}" ]; then - export "$var"="${varValue}" - elif [ -n "${fileVarValue}" ]; then + if [ -n "${fileVarValue}" ]; then + echo "note: taking ${fileVar} file for ${var} value" export "$var"="$(cat "${fileVarValue}")" + elif [ -n "${varValue}" ]; then + echo "note: using ${var} variable for ${var} value" + export "$var"="${varValue}" elif [ -n "${def}" ]; then + echo "note: using invoked definition for ${var} value" export "$var"="$def" fi unset "$fileVar" @@ -82,6 +84,21 @@ if expr "$1" : "apache" 1>/dev/null; then fi fi +# All possible content secrets to variable +file_env NEXTCLOUD_ADMIN_PASSWORD +file_env NEXTCLOUD_ADMIN_USER +file_env MYSQL_DATABASE +file_env MYSQL_PASSWORD +file_env MYSQL_USER +file_env POSTGRES_DB +file_env POSTGRES_PASSWORD +file_env POSTGRES_USER +file_env REDIS_HOST_PASSWORD +file_env SMTP_PASSWORD +file_env OBJECTSTORE_S3_KEY +file_env OBJECTSTORE_S3_SECRET +file_env OBJECTSTORE_S3_SSE_C_KEY + if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then uid="$(id -u)" gid="$(id -g)" diff --git a/28/fpm-alpine/config/autoconfig.php b/28/fpm-alpine/config/autoconfig.php index 92ad2a1c..f01f18d6 100644 --- a/28/fpm-alpine/config/autoconfig.php +++ b/28/fpm-alpine/config/autoconfig.php @@ -6,13 +6,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbtype'] = 'sqlite'; $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE'); $autoconfig_enabled = true; -} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) { - $AUTOCONFIG['dbtype'] = 'mysql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); - $autoconfig_enabled = true; } elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) { $AUTOCONFIG['dbtype'] = 'mysql'; $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE'); @@ -20,13 +13,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD'); $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); $autoconfig_enabled = true; -} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) { - $AUTOCONFIG['dbtype'] = 'pgsql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST'); - $autoconfig_enabled = true; } elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) { $AUTOCONFIG['dbtype'] = 'pgsql'; $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB'); diff --git a/28/fpm-alpine/config/redis.config.php b/28/fpm-alpine/config/redis.config.php index a5b13da6..a5fde3c7 100644 --- a/28/fpm-alpine/config/redis.config.php +++ b/28/fpm-alpine/config/redis.config.php @@ -5,7 +5,7 @@ if (getenv('REDIS_HOST')) { 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( 'host' => getenv('REDIS_HOST'), - 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + 'password' => (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/28/fpm-alpine/config/s3.config.php b/28/fpm-alpine/config/s3.config.php index 9941c562..b7dabf32 100644 --- a/28/fpm-alpine/config/s3.config.php +++ b/28/fpm-alpine/config/s3.config.php @@ -24,25 +24,19 @@ if (getenv('OBJECTSTORE_S3_BUCKET')) { ) ); - if (getenv('OBJECTSTORE_S3_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_KEY')) { + if (getenv('OBJECTSTORE_S3_KEY')) { $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY'); } else { $CONFIG['objectstore']['arguments']['key'] = ''; } - if (getenv('OBJECTSTORE_S3_SECRET_FILE')) { - $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SECRET')) { + if (getenv('OBJECTSTORE_S3_SECRET')) { $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET'); } else { $CONFIG['objectstore']['arguments']['secret'] = ''; } - if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { + if (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY'); } } diff --git a/28/fpm-alpine/config/smtp.config.php b/28/fpm-alpine/config/smtp.config.php index 66a2ef7e..40cfdf94 100644 --- a/28/fpm-alpine/config/smtp.config.php +++ b/28/fpm-alpine/config/smtp.config.php @@ -5,16 +5,14 @@ if (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) 'mail_smtphost' => getenv('SMTP_HOST'), 'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25), 'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '', - 'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')), + 'mail_smtpauth' => getenv('SMTP_NAME') && getenv('SMTP_PASSWORD'), 'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN', 'mail_smtpname' => getenv('SMTP_NAME') ?: '', 'mail_from_address' => getenv('MAIL_FROM_ADDRESS'), 'mail_domain' => getenv('MAIL_DOMAIN'), ); - if (getenv('SMTP_PASSWORD_FILE')) { - $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE'))); - } elseif (getenv('SMTP_PASSWORD')) { + if (getenv('SMTP_PASSWORD')) { $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD'); } else { $CONFIG['mail_smtppassword'] = ''; diff --git a/28/fpm-alpine/entrypoint.sh b/28/fpm-alpine/entrypoint.sh index 4e06fcc4..f925a7ee 100755 --- a/28/fpm-alpine/entrypoint.sh +++ b/28/fpm-alpine/entrypoint.sh @@ -63,14 +63,16 @@ file_env() { local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 + echo "Warning: both $var and $fileVar are set ($fileVar takes precedence)" fi - if [ -n "${varValue}" ]; then - export "$var"="${varValue}" - elif [ -n "${fileVarValue}" ]; then + if [ -n "${fileVarValue}" ]; then + echo "note: taking ${fileVar} file for ${var} value" export "$var"="$(cat "${fileVarValue}")" + elif [ -n "${varValue}" ]; then + echo "note: using ${var} variable for ${var} value" + export "$var"="${varValue}" elif [ -n "${def}" ]; then + echo "note: using invoked definition for ${var} value" export "$var"="$def" fi unset "$fileVar" @@ -82,6 +84,21 @@ if expr "$1" : "apache" 1>/dev/null; then fi fi +# All possible content secrets to variable +file_env NEXTCLOUD_ADMIN_PASSWORD +file_env NEXTCLOUD_ADMIN_USER +file_env MYSQL_DATABASE +file_env MYSQL_PASSWORD +file_env MYSQL_USER +file_env POSTGRES_DB +file_env POSTGRES_PASSWORD +file_env POSTGRES_USER +file_env REDIS_HOST_PASSWORD +file_env SMTP_PASSWORD +file_env OBJECTSTORE_S3_KEY +file_env OBJECTSTORE_S3_SECRET +file_env OBJECTSTORE_S3_SSE_C_KEY + if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then uid="$(id -u)" gid="$(id -g)" diff --git a/28/fpm/config/autoconfig.php b/28/fpm/config/autoconfig.php index 92ad2a1c..f01f18d6 100644 --- a/28/fpm/config/autoconfig.php +++ b/28/fpm/config/autoconfig.php @@ -6,13 +6,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbtype'] = 'sqlite'; $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE'); $autoconfig_enabled = true; -} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) { - $AUTOCONFIG['dbtype'] = 'mysql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); - $autoconfig_enabled = true; } elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) { $AUTOCONFIG['dbtype'] = 'mysql'; $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE'); @@ -20,13 +13,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD'); $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); $autoconfig_enabled = true; -} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) { - $AUTOCONFIG['dbtype'] = 'pgsql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST'); - $autoconfig_enabled = true; } elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) { $AUTOCONFIG['dbtype'] = 'pgsql'; $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB'); diff --git a/28/fpm/config/redis.config.php b/28/fpm/config/redis.config.php index a5b13da6..a5fde3c7 100644 --- a/28/fpm/config/redis.config.php +++ b/28/fpm/config/redis.config.php @@ -5,7 +5,7 @@ if (getenv('REDIS_HOST')) { 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( 'host' => getenv('REDIS_HOST'), - 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + 'password' => (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/28/fpm/config/s3.config.php b/28/fpm/config/s3.config.php index 9941c562..b7dabf32 100644 --- a/28/fpm/config/s3.config.php +++ b/28/fpm/config/s3.config.php @@ -24,25 +24,19 @@ if (getenv('OBJECTSTORE_S3_BUCKET')) { ) ); - if (getenv('OBJECTSTORE_S3_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_KEY')) { + if (getenv('OBJECTSTORE_S3_KEY')) { $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY'); } else { $CONFIG['objectstore']['arguments']['key'] = ''; } - if (getenv('OBJECTSTORE_S3_SECRET_FILE')) { - $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SECRET')) { + if (getenv('OBJECTSTORE_S3_SECRET')) { $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET'); } else { $CONFIG['objectstore']['arguments']['secret'] = ''; } - if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { + if (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY'); } } diff --git a/28/fpm/config/smtp.config.php b/28/fpm/config/smtp.config.php index 66a2ef7e..40cfdf94 100644 --- a/28/fpm/config/smtp.config.php +++ b/28/fpm/config/smtp.config.php @@ -5,16 +5,14 @@ if (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) 'mail_smtphost' => getenv('SMTP_HOST'), 'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25), 'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '', - 'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')), + 'mail_smtpauth' => getenv('SMTP_NAME') && getenv('SMTP_PASSWORD'), 'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN', 'mail_smtpname' => getenv('SMTP_NAME') ?: '', 'mail_from_address' => getenv('MAIL_FROM_ADDRESS'), 'mail_domain' => getenv('MAIL_DOMAIN'), ); - if (getenv('SMTP_PASSWORD_FILE')) { - $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE'))); - } elseif (getenv('SMTP_PASSWORD')) { + if (getenv('SMTP_PASSWORD')) { $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD'); } else { $CONFIG['mail_smtppassword'] = ''; diff --git a/28/fpm/entrypoint.sh b/28/fpm/entrypoint.sh index 4e06fcc4..f925a7ee 100755 --- a/28/fpm/entrypoint.sh +++ b/28/fpm/entrypoint.sh @@ -63,14 +63,16 @@ file_env() { local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 + echo "Warning: both $var and $fileVar are set ($fileVar takes precedence)" fi - if [ -n "${varValue}" ]; then - export "$var"="${varValue}" - elif [ -n "${fileVarValue}" ]; then + if [ -n "${fileVarValue}" ]; then + echo "note: taking ${fileVar} file for ${var} value" export "$var"="$(cat "${fileVarValue}")" + elif [ -n "${varValue}" ]; then + echo "note: using ${var} variable for ${var} value" + export "$var"="${varValue}" elif [ -n "${def}" ]; then + echo "note: using invoked definition for ${var} value" export "$var"="$def" fi unset "$fileVar" @@ -82,6 +84,21 @@ if expr "$1" : "apache" 1>/dev/null; then fi fi +# All possible content secrets to variable +file_env NEXTCLOUD_ADMIN_PASSWORD +file_env NEXTCLOUD_ADMIN_USER +file_env MYSQL_DATABASE +file_env MYSQL_PASSWORD +file_env MYSQL_USER +file_env POSTGRES_DB +file_env POSTGRES_PASSWORD +file_env POSTGRES_USER +file_env REDIS_HOST_PASSWORD +file_env SMTP_PASSWORD +file_env OBJECTSTORE_S3_KEY +file_env OBJECTSTORE_S3_SECRET +file_env OBJECTSTORE_S3_SSE_C_KEY + if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then uid="$(id -u)" gid="$(id -g)" diff --git a/29/apache/config/autoconfig.php b/29/apache/config/autoconfig.php index 92ad2a1c..f01f18d6 100644 --- a/29/apache/config/autoconfig.php +++ b/29/apache/config/autoconfig.php @@ -6,13 +6,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbtype'] = 'sqlite'; $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE'); $autoconfig_enabled = true; -} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) { - $AUTOCONFIG['dbtype'] = 'mysql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); - $autoconfig_enabled = true; } elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) { $AUTOCONFIG['dbtype'] = 'mysql'; $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE'); @@ -20,13 +13,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD'); $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); $autoconfig_enabled = true; -} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) { - $AUTOCONFIG['dbtype'] = 'pgsql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST'); - $autoconfig_enabled = true; } elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) { $AUTOCONFIG['dbtype'] = 'pgsql'; $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB'); diff --git a/29/apache/config/redis.config.php b/29/apache/config/redis.config.php index a5b13da6..a5fde3c7 100644 --- a/29/apache/config/redis.config.php +++ b/29/apache/config/redis.config.php @@ -5,7 +5,7 @@ if (getenv('REDIS_HOST')) { 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( 'host' => getenv('REDIS_HOST'), - 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + 'password' => (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/29/apache/config/s3.config.php b/29/apache/config/s3.config.php index 9941c562..b7dabf32 100644 --- a/29/apache/config/s3.config.php +++ b/29/apache/config/s3.config.php @@ -24,25 +24,19 @@ if (getenv('OBJECTSTORE_S3_BUCKET')) { ) ); - if (getenv('OBJECTSTORE_S3_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_KEY')) { + if (getenv('OBJECTSTORE_S3_KEY')) { $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY'); } else { $CONFIG['objectstore']['arguments']['key'] = ''; } - if (getenv('OBJECTSTORE_S3_SECRET_FILE')) { - $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SECRET')) { + if (getenv('OBJECTSTORE_S3_SECRET')) { $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET'); } else { $CONFIG['objectstore']['arguments']['secret'] = ''; } - if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { + if (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY'); } } diff --git a/29/apache/config/smtp.config.php b/29/apache/config/smtp.config.php index 66a2ef7e..40cfdf94 100644 --- a/29/apache/config/smtp.config.php +++ b/29/apache/config/smtp.config.php @@ -5,16 +5,14 @@ if (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) 'mail_smtphost' => getenv('SMTP_HOST'), 'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25), 'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '', - 'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')), + 'mail_smtpauth' => getenv('SMTP_NAME') && getenv('SMTP_PASSWORD'), 'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN', 'mail_smtpname' => getenv('SMTP_NAME') ?: '', 'mail_from_address' => getenv('MAIL_FROM_ADDRESS'), 'mail_domain' => getenv('MAIL_DOMAIN'), ); - if (getenv('SMTP_PASSWORD_FILE')) { - $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE'))); - } elseif (getenv('SMTP_PASSWORD')) { + if (getenv('SMTP_PASSWORD')) { $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD'); } else { $CONFIG['mail_smtppassword'] = ''; diff --git a/29/apache/entrypoint.sh b/29/apache/entrypoint.sh index 4e06fcc4..f925a7ee 100755 --- a/29/apache/entrypoint.sh +++ b/29/apache/entrypoint.sh @@ -63,14 +63,16 @@ file_env() { local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 + echo "Warning: both $var and $fileVar are set ($fileVar takes precedence)" fi - if [ -n "${varValue}" ]; then - export "$var"="${varValue}" - elif [ -n "${fileVarValue}" ]; then + if [ -n "${fileVarValue}" ]; then + echo "note: taking ${fileVar} file for ${var} value" export "$var"="$(cat "${fileVarValue}")" + elif [ -n "${varValue}" ]; then + echo "note: using ${var} variable for ${var} value" + export "$var"="${varValue}" elif [ -n "${def}" ]; then + echo "note: using invoked definition for ${var} value" export "$var"="$def" fi unset "$fileVar" @@ -82,6 +84,21 @@ if expr "$1" : "apache" 1>/dev/null; then fi fi +# All possible content secrets to variable +file_env NEXTCLOUD_ADMIN_PASSWORD +file_env NEXTCLOUD_ADMIN_USER +file_env MYSQL_DATABASE +file_env MYSQL_PASSWORD +file_env MYSQL_USER +file_env POSTGRES_DB +file_env POSTGRES_PASSWORD +file_env POSTGRES_USER +file_env REDIS_HOST_PASSWORD +file_env SMTP_PASSWORD +file_env OBJECTSTORE_S3_KEY +file_env OBJECTSTORE_S3_SECRET +file_env OBJECTSTORE_S3_SSE_C_KEY + if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then uid="$(id -u)" gid="$(id -g)" diff --git a/29/fpm-alpine/config/autoconfig.php b/29/fpm-alpine/config/autoconfig.php index 92ad2a1c..f01f18d6 100644 --- a/29/fpm-alpine/config/autoconfig.php +++ b/29/fpm-alpine/config/autoconfig.php @@ -6,13 +6,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbtype'] = 'sqlite'; $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE'); $autoconfig_enabled = true; -} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) { - $AUTOCONFIG['dbtype'] = 'mysql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); - $autoconfig_enabled = true; } elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) { $AUTOCONFIG['dbtype'] = 'mysql'; $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE'); @@ -20,13 +13,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD'); $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); $autoconfig_enabled = true; -} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) { - $AUTOCONFIG['dbtype'] = 'pgsql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST'); - $autoconfig_enabled = true; } elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) { $AUTOCONFIG['dbtype'] = 'pgsql'; $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB'); diff --git a/29/fpm-alpine/config/redis.config.php b/29/fpm-alpine/config/redis.config.php index a5b13da6..a5fde3c7 100644 --- a/29/fpm-alpine/config/redis.config.php +++ b/29/fpm-alpine/config/redis.config.php @@ -5,7 +5,7 @@ if (getenv('REDIS_HOST')) { 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( 'host' => getenv('REDIS_HOST'), - 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + 'password' => (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/29/fpm-alpine/config/s3.config.php b/29/fpm-alpine/config/s3.config.php index 9941c562..b7dabf32 100644 --- a/29/fpm-alpine/config/s3.config.php +++ b/29/fpm-alpine/config/s3.config.php @@ -24,25 +24,19 @@ if (getenv('OBJECTSTORE_S3_BUCKET')) { ) ); - if (getenv('OBJECTSTORE_S3_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_KEY')) { + if (getenv('OBJECTSTORE_S3_KEY')) { $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY'); } else { $CONFIG['objectstore']['arguments']['key'] = ''; } - if (getenv('OBJECTSTORE_S3_SECRET_FILE')) { - $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SECRET')) { + if (getenv('OBJECTSTORE_S3_SECRET')) { $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET'); } else { $CONFIG['objectstore']['arguments']['secret'] = ''; } - if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { + if (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY'); } } diff --git a/29/fpm-alpine/config/smtp.config.php b/29/fpm-alpine/config/smtp.config.php index 66a2ef7e..40cfdf94 100644 --- a/29/fpm-alpine/config/smtp.config.php +++ b/29/fpm-alpine/config/smtp.config.php @@ -5,16 +5,14 @@ if (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) 'mail_smtphost' => getenv('SMTP_HOST'), 'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25), 'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '', - 'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')), + 'mail_smtpauth' => getenv('SMTP_NAME') && getenv('SMTP_PASSWORD'), 'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN', 'mail_smtpname' => getenv('SMTP_NAME') ?: '', 'mail_from_address' => getenv('MAIL_FROM_ADDRESS'), 'mail_domain' => getenv('MAIL_DOMAIN'), ); - if (getenv('SMTP_PASSWORD_FILE')) { - $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE'))); - } elseif (getenv('SMTP_PASSWORD')) { + if (getenv('SMTP_PASSWORD')) { $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD'); } else { $CONFIG['mail_smtppassword'] = ''; diff --git a/29/fpm-alpine/entrypoint.sh b/29/fpm-alpine/entrypoint.sh index 4e06fcc4..f925a7ee 100755 --- a/29/fpm-alpine/entrypoint.sh +++ b/29/fpm-alpine/entrypoint.sh @@ -63,14 +63,16 @@ file_env() { local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 + echo "Warning: both $var and $fileVar are set ($fileVar takes precedence)" fi - if [ -n "${varValue}" ]; then - export "$var"="${varValue}" - elif [ -n "${fileVarValue}" ]; then + if [ -n "${fileVarValue}" ]; then + echo "note: taking ${fileVar} file for ${var} value" export "$var"="$(cat "${fileVarValue}")" + elif [ -n "${varValue}" ]; then + echo "note: using ${var} variable for ${var} value" + export "$var"="${varValue}" elif [ -n "${def}" ]; then + echo "note: using invoked definition for ${var} value" export "$var"="$def" fi unset "$fileVar" @@ -82,6 +84,21 @@ if expr "$1" : "apache" 1>/dev/null; then fi fi +# All possible content secrets to variable +file_env NEXTCLOUD_ADMIN_PASSWORD +file_env NEXTCLOUD_ADMIN_USER +file_env MYSQL_DATABASE +file_env MYSQL_PASSWORD +file_env MYSQL_USER +file_env POSTGRES_DB +file_env POSTGRES_PASSWORD +file_env POSTGRES_USER +file_env REDIS_HOST_PASSWORD +file_env SMTP_PASSWORD +file_env OBJECTSTORE_S3_KEY +file_env OBJECTSTORE_S3_SECRET +file_env OBJECTSTORE_S3_SSE_C_KEY + if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then uid="$(id -u)" gid="$(id -g)" diff --git a/29/fpm/config/autoconfig.php b/29/fpm/config/autoconfig.php index 92ad2a1c..f01f18d6 100644 --- a/29/fpm/config/autoconfig.php +++ b/29/fpm/config/autoconfig.php @@ -6,13 +6,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbtype'] = 'sqlite'; $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE'); $autoconfig_enabled = true; -} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) { - $AUTOCONFIG['dbtype'] = 'mysql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); - $autoconfig_enabled = true; } elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) { $AUTOCONFIG['dbtype'] = 'mysql'; $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE'); @@ -20,13 +13,6 @@ if (getenv('SQLITE_DATABASE')) { $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD'); $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST'); $autoconfig_enabled = true; -} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) { - $AUTOCONFIG['dbtype'] = 'pgsql'; - $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE'))); - $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE'))); - $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE'))); - $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST'); - $autoconfig_enabled = true; } elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) { $AUTOCONFIG['dbtype'] = 'pgsql'; $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB'); diff --git a/29/fpm/config/redis.config.php b/29/fpm/config/redis.config.php index a5b13da6..a5fde3c7 100644 --- a/29/fpm/config/redis.config.php +++ b/29/fpm/config/redis.config.php @@ -5,7 +5,7 @@ if (getenv('REDIS_HOST')) { 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( 'host' => getenv('REDIS_HOST'), - 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + 'password' => (string) getenv('REDIS_HOST_PASSWORD'), ), ); diff --git a/29/fpm/config/s3.config.php b/29/fpm/config/s3.config.php index 9941c562..b7dabf32 100644 --- a/29/fpm/config/s3.config.php +++ b/29/fpm/config/s3.config.php @@ -24,25 +24,19 @@ if (getenv('OBJECTSTORE_S3_BUCKET')) { ) ); - if (getenv('OBJECTSTORE_S3_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_KEY')) { + if (getenv('OBJECTSTORE_S3_KEY')) { $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY'); } else { $CONFIG['objectstore']['arguments']['key'] = ''; } - if (getenv('OBJECTSTORE_S3_SECRET_FILE')) { - $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SECRET')) { + if (getenv('OBJECTSTORE_S3_SECRET')) { $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET'); } else { $CONFIG['objectstore']['arguments']['secret'] = ''; } - if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) { - $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE'))); - } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { + if (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY'); } } diff --git a/29/fpm/config/smtp.config.php b/29/fpm/config/smtp.config.php index 66a2ef7e..40cfdf94 100644 --- a/29/fpm/config/smtp.config.php +++ b/29/fpm/config/smtp.config.php @@ -5,16 +5,14 @@ if (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) 'mail_smtphost' => getenv('SMTP_HOST'), 'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25), 'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '', - 'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')), + 'mail_smtpauth' => getenv('SMTP_NAME') && getenv('SMTP_PASSWORD'), 'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN', 'mail_smtpname' => getenv('SMTP_NAME') ?: '', 'mail_from_address' => getenv('MAIL_FROM_ADDRESS'), 'mail_domain' => getenv('MAIL_DOMAIN'), ); - if (getenv('SMTP_PASSWORD_FILE')) { - $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE'))); - } elseif (getenv('SMTP_PASSWORD')) { + if (getenv('SMTP_PASSWORD')) { $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD'); } else { $CONFIG['mail_smtppassword'] = ''; diff --git a/29/fpm/entrypoint.sh b/29/fpm/entrypoint.sh index 4e06fcc4..f925a7ee 100755 --- a/29/fpm/entrypoint.sh +++ b/29/fpm/entrypoint.sh @@ -63,14 +63,16 @@ file_env() { local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 + echo "Warning: both $var and $fileVar are set ($fileVar takes precedence)" fi - if [ -n "${varValue}" ]; then - export "$var"="${varValue}" - elif [ -n "${fileVarValue}" ]; then + if [ -n "${fileVarValue}" ]; then + echo "note: taking ${fileVar} file for ${var} value" export "$var"="$(cat "${fileVarValue}")" + elif [ -n "${varValue}" ]; then + echo "note: using ${var} variable for ${var} value" + export "$var"="${varValue}" elif [ -n "${def}" ]; then + echo "note: using invoked definition for ${var} value" export "$var"="$def" fi unset "$fileVar" @@ -82,6 +84,21 @@ if expr "$1" : "apache" 1>/dev/null; then fi fi +# All possible content secrets to variable +file_env NEXTCLOUD_ADMIN_PASSWORD +file_env NEXTCLOUD_ADMIN_USER +file_env MYSQL_DATABASE +file_env MYSQL_PASSWORD +file_env MYSQL_USER +file_env POSTGRES_DB +file_env POSTGRES_PASSWORD +file_env POSTGRES_USER +file_env REDIS_HOST_PASSWORD +file_env SMTP_PASSWORD +file_env OBJECTSTORE_S3_KEY +file_env OBJECTSTORE_S3_SECRET +file_env OBJECTSTORE_S3_SSE_C_KEY + if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then uid="$(id -u)" gid="$(id -g)" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 4e06fcc4..f925a7ee 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -63,14 +63,16 @@ file_env() { local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 + echo "Warning: both $var and $fileVar are set ($fileVar takes precedence)" fi - if [ -n "${varValue}" ]; then - export "$var"="${varValue}" - elif [ -n "${fileVarValue}" ]; then + if [ -n "${fileVarValue}" ]; then + echo "note: taking ${fileVar} file for ${var} value" export "$var"="$(cat "${fileVarValue}")" + elif [ -n "${varValue}" ]; then + echo "note: using ${var} variable for ${var} value" + export "$var"="${varValue}" elif [ -n "${def}" ]; then + echo "note: using invoked definition for ${var} value" export "$var"="$def" fi unset "$fileVar" @@ -82,6 +84,21 @@ if expr "$1" : "apache" 1>/dev/null; then fi fi +# All possible content secrets to variable +file_env NEXTCLOUD_ADMIN_PASSWORD +file_env NEXTCLOUD_ADMIN_USER +file_env MYSQL_DATABASE +file_env MYSQL_PASSWORD +file_env MYSQL_USER +file_env POSTGRES_DB +file_env POSTGRES_PASSWORD +file_env POSTGRES_USER +file_env REDIS_HOST_PASSWORD +file_env SMTP_PASSWORD +file_env OBJECTSTORE_S3_KEY +file_env OBJECTSTORE_S3_SECRET +file_env OBJECTSTORE_S3_SSE_C_KEY + if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then uid="$(id -u)" gid="$(id -g)" From a1e93f429cb2fbdd66c284aa4ea41ae217b4e482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Wed, 18 Sep 2024 21:43:16 +0200 Subject: [PATCH 2/4] Bump stable to 29.0.7 (#2297) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #2294 Signed-off-by: John Molakvoæ --- generate-stackbrew-library.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 8d90d85b..a7718bc0 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -Eeuo pipefail -stable_channel='29.0.6' +stable_channel='29.0.7' self="$(basename "$BASH_SOURCE")" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" From 2bc1036e611992c56a2cb5e9808698990256574c Mon Sep 17 00:00:00 2001 From: Florian Latifi Date: Wed, 18 Sep 2024 22:45:15 +0200 Subject: [PATCH 3/4] Exclude autoconfig.php from user config check (#2290) Signed-off-by: Florian Latifi --- docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 4e06fcc4..8e178f2e 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -280,7 +280,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP for cfgPath in /usr/src/nextcloud/config/*.php; do cfgFile=$(basename "$cfgPath") - if [ "$cfgFile" != "config.sample.php" ]; then + if [ "$cfgFile" != "config.sample.php" ] && [ "$cfgFile" != "autoconfig.php" ]; then if ! cmp -s "/usr/src/nextcloud/config/$cfgFile" "/var/www/html/config/$cfgFile"; then echo "Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile" fi From 30b570f0b553736d63dc63cf487ff1e5e5331474 Mon Sep 17 00:00:00 2001 From: GitHub Workflow Date: Wed, 18 Sep 2024 20:45:28 +0000 Subject: [PATCH 4/4] Runs update.sh --- 28/apache/entrypoint.sh | 2 +- 28/fpm-alpine/entrypoint.sh | 2 +- 28/fpm/entrypoint.sh | 2 +- 29/apache/entrypoint.sh | 2 +- 29/fpm-alpine/entrypoint.sh | 2 +- 29/fpm/entrypoint.sh | 2 +- 30/apache/entrypoint.sh | 2 +- 30/fpm-alpine/entrypoint.sh | 2 +- 30/fpm/entrypoint.sh | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/28/apache/entrypoint.sh b/28/apache/entrypoint.sh index 4e06fcc4..8e178f2e 100755 --- a/28/apache/entrypoint.sh +++ b/28/apache/entrypoint.sh @@ -280,7 +280,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP for cfgPath in /usr/src/nextcloud/config/*.php; do cfgFile=$(basename "$cfgPath") - if [ "$cfgFile" != "config.sample.php" ]; then + if [ "$cfgFile" != "config.sample.php" ] && [ "$cfgFile" != "autoconfig.php" ]; then if ! cmp -s "/usr/src/nextcloud/config/$cfgFile" "/var/www/html/config/$cfgFile"; then echo "Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile" fi diff --git a/28/fpm-alpine/entrypoint.sh b/28/fpm-alpine/entrypoint.sh index 4e06fcc4..8e178f2e 100755 --- a/28/fpm-alpine/entrypoint.sh +++ b/28/fpm-alpine/entrypoint.sh @@ -280,7 +280,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP for cfgPath in /usr/src/nextcloud/config/*.php; do cfgFile=$(basename "$cfgPath") - if [ "$cfgFile" != "config.sample.php" ]; then + if [ "$cfgFile" != "config.sample.php" ] && [ "$cfgFile" != "autoconfig.php" ]; then if ! cmp -s "/usr/src/nextcloud/config/$cfgFile" "/var/www/html/config/$cfgFile"; then echo "Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile" fi diff --git a/28/fpm/entrypoint.sh b/28/fpm/entrypoint.sh index 4e06fcc4..8e178f2e 100755 --- a/28/fpm/entrypoint.sh +++ b/28/fpm/entrypoint.sh @@ -280,7 +280,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP for cfgPath in /usr/src/nextcloud/config/*.php; do cfgFile=$(basename "$cfgPath") - if [ "$cfgFile" != "config.sample.php" ]; then + if [ "$cfgFile" != "config.sample.php" ] && [ "$cfgFile" != "autoconfig.php" ]; then if ! cmp -s "/usr/src/nextcloud/config/$cfgFile" "/var/www/html/config/$cfgFile"; then echo "Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile" fi diff --git a/29/apache/entrypoint.sh b/29/apache/entrypoint.sh index 4e06fcc4..8e178f2e 100755 --- a/29/apache/entrypoint.sh +++ b/29/apache/entrypoint.sh @@ -280,7 +280,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP for cfgPath in /usr/src/nextcloud/config/*.php; do cfgFile=$(basename "$cfgPath") - if [ "$cfgFile" != "config.sample.php" ]; then + if [ "$cfgFile" != "config.sample.php" ] && [ "$cfgFile" != "autoconfig.php" ]; then if ! cmp -s "/usr/src/nextcloud/config/$cfgFile" "/var/www/html/config/$cfgFile"; then echo "Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile" fi diff --git a/29/fpm-alpine/entrypoint.sh b/29/fpm-alpine/entrypoint.sh index 4e06fcc4..8e178f2e 100755 --- a/29/fpm-alpine/entrypoint.sh +++ b/29/fpm-alpine/entrypoint.sh @@ -280,7 +280,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP for cfgPath in /usr/src/nextcloud/config/*.php; do cfgFile=$(basename "$cfgPath") - if [ "$cfgFile" != "config.sample.php" ]; then + if [ "$cfgFile" != "config.sample.php" ] && [ "$cfgFile" != "autoconfig.php" ]; then if ! cmp -s "/usr/src/nextcloud/config/$cfgFile" "/var/www/html/config/$cfgFile"; then echo "Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile" fi diff --git a/29/fpm/entrypoint.sh b/29/fpm/entrypoint.sh index 4e06fcc4..8e178f2e 100755 --- a/29/fpm/entrypoint.sh +++ b/29/fpm/entrypoint.sh @@ -280,7 +280,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP for cfgPath in /usr/src/nextcloud/config/*.php; do cfgFile=$(basename "$cfgPath") - if [ "$cfgFile" != "config.sample.php" ]; then + if [ "$cfgFile" != "config.sample.php" ] && [ "$cfgFile" != "autoconfig.php" ]; then if ! cmp -s "/usr/src/nextcloud/config/$cfgFile" "/var/www/html/config/$cfgFile"; then echo "Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile" fi diff --git a/30/apache/entrypoint.sh b/30/apache/entrypoint.sh index 4e06fcc4..8e178f2e 100755 --- a/30/apache/entrypoint.sh +++ b/30/apache/entrypoint.sh @@ -280,7 +280,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP for cfgPath in /usr/src/nextcloud/config/*.php; do cfgFile=$(basename "$cfgPath") - if [ "$cfgFile" != "config.sample.php" ]; then + if [ "$cfgFile" != "config.sample.php" ] && [ "$cfgFile" != "autoconfig.php" ]; then if ! cmp -s "/usr/src/nextcloud/config/$cfgFile" "/var/www/html/config/$cfgFile"; then echo "Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile" fi diff --git a/30/fpm-alpine/entrypoint.sh b/30/fpm-alpine/entrypoint.sh index 4e06fcc4..8e178f2e 100755 --- a/30/fpm-alpine/entrypoint.sh +++ b/30/fpm-alpine/entrypoint.sh @@ -280,7 +280,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP for cfgPath in /usr/src/nextcloud/config/*.php; do cfgFile=$(basename "$cfgPath") - if [ "$cfgFile" != "config.sample.php" ]; then + if [ "$cfgFile" != "config.sample.php" ] && [ "$cfgFile" != "autoconfig.php" ]; then if ! cmp -s "/usr/src/nextcloud/config/$cfgFile" "/var/www/html/config/$cfgFile"; then echo "Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile" fi diff --git a/30/fpm/entrypoint.sh b/30/fpm/entrypoint.sh index 4e06fcc4..8e178f2e 100755 --- a/30/fpm/entrypoint.sh +++ b/30/fpm/entrypoint.sh @@ -280,7 +280,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP for cfgPath in /usr/src/nextcloud/config/*.php; do cfgFile=$(basename "$cfgPath") - if [ "$cfgFile" != "config.sample.php" ]; then + if [ "$cfgFile" != "config.sample.php" ] && [ "$cfgFile" != "autoconfig.php" ]; then if ! cmp -s "/usr/src/nextcloud/config/$cfgFile" "/var/www/html/config/$cfgFile"; then echo "Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile" fi