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

improve the https check #2555

Merged
merged 3 commits into from Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all 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 apps/notify_push.sh
Expand Up @@ -41,8 +41,13 @@ fi
# Check TLS
check_nextcloud_https "Notify Push"

# Get the NCDOMAIN variable
if [ -z $NCDOMAIN ]
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
then
ncdomain
fi

# Check apache conf
NCDOMAIN=$(nextcloud_occ_no_check config:system:get overwrite.cli.url | sed 's|https://||;s|/||')
if ! [ -f "$SITES_AVAILABLE/$NCDOMAIN.conf" ]
then
msg_box "It seems like you haven't used the built-in 'Activate TLS' script to enable 'Let's Encrypt!' \
Expand Down
16 changes: 13 additions & 3 deletions lib.sh
Expand Up @@ -747,9 +747,13 @@ fi

# Check if Nextcloud is installed with TLS
check_nextcloud_https() {
if ! nextcloud_occ_no_check config:system:get overwrite.cli.url | grep -q "https"
if ! nextcloud_occ_no_check config:system:get overwrite.cli.url | grep -q "https"
then
# Check if it's used by any of the Documentserver apps and adopt the message to that
if [ "$1" == 'Collabora (Docker)' ] || [ "$1" == 'OnlyOffice (Docker)' ]
then
if [ "$1" == 'Collabora (Docker)' ] || [ "$1" == 'OnlyOffice (Docker)' ]
ncdomain
if ! curl -s https://"$NCDOMAIN"/status.php | grep -q 'installed":true'
then
msg_box "Sorry, but Nextcloud needs to be run on HTTPS.
You can easily activate TLS (HTTPS) by running the Let's Encrypt script.
Expand All @@ -758,7 +762,12 @@ More info here: http://shortio.hanssonit.se/1EAgBmPyFc
To run this script again, just exectue 'sudo bash $SCRIPTS/menu.sh' and choose:
Additional Apps --> Documentserver --> $1."
exit
else
fi
else
# Adopt the error message to anything else but the Documentserver apps
ncdomain
if ! curl -s https://"$NCDOMAIN"/status.php | grep -q 'installed":true'
then
msg_box "Sorry, but Nextcloud needs to be run on HTTPS.
You can easily activate TLS (HTTPS) by running the Let's Encrypt script.
More info here: http://shortio.hanssonit.se/1EAgBmPyFc
Expand All @@ -768,6 +777,7 @@ Additional Apps --> $1."
exit
fi
fi
fi
}

restart_webserver() {
Expand Down