letsencrypt: fix invalid arithmetic operator error

Signed-off-by: nachoparker <nacho@ownyourbits.com>
This commit is contained in:
nachoparker 2021-12-13 13:00:56 -07:00
parent 26a7778d06
commit bcd850cc3f
10 changed files with 31 additions and 27 deletions

View File

@ -105,10 +105,10 @@ EOF
# 4 Byte UTF8 support
ncc config:system:set mysql.utf8mb4 --type boolean --value="true"
ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[nextcloudpi]}" --value="nextcloudpi"
ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[nextcloudpi-local]}" --value="nextcloudpi.local"
ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[nextcloudpi-lan]}" --value="nextcloudpi.lan"
ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[nc_domain]}" --value="nextcloudpi.lan"
ncc config:system:set trusted_domains 7 --value="nextcloudpi"
ncc config:system:set trusted_domains 5 --value="nextcloudpi.local"
ncc config:system:set trusted_domains 8 --value="nextcloudpi.lan"
ncc config:system:set trusted_domains 3 --value="nextcloudpi.lan"
# email
ncc config:system:set mail_smtpmode --value="sendmail"

View File

@ -10,9 +10,9 @@
configure()
{
[[ "$DOMAIN1" != "" ]] && ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[trusted_domain_1]}" --value="$DOMAIN1"
[[ "$DOMAIN2" != "" ]] && ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[trusted_domain_2]}" --value="$DOMAIN2"
[[ "$DOMAIN3" != "" ]] && ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[trusted_domain_3]}" --value="$DOMAIN3"
[[ "$DOMAIN1" != "" ]] && ncc config:system:set trusted_domains 20 --value="$DOMAIN1"
[[ "$DOMAIN2" != "" ]] && ncc config:system:set trusted_domains 21 --value="$DOMAIN2"
[[ "$DOMAIN3" != "" ]] && ncc config:system:set trusted_domains 22 --value="$DOMAIN3"
}
install(){ :; }

View File

@ -50,7 +50,7 @@ configure()
local IFACE IP
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )
IP=$( ncc config:system:get trusted_domains "${TRUSTED_DOMAINS[docker_overwrite]}" | grep -oP '\d{1,3}(.\d{1,3}){3}' )
IP=$( ncc config:system:get trusted_domains 6 | grep -oP '\d{1,3}(.\d{1,3}){3}' )
[[ "$IP" == "" ]] && IP="$(get_ip)"
[[ "$IP" == "" ]] && { echo "could not detect IP"; return 1; }
@ -74,7 +74,7 @@ EOF
update-rc.d dnsmasq defaults
update-rc.d dnsmasq enable
service dnsmasq restart
ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[dnsmasq]}" --value="$DOMAIN"
ncc config:system:set trusted_domains 2 --value="$DOMAIN"
set-nc-domain "$DOMAIN" --no-trusted-domain
echo "dnsmasq enabled"
}

View File

@ -121,7 +121,7 @@ EOF
sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile ${key_path}|" "${ncp_vhostcfg}"
# Configure Nextcloud
local domain_index="${TRUSTED_DOMAINS[letsencrypt_1]}"
local domain_index=11
for dom in $DOMAIN "${OTHER_DOMAINS_ARRAY[@]}"; do
[[ "$dom" != "" ]] && {
[[ $domain_index -lt 20 ]] || {

View File

@ -89,7 +89,7 @@ EOF
ifup "${IFACE}"
}
ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[ip]}" --value="$IP"
ncc config:system:set trusted_domains 1 --value="$IP"
set-nc-domain "${IP}"
echo "Static IP set to $IP"
}

View File

@ -13,14 +13,14 @@ while :; do
local_ip="$(get_ip)"
pub_ip="$(curl -m4 icanhazip.com 2>/dev/null)"
[[ "$pub_ip" != "" ]] && ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[public_ip]}" --value="$pub_ip"
[[ "$pub_ip" != "" ]] && ncc config:system:set trusted_domains 11 --value="$pub_ip"
[[ "$local_ip" != "" ]] && break
sleep 3
done
ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[ip]}" --value="${local_ip}"
ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[hostname]}" --value="$(hostname -f)"
ncc config:system:set trusted_domains 1 --value="${local_ip}"
ncc config:system:set trusted_domains 14 --value="$(hostname -f)"
# we might need to retry if redis is not ready
while :; do

View File

@ -13,7 +13,7 @@ source build/buildlib.sh
echo -e "\e[1m\n[ Build NCP Raspberry Pi ]\e[0m"
URL="https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2020-08-24/2020-08-20-raspios-buster-arm64-lite.zip"
URL="https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2021-11-08/2021-10-30-raspios-bullseye-arm64-lite.zip"
SIZE=4G # Raspbian image size
#CLEAN=0 # Pass this envvar to skip cleaning download cache
IMG="NextCloudPi_RPi_$( date "+%m-%d-%y" ).img"

View File

@ -72,7 +72,7 @@ bash /usr/local/bin/nextcloud-domain.sh
# Trusted Domain (as an argument)
[[ "$2" != "" ]] && \
ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[docker_overwrite]}" --value="$2"
ncc config:system:set trusted_domains 6 --value="$2"
echo "Nextcloud version $(nc_version). NextCloudPi version $(cat /usr/local/etc/ncp-version)"

View File

@ -1,9 +1,13 @@
[v1.44.5](https://github.com/nextcloud/nextcloudpi/commit/0e15dc9) (2021-11-29) ncp-previewgenerator: fix app enable in NC22
[v1.46.7](https://github.com/nextcloud/nextcloudpi/commit/0da8dcd) (2021-12-13) letsencrypt: fix invalid arithmetic operator error
[v1.44.4](https://github.com/nextcloud/nextcloudpi/commit/0a4f8c1) (2021-11-19) ncp-web: fix spurious characters in power menu
[v1.44.6 ](https://github.com/nextcloud/nextcloudpi/commit/26a7778) (2021-12-06) notify_push: fix service not restarting on binary update (#1398)
[v1.44.3](https://github.com/nextcloud/nextcloudpi/commit/4717eb3) (2021-11-18) tweak ncc command
[v1.44.5](https://github.com/nextcloud/nextcloudpi/commit/5a404c0) (2021-11-29) ncp-previewgenerator: fix app enable in NC22
[v1.44.4 ](https://github.com/nextcloud/nextcloudpi/commit/0a4f8c1) (2021-11-19) ncp-web: fix spurious characters in power menu
[v1.44.3 ](https://github.com/nextcloud/nextcloudpi/commit/4717eb3) (2021-11-18) tweak ncc command
[v1.44.2 ](https://github.com/nextcloud/nextcloudpi/commit/0c589ff) (2021-11-16) ncp-app: bump to NC22

View File

@ -14,13 +14,13 @@ export BINDIR=/usr/local/bin/ncp
export NCDIR=/var/www/nextcloud
export ncc=/usr/local/bin/ncc
unset TRUSTED_DOMAINS
declare -A TRUSTED_DOMAINS
export TRUSTED_DOMAINS=(
[ip]=1 [dnsmasq]=2 [nc_domain]=3 [nextcloudpi-local]=5 [docker_overwrite]=6
[nextcloudpi]=7 [nextcloudpi-lan]=8 [public_ip]=11 [letsencrypt_1]=12
[letsencrypt_2]=13 [hostname]=14 [trusted_domain_1]=20 [trusted_domain_2]=21 [trusted_domain_3]=22
)
#unset TRUSTED_DOMAINS
#declare -A TRUSTED_DOMAINS
#export TRUSTED_DOMAINS=(
#[ip]=1 [dnsmasq]=2 [nc_domain]=3 [nextcloudpi-local]=5 [docker_overwrite]=6
#[nextcloudpi]=7 [nextcloudpi-lan]=8 [public_ip]=11 [letsencrypt_1]=12
#[letsencrypt_2]=13 [hostname]=14 [trusted_domain_1]=20 [trusted_domain_2]=21 [trusted_domain_3]=22
#)
command -v jq &>/dev/null || {
apt-get update
@ -127,7 +127,7 @@ function set-nc-domain()
proto="$(ncc config:system:get overwriteprotocol)" || true
[[ "${proto}" == "" ]] && proto="https"
local url="${proto}://${domain%*/}"
[[ "$2" == "--no-trusted-domain" ]] || ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[nc-domain]}" --value="${domain%*/}"
[[ "$2" == "--no-trusted-domain" ]] || ncc config:system:set trusted_domains 3 --value="${domain%*/}"
ncc config:system:set overwrite.cli.url --value="${url}/"
if is_ncp_activated && is_app_enabled notify_push; then
ncc config:system:set trusted_proxies 11 --value="127.0.0.1"