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
af1cc3b3
Commit
af1cc3b3
authored
Feb 19, 2017
by
neilpang
Browse files
refactor params
parent
f845b371
Changes
1
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
af1cc3b3
...
@@ -2707,6 +2707,7 @@ _clearupwebbroot() {
...
@@ -2707,6 +2707,7 @@ _clearupwebbroot() {
}
}
_on_before_issue
()
{
_on_before_issue
()
{
_chk_web_roots
=
"
$1
"
_debug _on_before_issue
_debug _on_before_issue
#run pre hook
#run pre hook
if
[
"
$Le_PreHook
"
]
;
then
if
[
"
$Le_PreHook
"
]
;
then
...
@@ -2719,7 +2720,7 @@ _on_before_issue() {
...
@@ -2719,7 +2720,7 @@ _on_before_issue() {
fi
fi
fi
fi
if
_hasfield
"
$
Le_W
ebroot
"
"
$NO_VALUE
"
;
then
if
_hasfield
"
$
_chk_w
eb
_
root
s
"
"
$NO_VALUE
"
;
then
if
!
_exists
"nc"
;
then
if
!
_exists
"nc"
;
then
_err
"Please install netcat(nc) tools first."
_err
"Please install netcat(nc) tools first."
return
1
return
1
...
@@ -2734,7 +2735,7 @@ _on_before_issue() {
...
@@ -2734,7 +2735,7 @@ _on_before_issue() {
_addrIndex
=
1
_addrIndex
=
1
for
d
in
$alldomains
;
do
for
d
in
$alldomains
;
do
_debug
"Check for domain"
"
$d
"
_debug
"Check for domain"
"
$d
"
_currentRoot
=
"
$(
_getfield
"
$
Le_W
ebroot
"
$_index
)
"
_currentRoot
=
"
$(
_getfield
"
$
_chk_w
eb
_
root
s
"
$_index
)
"
_debug
"_currentRoot"
"
$_currentRoot
"
_debug
"_currentRoot"
"
$_currentRoot
"
_index
=
$(
_math
$_index
+ 1
)
_index
=
$(
_math
$_index
+ 1
)
_checkport
=
""
_checkport
=
""
...
@@ -2777,7 +2778,7 @@ _on_before_issue() {
...
@@ -2777,7 +2778,7 @@ _on_before_issue() {
fi
fi
done
done
if
_hasfield
"
$
Le_W
ebroot
"
"apache"
;
then
if
_hasfield
"
$
_chk_w
eb
_
root
s
"
"apache"
;
then
if
!
_setApache
;
then
if
!
_setApache
;
then
_err
"set up apache error. Report error to me."
_err
"set up apache error. Report error to me."
return
1
return
1
...
@@ -3027,11 +3028,11 @@ issue() {
...
@@ -3027,11 +3028,11 @@ issue() {
_usage
"Usage:
$PROJECT_ENTRY
--issue -d a.com -w /path/to/webroot/a.com/ "
_usage
"Usage:
$PROJECT_ENTRY
--issue -d a.com -w /path/to/webroot/a.com/ "
return
1
return
1
fi
fi
Le_W
ebroot
=
"
$1
"
_w
eb
_
root
s
=
"
$1
"
Le_D
omain
=
"
$2
"
_main_d
omain
=
"
$2
"
Le_Alt
=
"
$3
"
Le_Alt
=
"
$3
"
if
_contains
"
$
Le_D
omain
"
","
;
then
if
_contains
"
$
_main_d
omain
"
","
;
then
Le_D
omain
=
$(
echo
"
$2
,
$3
"
|
cut
-d
,
-f
1
)
_main_d
omain
=
$(
echo
"
$2
,
$3
"
|
cut
-d
,
-f
1
)
Le_Alt
=
$(
echo
"
$2
,
$3
"
|
cut
-d
,
-f
2- |
sed
"s/,
${
NO_VALUE
}
$/
/"
)
Le_Alt
=
$(
echo
"
$2
,
$3
"
|
cut
-d
,
-f
2- |
sed
"s/,
${
NO_VALUE
}
$/
/"
)
fi
fi
Le_Keylength
=
"
$4
"
Le_Keylength
=
"
$4
"
...
@@ -3046,19 +3047,19 @@ issue() {
...
@@ -3046,19 +3047,19 @@ issue() {
Le_LocalAddress
=
"
${
13
}
"
Le_LocalAddress
=
"
${
13
}
"
#remove these later.
#remove these later.
if
[
"
$
Le_W
ebroot
"
=
"dns-cf"
]
;
then
if
[
"
$
_w
eb
_
root
s
"
=
"dns-cf"
]
;
then
Le_W
ebroot
=
"dns_cf"
_w
eb
_
root
s
=
"dns_cf"
fi
fi
if
[
"
$
Le_W
ebroot
"
=
"dns-dp"
]
;
then
if
[
"
$
_w
eb
_
root
s
"
=
"dns-dp"
]
;
then
Le_W
ebroot
=
"dns_dp"
_w
eb
_
root
s
=
"dns_dp"
fi
fi
if
[
"
$
Le_W
ebroot
"
=
"dns-cx"
]
;
then
if
[
"
$
_w
eb
_
root
s
"
=
"dns-cx"
]
;
then
Le_W
ebroot
=
"dns_cx"
_w
eb
_
root
s
=
"dns_cx"
fi
fi
_debug
"Using api:
$API
"
_debug
"Using api:
$API
"
if
[
!
"
$IS_RENEW
"
]
;
then
if
[
!
"
$IS_RENEW
"
]
;
then
_initpath
"
$
Le_D
omain
"
"
$Le_Keylength
"
_initpath
"
$
_main_d
omain
"
"
$Le_Keylength
"
mkdir
-p
"
$DOMAIN_PATH
"
mkdir
-p
"
$DOMAIN_PATH
"
fi
fi
...
@@ -3070,7 +3071,7 @@ issue() {
...
@@ -3070,7 +3071,7 @@ issue() {
_debug _saved_domain
"
$_saved_domain
"
_debug _saved_domain
"
$_saved_domain
"
_saved_alt
=
$(
_readdomainconf Le_Alt
)
_saved_alt
=
$(
_readdomainconf Le_Alt
)
_debug _saved_alt
"
$_saved_alt
"
_debug _saved_alt
"
$_saved_alt
"
if
[
"
$_saved_domain
,
$_saved_alt
"
=
"
$
Le_D
omain
,
$Le_Alt
"
]
;
then
if
[
"
$_saved_domain
,
$_saved_alt
"
=
"
$
_main_d
omain
,
$Le_Alt
"
]
;
then
_info
"Domains not changed."
_info
"Domains not changed."
_info
"Skip, Next renewal time is:
$(
__green
"
$(
_readdomainconf Le_NextRenewTimeStr
)
"
)
"
_info
"Skip, Next renewal time is:
$(
__green
"
$(
_readdomainconf Le_NextRenewTimeStr
)
"
)
"
_info
"Add '
$(
__red
'--force'
)
' to force to renew."
_info
"Add '
$(
__red
'--force'
)
' to force to renew."
...
@@ -3081,9 +3082,9 @@ issue() {
...
@@ -3081,9 +3082,9 @@ issue() {
fi
fi
fi
fi
_savedomainconf
"Le_Domain"
"
$
Le_D
omain
"
_savedomainconf
"Le_Domain"
"
$
_main_d
omain
"
_savedomainconf
"Le_Alt"
"
$Le_Alt
"
_savedomainconf
"Le_Alt"
"
$Le_Alt
"
_savedomainconf
"Le_Webroot"
"
$
Le_W
ebroot
"
_savedomainconf
"Le_Webroot"
"
$
_w
eb
_
root
s
"
_savedomainconf
"Le_PreHook"
"
$Le_PreHook
"
_savedomainconf
"Le_PreHook"
"
$Le_PreHook
"
_savedomainconf
"Le_PostHook"
"
$Le_PostHook
"
_savedomainconf
"Le_PostHook"
"
$Le_PostHook
"
...
@@ -3106,7 +3107,7 @@ issue() {
...
@@ -3106,7 +3107,7 @@ issue() {
Le_Keylength
=
""
Le_Keylength
=
""
fi
fi
if
!
_on_before_issue
;
then
if
!
_on_before_issue
"
$_web_roots
"
;
then
_err
"_on_before_issue."
_err
"_on_before_issue."
return
1
return
1
fi
fi
...
@@ -3129,7 +3130,7 @@ issue() {
...
@@ -3129,7 +3130,7 @@ issue() {
_key
=
$(
_readdomainconf Le_Keylength
)
_key
=
$(
_readdomainconf Le_Keylength
)
_debug
"Read key length:
$_key
"
_debug
"Read key length:
$_key
"
if
[
!
-f
"
$CERT_KEY_PATH
"
]
||
[
"
$Le_Keylength
"
!=
"
$_key
"
]
;
then
if
[
!
-f
"
$CERT_KEY_PATH
"
]
||
[
"
$Le_Keylength
"
!=
"
$_key
"
]
;
then
if
!
createDomainKey
"
$
Le_D
omain
"
"
$Le_Keylength
"
;
then
if
!
createDomainKey
"
$
_main_d
omain
"
"
$Le_Keylength
"
;
then
_err
"Create domain key error."
_err
"Create domain key error."
_clearup
_clearup
_on_issue_err
_on_issue_err
...
@@ -3137,7 +3138,7 @@ issue() {
...
@@ -3137,7 +3138,7 @@ issue() {
fi
fi
fi
fi
if
!
_createcsr
"
$
Le_D
omain
"
"
$Le_Alt
"
"
$CERT_KEY_PATH
"
"
$CSR_PATH
"
"
$DOMAIN_SSL_CONF
"
;
then
if
!
_createcsr
"
$
_main_d
omain
"
"
$Le_Alt
"
"
$CERT_KEY_PATH
"
"
$CSR_PATH
"
"
$DOMAIN_SSL_CONF
"
;
then
_err
"Create CSR error."
_err
"Create CSR error."
_clearup
_clearup
_on_issue_err
_on_issue_err
...
@@ -3153,12 +3154,12 @@ issue() {
...
@@ -3153,12 +3154,12 @@ issue() {
sep
=
'#'
sep
=
'#'
dvsep
=
','
dvsep
=
','
if
[
-z
"
$vlist
"
]
;
then
if
[
-z
"
$vlist
"
]
;
then
alldomains
=
$(
echo
"
$
Le_D
omain
,
$Le_Alt
"
|
tr
','
' '
)
alldomains
=
$(
echo
"
$
_main_d
omain
,
$Le_Alt
"
|
tr
','
' '
)
_index
=
1
_index
=
1
_currentRoot
=
""
_currentRoot
=
""
for
d
in
$alldomains
;
do
for
d
in
$alldomains
;
do
_info
"Getting webroot for domain"
"
$d
"
_info
"Getting webroot for domain"
"
$d
"
_w
=
"
$(
echo
$
Le_W
ebroot
|
cut
-d
,
-f
$_index
)
"
_w
=
"
$(
echo
$
_w
eb
_
root
s
|
cut
-d
,
-f
$_index
)
"
_debug _w
"
$_w
"
_debug _w
"
$_w
"
if
[
"
$_w
"
]
;
then
if
[
"
$_w
"
]
;
then
_currentRoot
=
"
$_w
"
_currentRoot
=
"
$_w
"
...
...
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