Skip to content

Commit 33db828

Browse files
committed
uacme: improve staging handling
when both acme_server and staging is set uacme refuest to run, so do manual server config and do own staging cert mark Signed-off-by: Seo Suchan <tjtncks@gmail.com>
1 parent d9e1f27 commit 33db828

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

net/uacme/files/hook.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ get)
113113
staging_moved=0
114114
is_renew=0
115115
if [ -e "$domain_dir" ]; then
116-
if [ "$staging" = 0 ] && grep -q "acme-staging" "$domain_dir/$main_domain.conf"; then
116+
if [ "$staging" = 0 ] && [ -e $domain_dir/this_is_staging ]; then
117117
mv "$domain_dir" "$domain_dir.staging"
118118
mv "$state_dir/private/$main_domain" "$state_dir/private/$main_domain.staging"
119119
log info "Certificates are previously issued from a staging server, but staging option is disabled, moved to $domain_dir.staging."
@@ -180,30 +180,32 @@ get)
180180
case $status in
181181
0)
182182
link_certs "$domain_dir" "$main_domain"
183-
if [ -e is_renew ]; then
184-
$NOTIFY issued
185-
else
183+
if [ "$is_renew" = 1 ]; then
186184
$NOTIFY renewed
185+
else
186+
$NOTIFY issued
187+
if [ "$staging" = 1 ]; then
188+
touch $domain_dir/this_is_staging
189+
fi
187190
fi
188191
;;
189192
1)
190-
#server didn't run so don't do anything
193+
#cert is not due to renewl so don't do anything
191194
if [ "$staging_moved" = 1 ]; then
192195
log err "Staging certificate '$domain_dir' restored"
193196
mv "$domain_dir.staging" "$domain_dir"
194-
log err "Staging certificate restored"
195197
fi
196198
log debug "not due to renewal"
197199
;;
198200
*)
199-
if [ -e is_renew ]; then
201+
if [ "$is_renew" = 1 ]; then
200202
$NOTIFY renew-failed
201203
exit 1;
202204
fi
203205
if [ "$staging_moved" = 1 ]; then
204206
log err "Staging certificate '$domain_dir' restored"
205207
mv "$domain_dir.staging" "$domain_dir"
206-
log err "Staging certificate restored"
208+
mv "$state_dir/private/$main_domain.staging" "$state_dir/private/$main_domain"
207209
elif [ -d "$domain_dir" ]; then
208210
failed_dir="$domain_dir.failed-$(date +%s)"
209211
mv "$domain_dir" "$failed_dir"

0 commit comments

Comments
 (0)