|
|
@ -132,9 +132,9 @@ post_checks() |
|
|
|
if [ -e /etc/init.d/uhttpd ] && ( [ -n "$UHTTPD_LISTEN_HTTP" ] || [ $UPDATE_UHTTPD -eq 1 ] ); then |
|
|
|
if [ -n "$UHTTPD_LISTEN_HTTP" ]; then |
|
|
|
uci set uhttpd.main.listen_http="$UHTTPD_LISTEN_HTTP" |
|
|
|
uci commit uhttpd |
|
|
|
UHTTPD_LISTEN_HTTP= |
|
|
|
fi |
|
|
|
uci commit uhttpd |
|
|
|
/etc/init.d/uhttpd reload |
|
|
|
fi |
|
|
|
|
|
|
@ -180,6 +180,7 @@ issue_cert() |
|
|
|
local failed_dir |
|
|
|
local webroot |
|
|
|
local dns |
|
|
|
local ret |
|
|
|
|
|
|
|
config_get_bool enabled "$section" enabled 0 |
|
|
|
config_get_bool use_staging "$section" use_staging |
|
|
@ -203,6 +204,12 @@ issue_cert() |
|
|
|
[ -n "$webroot" ] || [ -n "$dns" ] || pre_checks "$main_domain" || return 1 |
|
|
|
|
|
|
|
log "Running ACME for $main_domain" |
|
|
|
|
|
|
|
handle_credentials() { |
|
|
|
local credential="$1" |
|
|
|
eval export $credential |
|
|
|
} |
|
|
|
config_list_foreach "$section" credentials handle_credentials |
|
|
|
|
|
|
|
if [ -e "$STATE_DIR/$main_domain" ]; then |
|
|
|
if [ "$use_staging" -eq "0" ] && is_staging "$main_domain"; then |
|
|
@ -211,8 +218,9 @@ issue_cert() |
|
|
|
moved_staging=1 |
|
|
|
else |
|
|
|
log "Found previous cert config. Issuing renew." |
|
|
|
$ACME --home "$STATE_DIR" --renew -d "$main_domain" $acme_args || return 1 |
|
|
|
return 0 |
|
|
|
$ACME --home "$STATE_DIR" --renew -d "$main_domain" $acme_args && ret=0 || ret=1 |
|
|
|
post_checks |
|
|
|
return $ret |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
@ -231,18 +239,13 @@ issue_cert() |
|
|
|
else |
|
|
|
if [ ! -d "$webroot" ]; then |
|
|
|
err "$main_domain: Webroot dir '$webroot' does not exist!" |
|
|
|
post_checks |
|
|
|
return 1 |
|
|
|
fi |
|
|
|
log "Using webroot dir: $webroot" |
|
|
|
acme_args="$acme_args --webroot $webroot" |
|
|
|
fi |
|
|
|
|
|
|
|
handle_credentials() { |
|
|
|
local credential="$1" |
|
|
|
eval export $credential |
|
|
|
} |
|
|
|
config_list_foreach "$section" credentials handle_credentials |
|
|
|
|
|
|
|
if ! $ACME --home "$STATE_DIR" --issue $acme_args; then |
|
|
|
failed_dir="$STATE_DIR/${main_domain}.failed-$(date +%s)" |
|
|
|
err "Issuing cert for $main_domain failed. Moving state to $failed_dir" |
|
|
|