diff --git a/root/etc/periodic/weekly/dehydrated b/root/etc/periodic/weekly/dehydrated index 1857327..83adba3 100755 --- a/root/etc/periodic/weekly/dehydrated +++ b/root/etc/periodic/weekly/dehydrated @@ -1,3 +1,4 @@ #!/bin/bash chown -R ${UID}:${GID} /etc/dehydrated /certs /var/www/dehydrated -su-exec ${UID}:${GID} /dehydrated/dehydrated -c +# Run dehydrated +su-exec ${UID}:${GID} /dehydrated/dehydrated --cron --keep-going diff --git a/root/etc/s6.d/dehydrated/run b/root/etc/s6.d/dehydrated/run index 3db9186..388cdf0 100755 --- a/root/etc/s6.d/dehydrated/run +++ b/root/etc/s6.d/dehydrated/run @@ -1,3 +1,11 @@ #!/bin/sh s6-svc -O /etc/s6.d/dehydrated + +# Set ownership to dehydrated on the relevant folders +chown -R ${UID}:${GID} /etc/dehydrated /certs /var/www/dehydrated + +# Register to the CA +su-exec ${UID}:${GID} /dehydrated/dehydrated --register --accept-terms + +# Run the weekly script once /etc/periodic/weekly/dehydrated diff --git a/root/etc/s6.d/setup/run b/root/etc/s6.d/setup/run index 664a80e..d9ec739 100755 --- a/root/etc/s6.d/setup/run +++ b/root/etc/s6.d/setup/run @@ -9,7 +9,7 @@ for check_config in "/etc/dehydrated" "/usr/local/etc/dehydrated" "${PWD}" "${SC fi done -# At this point, no configuration file exists, so copy the example into /etc/dehydrated +# At this point, if no configuration file exists, copy the example into /etc/dehydrated if [[ "$CONFIGFILE" == "none" ]]; then cp /dehydrated/docs/examples/config /etc/dehydrated/config CONFIGFILE="/etc/dehydrated/config" @@ -19,8 +19,8 @@ fi case "$ENDPOINT" in "staging") # If CA=... is commented, uncomment and set it to staging, if it is set to production, set it to staging - sed -ie 's/#CA=.*$/CA="https:\/\/acme-staging.api.letsencrypt.org\/directory/g' $CONFIGFILE - sed -ie 's/CA=.+acme-v01\.api\..+$/CA="https:\/\/acme-staging.api.letsencrypt.org\/directory/g' $CONFIGFILE + sed -ie 's/#CA=.*$/CA="https:\/\/acme-staging.api.letsencrypt.org\/directory"/g' $CONFIGFILE + sed -ie 's/CA=.+acme-v01\.api\..+$/CA="https:\/\/acme-staging.api.letsencrypt.org\/directory"/g' $CONFIGFILE # Same procedure for CA_TERMS=... sed -ie 's/#CA_TERMS=.*$/CA_TERMS="https:\/\/acme-staging.api.letsencrypt.org\/terms"/g' $CONFIGFILE sed -ie 's/CA_TERMS=.+acme-v01\.api\..+$/CA_TERMS="https:\/\/acme-staging.api.letsencrypt.org\/terms"/g' $CONFIGFILE @@ -28,11 +28,13 @@ case "$ENDPOINT" in "production") # If CA=... is commented, uncomment and set to production, if it was set to staging, set it to production sed -ie 's/#CA=.*$/CA="https:\/\/acme-v01.api.letsencrypt.org\/directory"/g' $CONFIGFILE - sed -ie 's/CA=.+acme-staging\.api\..+$/https:\/\/acme-v01.api.letsencrypt.org\/directory/g' $CONFIGFILE + sed -ie 's/CA=.+acme-staging\.api\..+$/https:\/\/acme-v01.api.letsencrypt.org\/directory"/g' $CONFIGFILE # Same thing for CA_TERMS=... sed -ie 's/#CA_TERMS=.*$/CA_TERMS="https:\/\/acme-v01.api.letsencrypt.org\/terms"/g' $CONFIGFILE sed -ie 's/CA_TERMS=.+acme-staging\.api\..+$/CA_TERMS="https:\/\/acme-v01.api.letsencrypt.org\/terms"/g' $CONFIGFILE + ;; *) + echo "INFO: No endpoint was specifically set, dehydrated will use its default" ;; esac @@ -51,5 +53,6 @@ case "$CHALLENGE" in sed -ie 's/CHALLENGETYPE=.+$/CHALLENGETYPE="dns-01"/g' $CONFIGFILE ;; *) + echo "INFO: No challenge-type was specified, the default from dehydrated will be used" ;; esac