Skip to content

Commit

Permalink
Letsencrypt: support second domain (#1025)
Browse files Browse the repository at this point in the history
  • Loading branch information
rababerladuseladim authored and nachoparker committed Nov 30, 2019
1 parent a208a02 commit 310877f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/ncp/CONFIG/nc-limits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +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
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 $OTHER_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 $OTHER_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
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

[v1.18.0](https://github.com/nextcloud/nextcloudpi/commit/c140109) (2019-10-27) add ncp-previews
[v1.18.1](https://github.com/nextcloud/nextcloudpi/commit/ebe9592) (2019-11-18) Letsencrypt: support second domain (#1025)

[v1.18.0, master](https://github.com/nextcloud/nextcloudpi/commit/0fc2390) (2019-10-27) add ncp-previews

[v1.17.1 ](https://github.com/nextcloud/nextcloudpi/commit/c63cb27) (2019-09-29) nc-backup: exclude group folders in dataless backup

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": "OTHER_DOMAIN",
"name": "Additional domain",
"value": "",
"suggest": "optional.cloud.ownyourbits.com"
},
{
"id": "EMAIL",
"name": "Email",
Expand Down

0 comments on commit 310877f

Please sign in to comment.