Merge pull request #7304 from nextcloud/enh/noid/fix-config-of-bundle-path
Some checks failed
Codespell / Check spelling (push) Has been cancelled
Docker Lint / docker-lint (push) Has been cancelled
Shellcheck / Check Shell (push) Has been cancelled

nextcloud: fix configuration of `default_certificates_bundle_path` and allow to use bundle for mailer
This commit is contained in:
Simon L. 2025-12-12 16:10:45 +01:00 committed by GitHub
commit 7c57a3f702
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 13 deletions

View file

@ -0,0 +1,5 @@
<?php
// Check if NEXTCLOUD_TRUSTED_CERTIFICATES_ are configured
if (str_contains(implode(' ', array_keys(getenv())), 'NEXTCLOUD_TRUSTED_CERTIFICATES_')) {
$CONFIG['default_certificates_bundle_path'] = '/var/www/html/data/certificates/ca-bundle.crt';
}

View file

@ -18,3 +18,14 @@ if (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN'))
$CONFIG['mail_smtppassword'] = '';
}
}
if (getenv('NEXTCLOUD_TRUSTED_CERTIFICATES_MAILER')) {
$CONFIG = array(
'mail_smtpstreamoptions' => array(
'ssl' => array(
'verify_peer_name' => false,
'cafile' => '/var/www/html/data/certificates/ca-bundle.crt',
)
)
);
}

View file

@ -20,13 +20,6 @@ run_upgrade_if_needed_due_to_app_update() {
fi
}
set_global_ca_bundle_path() {
# Only run if env is set
if env | grep -q NEXTCLOUD_TRUSTED_CERTIFICATES_; then
php /var/www/html/occ config:system:set default_certificates_bundle_path --value="$CERTIFICATE_BUNDLE"
fi
}
# Create cert bundle
if env | grep -q NEXTCLOUD_TRUSTED_CERTIFICATES_; then
@ -246,8 +239,6 @@ if ! [ -f "$NEXTCLOUD_DATA_DIR/skip.update" ]; then
run_upgrade_if_needed_due_to_app_update
set_global_ca_bundle_path
php /var/www/html/occ maintenance:mode --off
echo "Getting and backing up the status of apps for later; this might take a while..."
@ -381,8 +372,6 @@ EOF
# Try to force generation of appdata dir:
php /var/www/html/occ maintenance:repair
set_global_ca_bundle_path
if [ -z "$OBJECTSTORE_S3_BUCKET" ] && [ -z "$OBJECTSTORE_SWIFT_URL" ]; then
max_retries=10
try=0
@ -599,8 +588,6 @@ fi
run_upgrade_if_needed_due_to_app_update
set_global_ca_bundle_path
if [ -z "$OBJECTSTORE_S3_BUCKET" ] && [ -z "$OBJECTSTORE_SWIFT_URL" ]; then
# Check if appdata is present
# If not, something broke (e.g. changing ncdatadir after aio was first started)