Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trusted domains #2477

Merged
merged 21 commits into from Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion lets-encrypt/test-new-config.sh
Expand Up @@ -35,7 +35,12 @@ then
fi

# Set trusted domains
run_script NETWORK trusted
nextcloud occ config:system:set trusted_domains 0 --value="localhost"
nextcloud occ config:system:set trusted_domains 0 --value="${ADDRESS[@]}"
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
nextcloud occ config:system:set trusted_domains 1 --value="$(hostname)"
nextcloud occ config:system:set trusted_domains 2 --value="$(hostname --fqdn)"
nextcloud occ config:system:set overwrite.cli.url --value="https://$(hostname --fqdn)"
nextcloud_occ maintenance:update:htaccess

# Add crontab
cat << CRONTAB > "$SCRIPTS/letsencryptrenew.sh"
Expand Down
29 changes: 6 additions & 23 deletions network/trusted.sh
@@ -1,28 +1,11 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/

true
SCRIPT_NAME="Trusted"
SCRIPT_NAME="Set trusted domain"
# shellcheck source=lib.sh
source /var/scripts/fetch_lib.sh

# Check for errors + debug code and abort if something isn't right
# 1 = ON
# 0 = OFF
DEBUG=0
debug_mode

download_script NETWORK update-config
if [ -f $SCRIPTS/update-config.php ]
then
# Change config.php
php $SCRIPTS/update-config.php $NCPATH/config/config.php 'trusted_domains[]' localhost "${ADDRESS[@]}" "$(hostname)" "$(hostname --fqdn)" >/dev/null 2>&1
php $SCRIPTS/update-config.php $NCPATH/config/config.php overwrite.cli.url https://"$(hostname --fqdn)"/ >/dev/null 2>&1
source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)

# Change .htaccess accordingly
sed -i "s|RewriteBase /nextcloud|RewriteBase /|g" $NCPATH/.htaccess
# Removed in NC 26.0.0.

# Cleanup
rm -f $SCRIPTS/update-config.php
fi
nextcloud occ config:system:set trusted_domains 3 --value="${ADDRESS[@]}" "$(hostname)" "$(hostname --fqdn)"
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
nextcloud occ config:system:set overwrite.cli.url --value="https://$(hostname --fqdn)"
nextcloud_occ maintenance:update:htaccess
53 changes: 0 additions & 53 deletions network/update-config.php

This file was deleted.

4 changes: 3 additions & 1 deletion nextcloud-startup-script.sh
Expand Up @@ -554,7 +554,9 @@ mesg n
ROOTNEWPROFILE

# Set trusted domain in config.php
run_script NETWORK trusted
nextcloud occ config:system:set trusted_domains 3 --value="${ADDRESS[@]}" "$(hostname)" "$(hostname --fqdn)"
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
nextcloud occ config:system:set overwrite.cli.url --value="https://$(hostname --fqdn)"
nextcloud_occ maintenance:update:htaccess

# Upgrade system
print_text_in_color "$ICyan" "System will now upgrade..."
Expand Down
12 changes: 0 additions & 12 deletions static/trusted.sh

This file was deleted.