Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/ncp-provisioning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ REDISPASS="$( grep "^requirepass" /etc/redis/redis.conf | cut -f2 -d' ' )"
REDISPASS="$( openssl rand -base64 32 )"
echo Provisioning Redis password
sed -i -E "s|^requirepass .*|requirepass $REDISPASS|" /etc/redis/redis.conf
chown redis:redis /etc/redis/redis.conf
[[ "$DOCKERBUILD" != 1 ]] && systemctl restart redis
}

Expand Down
1 change: 1 addition & 0 deletions bin/ncp/CONFIG/nc-limits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ configure()
local CURRENT_REDIS_MEM=$( grep "^maxmemory" "$CONF" | awk '{ print $2 }' )
[[ "$REDISMEM" != "$CURRENT_REDIS_MEM" ]] && {
sed -i "s|^maxmemory .*|maxmemory $REDISMEM|" "$CONF"
chown redis:redis "$CONF"
service redis-server restart
}
}
Expand Down
18 changes: 16 additions & 2 deletions bin/ncp/NETWORKING/letsencrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ configure()
sed -i "/DocumentRoot/aServerName $DOMAIN" $vhostcfg

# Do it
$letsencrypt certonly -n --force-renew --no-self-upgrade --webroot -w $ncdir --hsts --agree-tos -m $EMAIL -d $DOMAIN && {
local domain_string=""
for domain in $DOMAIN $ADDITIONAL_DOMAIN; do
[[ "$domain" != "" ]] && {
[[ $domain_string == "" ]] && \
domain_string+="${domain}" || \
domain_string+=",${domain}"
}
done
$letsencrypt certonly -n --force-renew --no-self-upgrade --webroot -w $ncdir --hsts --agree-tos -m $EMAIL -d $domain_string && {

# Set up auto-renewal
cat > /etc/cron.weekly/letsencrypt-ncp <<EOF
Expand Down Expand Up @@ -91,7 +99,13 @@ EOF
sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile /etc/letsencrypt/live/$DOMAIN_LOWERCASE/privkey.pem|" $vhostcfg2

# Configure Nextcloud
ncc config:system:set trusted_domains 4 --value=$DOMAIN
local domain_index=12
for dom in $DOMAIN $ADDITIONAL_DOMAIN; do
[[ "$dom" != "" ]] && {
ncc config:system:set trusted_domains $domain_index --value=$dom
((domain_index++))
}
done
ncc config:system:set overwrite.cli.url --value=https://"$DOMAIN"/

# delayed in bg so it does not kill the connection, and we get AJAX response
Expand Down
1 change: 1 addition & 0 deletions docker/nextcloud/020nextcloud
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ln -s /data/nextcloud /var/www/nextcloud

echo "Starting Redis"
sed -i 's|^requirepass .*|requirepass default|' /etc/redis/redis.conf
chown redis:redis /etc/redis/redis.conf
mkdir -p /var/run/redis
chown redis /var/run/redis
sudo -u redis redis-server /etc/redis/redis.conf
Expand Down
6 changes: 6 additions & 0 deletions etc/ncp-config.d/letsencrypt.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"value": "mycloud.ownyourbits.com",
"suggest": "mycloud.ownyourbits.com"
},
{
"id": "ADDITIONAL_DOMAIN",
"name": "Additional domain",
"value": "",
"suggest": "cloud.ownyourbits.com"
},
{
"id": "EMAIL",
"name": "Email",
Expand Down