Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
254feecf
Unverified
Commit
254feecf
authored
Jun 14, 2019
by
neil
Committed by
GitHub
Jun 14, 2019
Browse files
Merge pull request #2339 from Neilpang/dev
fix
https://github.com/Neilpang/acme.sh/issues/2321
parents
9bc45563
c6b68551
Changes
1
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
254feecf
...
@@ -2450,7 +2450,7 @@ _initpath() {
...
@@ -2450,7 +2450,7 @@ _initpath() {
.
"
$ACCOUNT_CONF_PATH
"
.
"
$ACCOUNT_CONF_PATH
"
fi
fi
if
[
"
$IN_CRON
"
]
;
then
if
[
"
$
ACME_
IN_CRON
"
]
;
then
if
[
!
"
$_USER_PATH_EXPORTED
"
]
;
then
if
[
!
"
$_USER_PATH_EXPORTED
"
]
;
then
_USER_PATH_EXPORTED
=
1
_USER_PATH_EXPORTED
=
1
export
PATH
=
"
$USER_PATH
:
$PATH
"
export
PATH
=
"
$USER_PATH
:
$PATH
"
...
@@ -3216,14 +3216,6 @@ _on_issue_err() {
...
@@ -3216,14 +3216,6 @@ _on_issue_err() {
_err
"See:
$_DEBUG_WIKI
"
_err
"See:
$_DEBUG_WIKI
"
fi
fi
if
[
"
$IN_CRON
"
]
;
then
if
[
"
$NOTIFY_LEVEL
"
]
&&
[
$NOTIFY_LEVEL
-ge
$NOTIFY_LEVEL_ERROR
]
;
then
if
[
"
$NOTIFY_MODE
"
=
"
$NOTIFY_MODE_CERT
"
]
;
then
_send_notify
"Renew
$_main_domain
error"
"There is an error."
"
$NOTIFY_HOOK
"
1
fi
fi
fi
#run the post hook
#run the post hook
if
[
"
$_chk_post_hook
"
]
;
then
if
[
"
$_chk_post_hook
"
]
;
then
_info
"Run post hook:'
$_chk_post_hook
'"
_info
"Run post hook:'
$_chk_post_hook
'"
...
@@ -3266,13 +3258,7 @@ _on_issue_success() {
...
@@ -3266,13 +3258,7 @@ _on_issue_success() {
_chk_post_hook
=
"
$1
"
_chk_post_hook
=
"
$1
"
_chk_renew_hook
=
"
$2
"
_chk_renew_hook
=
"
$2
"
_debug _on_issue_success
_debug _on_issue_success
if
[
"
$IN_CRON
"
]
;
then
if
[
"
$NOTIFY_LEVEL
"
]
&&
[
$NOTIFY_LEVEL
-ge
$NOTIFY_LEVEL_RENEW
]
;
then
if
[
"
$NOTIFY_MODE
"
=
"
$NOTIFY_MODE_CERT
"
]
;
then
_send_notify
"Renew
$_main_domain
success"
"Good, the cert is renewed."
"
$NOTIFY_HOOK
"
0
fi
fi
fi
#run the post hook
#run the post hook
if
[
"
$_chk_post_hook
"
]
;
then
if
[
"
$_chk_post_hook
"
]
;
then
_info
"Run post hook:'
$_chk_post_hook
'"
_info
"Run post hook:'
$_chk_post_hook
'"
...
@@ -4506,7 +4492,7 @@ $_authorizations_map"
...
@@ -4506,7 +4492,7 @@ $_authorizations_map"
_info
"Your cert key is in
$(
__green
"
$CERT_KEY_PATH
"
)
"
_info
"Your cert key is in
$(
__green
"
$CERT_KEY_PATH
"
)
"
fi
fi
if
[
!
"
$USER_PATH
"
]
||
[
!
"
$IN_CRON
"
]
;
then
if
[
!
"
$USER_PATH
"
]
||
[
!
"
$
ACME_
IN_CRON
"
]
;
then
USER_PATH
=
"
$PATH
"
USER_PATH
=
"
$PATH
"
_saveaccountconf
"USER_PATH"
"
$USER_PATH
"
_saveaccountconf
"USER_PATH"
"
$USER_PATH
"
fi
fi
...
@@ -4686,19 +4672,10 @@ renew() {
...
@@ -4686,19 +4672,10 @@ renew() {
if
[
-z
"
$FORCE
"
]
&&
[
"
$Le_NextRenewTime
"
]
&&
[
"
$(
_time
)
"
-lt
"
$Le_NextRenewTime
"
]
;
then
if
[
-z
"
$FORCE
"
]
&&
[
"
$Le_NextRenewTime
"
]
&&
[
"
$(
_time
)
"
-lt
"
$Le_NextRenewTime
"
]
;
then
_info
"Skip, Next renewal time is:
$(
__green
"
$Le_NextRenewTimeStr
"
)
"
_info
"Skip, Next renewal time is:
$(
__green
"
$Le_NextRenewTimeStr
"
)
"
_info
"Add '
$(
__red
'--force'
)
' to force to renew."
_info
"Add '
$(
__red
'--force'
)
' to force to renew."
if
[
"
$IN_CRON
"
=
"1"
]
;
then
if
[
"
$NOTIFY_LEVEL
"
]
&&
[
$NOTIFY_LEVEL
-ge
$NOTIFY_LEVEL_SKIP
]
;
then
if
[
"
$NOTIFY_MODE
"
=
"
$NOTIFY_MODE_CERT
"
]
;
then
_send_notify
"Renew
$Le_Domain
skipped"
"Good, the cert next renewal time is
$Le_NextRenewTimeStr
."
"
$NOTIFY_HOOK
"
"
$RENEW_SKIP
"
fi
fi
fi
return
"
$RENEW_SKIP
"
return
"
$RENEW_SKIP
"
fi
fi
if
[
"
$IN_CRON
"
=
"1"
]
&&
[
-z
"
$Le_CertCreateTime
"
]
;
then
if
[
"
$
ACME_
IN_CRON
"
=
"1"
]
&&
[
-z
"
$Le_CertCreateTime
"
]
;
then
_info
"Skip invalid cert for:
$Le_Domain
"
_info
"Skip invalid cert for:
$Le_Domain
"
return
$RENEW_SKIP
return
$RENEW_SKIP
fi
fi
...
@@ -4733,6 +4710,8 @@ renewAll() {
...
@@ -4733,6 +4710,8 @@ renewAll() {
_success_msg
=
""
_success_msg
=
""
_error_msg
=
""
_error_msg
=
""
_skipped_msg
=
""
_skipped_msg
=
""
_error_level
=
$NOTIFY_LEVEL_SKIP
_notify_code
=
$RENEW_SKIP
for
di
in
"
${
CERT_HOME
}
"
/
*
.
*
/
;
do
for
di
in
"
${
CERT_HOME
}
"
/
*
.
*
/
;
do
_debug di
"
$di
"
_debug di
"
$di
"
if
!
[
-d
"
$di
"
]
;
then
if
!
[
-d
"
$di
"
]
;
then
...
@@ -4750,49 +4729,83 @@ renewAll() {
...
@@ -4750,49 +4729,83 @@ renewAll() {
)
)
rc
=
"
$?
"
rc
=
"
$?
"
_debug
"Return code:
$rc
"
_debug
"Return code:
$rc
"
if
[
"
$rc
"
!=
"0"
]
;
then
if
[
"
$rc
"
=
"0"
]
;
then
if
[
"
$rc
"
=
"
$RENEW_SKIP
"
]
;
then
if
[
$_error_level
-gt
$NOTIFY_LEVEL_RENEW
]
;
then
_info
"Skipped
$d
"
_error_level
=
"
$NOTIFY_LEVEL_RENEW
"
_skipped_msg
=
"
${
_skipped_msg
}
$d
_notify_code
=
0
"
fi
else
if
[
"
$ACME_IN_CRON
"
]
;
then
_error_msg
=
"
${
_error_msg
}
$d
if
[
"
$NOTIFY_LEVEL
"
]
&&
[
$NOTIFY_LEVEL
-ge
$NOTIFY_LEVEL_RENEW
]
;
then
if
[
"
$NOTIFY_MODE
"
=
"
$NOTIFY_MODE_CERT
"
]
;
then
_send_notify
"Renew
$d
success"
"Good, the cert is renewed."
"
$NOTIFY_HOOK
"
0
fi
fi
fi
_success_msg
=
"
${
_success_msg
}
$d
"
"
if
[
"
$_stopRenewOnError
"
]
;
then
elif
[
"
$rc
"
=
"
$RENEW_SKIP
"
]
;
then
_err
"Error renew
$d
, stop now."
if
[
$_error_level
-gt
$NOTIFY_LEVEL_SKIP
]
;
then
_ret
=
"
$rc
"
_error_level
=
"
$NOTIFY_LEVEL_SKIP
"
break
_notify_code
=
$RENEW_SKIP
else
fi
_ret
=
"
$rc
"
if
[
"
$ACME_IN_CRON
"
]
;
then
_err
"Error renew
$d
."
if
[
"
$NOTIFY_LEVEL
"
]
&&
[
$NOTIFY_LEVEL
-ge
$NOTIFY_LEVEL_SKIP
]
;
then
if
[
"
$NOTIFY_MODE
"
=
"
$NOTIFY_MODE_CERT
"
]
;
then
_send_notify
"Renew
$d
skipped"
"Good, the cert is skipped."
"
$NOTIFY_HOOK
"
"
$RENEW_SKIP
"
fi
fi
fi
fi
fi
_info
"Skipped
$d
"
_skipped_msg
=
"
${
_skipped_msg
}
$d
"
else
else
_success_msg
=
"
${
_success_msg
}
$d
if
[
$_error_level
-gt
$NOTIFY_LEVEL_ERROR
]
;
then
_error_level
=
"
$NOTIFY_LEVEL_ERROR
"
_notify_code
=
1
fi
if
[
"
$ACME_IN_CRON
"
]
;
then
if
[
"
$NOTIFY_LEVEL
"
]
&&
[
$NOTIFY_LEVEL
-ge
$NOTIFY_LEVEL_ERROR
]
;
then
if
[
"
$NOTIFY_MODE
"
=
"
$NOTIFY_MODE_CERT
"
]
;
then
_send_notify
"Renew
$d
error"
"There is an error."
"
$NOTIFY_HOOK
"
1
fi
fi
fi
_error_msg
=
"
${
_error_msg
}
$d
"
"
if
[
"
$_stopRenewOnError
"
]
;
then
_err
"Error renew
$d
, stop now."
_ret
=
"
$rc
"
break
else
_ret
=
"
$rc
"
_err
"Error renew
$d
."
fi
fi
fi
done
done
_debug _error_level
"
$_error_level
"
if
[
"
$IN_CRON
"
=
"1"
]
;
then
if
[
"
$
ACME_
IN_CRON
"
]
&&
[
$_error_level
-le
$NOTIFY_LEVEL
]
;
then
if
[
-z
"
$NOTIFY_MODE
"
]
||
[
"
$NOTIFY_MODE
"
=
"
$NOTIFY_MODE_BULK
"
]
;
then
if
[
-z
"
$NOTIFY_MODE
"
]
||
[
"
$NOTIFY_MODE
"
=
"
$NOTIFY_MODE_BULK
"
]
;
then
_msg_subject
=
"Renew"
_msg_subject
=
"Renew"
if
[
"
$_error_msg
"
]
;
then
if
[
"
$_error_msg
"
]
;
then
_msg_subject
=
"
${
_msg_subject
}
Error"
_msg_subject
=
"
${
_msg_subject
}
Error"
_msg_data
=
"Error certs:
${
_error_msg
}
"
fi
fi
if
[
"
$_success_msg
"
]
;
then
if
[
"
$_success_msg
"
]
;
then
_msg_subject
=
"
${
_msg_subject
}
Success"
_msg_subject
=
"
${
_msg_subject
}
Success"
_msg_data
=
"
${
_msg_data
}
Success certs:
${
_success_msg
}
"
fi
fi
if
[
"
$_skipped_msg
"
]
;
then
if
[
"
$_skipped_msg
"
]
;
then
_msg_subject
=
"
${
_msg_subject
}
Skipped"
_msg_subject
=
"
${
_msg_subject
}
Skipped"
fi
_msg_data
=
"
${
_msg_data
}
Skipped certs:
_msg_data
=
"Error certs:
${
_skipped_msg
}
${
_error_msg
}
Success certs:
${
_success_msg
}
Skipped certs:
$_skipped_msg
"
"
_send_notify
"
$_msg_subject
"
"
$_msg_data
"
"
$NOTIFY_HOOK
"
0
fi
_send_notify
"
$_msg_subject
"
"
$_msg_data
"
"
$NOTIFY_HOOK
"
"
$_notify_code
"
fi
fi
fi
fi
...
@@ -5708,7 +5721,7 @@ install() {
...
@@ -5708,7 +5721,7 @@ install() {
_debug
"Skip install cron job"
_debug
"Skip install cron job"
fi
fi
if
[
"
$IN_CRON
"
!=
"1"
]
;
then
if
[
"
$
ACME_
IN_CRON
"
!=
"1"
]
;
then
if
!
_precheck
"
$_nocron
"
;
then
if
!
_precheck
"
$_nocron
"
;
then
_err
"Pre-check failed, can not install."
_err
"Pre-check failed, can not install."
return
1
return
1
...
@@ -5765,7 +5778,7 @@ install() {
...
@@ -5765,7 +5778,7 @@ install() {
_info
"Installed to
$LE_WORKING_DIR
/
$PROJECT_ENTRY
"
_info
"Installed to
$LE_WORKING_DIR
/
$PROJECT_ENTRY
"
if
[
"
$IN_CRON
"
!=
"1"
]
&&
[
-z
"
$_noprofile
"
]
;
then
if
[
"
$
ACME_
IN_CRON
"
!=
"1"
]
&&
[
-z
"
$_noprofile
"
]
;
then
_installalias
"
$_c_home
"
_installalias
"
$_c_home
"
fi
fi
...
@@ -5863,7 +5876,7 @@ _uninstallalias() {
...
@@ -5863,7 +5876,7 @@ _uninstallalias() {
}
}
cron
()
{
cron
()
{
export
IN_CRON
=
1
export
ACME_
IN_CRON
=
1
_initpath
_initpath
_info
"
$(
__green
"===Starting cron==="
)
"
_info
"
$(
__green
"===Starting cron==="
)
"
if
[
"
$AUTO_UPGRADE
"
=
"1"
]
;
then
if
[
"
$AUTO_UPGRADE
"
=
"1"
]
;
then
...
@@ -5884,7 +5897,7 @@ cron() {
...
@@ -5884,7 +5897,7 @@ cron() {
fi
fi
renewAll
renewAll
_ret
=
"
$?
"
_ret
=
"
$?
"
IN_CRON
=
""
ACME_
IN_CRON
=
""
_info
"
$(
__green
"===End cron==="
)
"
_info
"
$(
__green
"===End cron==="
)
"
exit
$_ret
exit
$_ret
}
}
...
@@ -6106,11 +6119,11 @@ Parameters:
...
@@ -6106,11 +6119,11 @@ Parameters:
--notify-level 0|1|2|3 Set the notification level: Default value is
$NOTIFY_LEVEL_DEFAULT
.
--notify-level 0|1|2|3 Set the notification level: Default value is
$NOTIFY_LEVEL_DEFAULT
.
0: disabled, no notification will be sent.
0: disabled, no notification will be sent.
1: send notification only when there is an error.
1: send notification
s
only when there is an error.
2: send notification when a cert is successfully renewed, or there is an error
2: send notification
s
when a cert is successfully renewed, or there is an error
.
3: send notification when a cert is skipped, renew
d
d, or error
3: send notification
s
when a cert is skipped, renew
e
d, or error
.
--notify-mode 0|1 Set notification mode. Default value is
$NOTIFY_MODE_DEFAULT
.
--notify-mode 0|1 Set notification mode. Default value is
$NOTIFY_MODE_DEFAULT
.
0: Bulk mode. Send all the domain's notifications in one message(mail)
0: Bulk mode. Send all the domain's notifications in one message(mail)
.
1: Cert mode. Send a message for every single cert.
1: Cert mode. Send a message for every single cert.
--notify-hook [hookname] Set the notify hook
--notify-hook [hookname] Set the notify hook
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment