Skip to content

Commit 2bde893

Browse files
authored
Merge pull request #7216 from nextcloud/enh/noid/allow-configure-mysql-root-cert
nextcloud: allow to configure mysql root cert
2 parents 1a91d61 + 6b3af00 commit 2bde893

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Containers/nextcloud/config/postgres.config.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@
77
),
88
);
99
}
10+
if (getenv('NEXTCLOUD_TRUSTED_CERTIFICATES_MYSQL')) {
11+
$CONFIG = array(
12+
'dbdriveroptions' => array(
13+
'PDO::MYSQL_ATTR_SSL_CA' => '/var/www/html/data/certificates/MYSQL',
14+
),
15+
);
16+
}
17+

Containers/nextcloud/entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ EOF
283283
if [ -n "$NEXTCLOUD_TRUSTED_CERTIFICATES_POSTGRES" ]; then
284284
mkdir /var/www/html/data/certificates
285285
echo "$NEXTCLOUD_TRUSTED_CERTIFICATES_POSTGRES" > "/var/www/html/data/certificates/POSTGRES"
286+
# Write out mysql root cert
287+
elif [ -n "$NEXTCLOUD_TRUSTED_CERTIFICATES_MYSQL" ]; then
288+
mkdir /var/www/html/data/certificates
289+
echo "$NEXTCLOUD_TRUSTED_CERTIFICATES_MYSQL" > "/var/www/html/data/certificates/MYSQL"
286290
fi
287291

288292
echo "Installing with $DATABASE_TYPE database"

Containers/notify-push/start.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,14 @@ fi
6868

6969
# Postgres root cert
7070
if [ -f "/nextcloud/data/certificates/POSTGRES" ]; then
71-
POSTGRES_CERT="?sslmode=verify-ca&sslrootcert=/nextcloud/data/certificates/POSTGRES"
71+
CERT_OPTIONS="?sslmode=verify-ca&sslrootcert=/nextcloud/data/certificates/POSTGRES"
72+
# Mysql root cert
73+
elif [ -f "/nextcloud/data/certificates/MYSQL" ]; then
74+
CERT_OPTIONS="?sslmode=verify-ca&ssl-ca=/nextcloud/data/certificates/MYSQL"
7275
fi
7376

7477
# Set sensitive values as env
75-
export DATABASE_URL="$DATABASE_TYPE://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB$POSTGRES_CERT"
78+
export DATABASE_URL="$DATABASE_TYPE://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB$CERT_OPTIONS"
7679
export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX"
7780

7881
# Run it

0 commit comments

Comments
 (0)