Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
8c841b97
Commit
8c841b97
authored
Dec 27, 2015
by
neil
Browse files
debug info and check error
parent
23c46ba1
Changes
1
Hide whitespace changes
Inline
Side-by-side
le.sh
View file @
8c841b97
...
@@ -25,7 +25,8 @@ API=$DEFAULT_CA
...
@@ -25,7 +25,8 @@ API=$DEFAULT_CA
_debug
()
{
_debug
()
{
if
!
[
"
$DEBUG
"
]
;
then
if
[
-z
"
$DEBUG
"
]
;
then
return
return
fi
fi
...
@@ -149,7 +150,7 @@ _send_signed_request() {
...
@@ -149,7 +150,7 @@ _send_signed_request() {
CURL_HEADER
=
"
$WORKING_DIR
/curl.header"
CURL_HEADER
=
"
$WORKING_DIR
/curl.header"
dp
=
"
$WORKING_DIR
/curl.dump"
dp
=
"
$WORKING_DIR
/curl.dump"
CURL
=
"curl --silent --dump-header
$CURL_HEADER
"
CURL
=
"curl --silent --dump-header
$CURL_HEADER
"
if
[
"DEBUG"
]
;
then
if
[
"
$
DEBUG
"
]
;
then
CURL
=
"
$CURL
--trace-ascii
$dp
"
CURL
=
"
$CURL
--trace-ascii
$dp
"
fi
fi
payload64
=
$(
echo
-n
$payload
|
base64
| _b64
)
payload64
=
$(
echo
-n
$payload
|
base64
| _b64
)
...
@@ -212,7 +213,7 @@ _setopt() {
...
@@ -212,7 +213,7 @@ _setopt() {
if
[
!
-f
$__conf
]
;
then
if
[
!
-f
$__conf
]
;
then
touch
$__conf
touch
$__conf
fi
fi
if
grep
-H
-n
"^
$__opt$__sep
"
$__conf
;
then
if
grep
-H
-n
"^
$__opt$__sep
"
$__conf
>
/dev/null
;
then
_debug OK
_debug OK
sed
-i
"s|^
$__opt$__sep
.*
$|$__opt$__sep$__val$__end
|"
$__conf
sed
-i
"s|^
$__opt$__sep
.*
$|$__opt$__sep$__val$__end
|"
$__conf
else
else
...
@@ -401,27 +402,34 @@ issue() {
...
@@ -401,27 +402,34 @@ issue() {
der
=
$(
openssl req
-in
$CSR_PATH
-outform
DER |
base64
| _b64
)
der
=
$(
openssl req
-in
$CSR_PATH
-outform
DER |
base64
| _b64
)
_send_signed_request
"
$API
/acme/new-cert"
"{
\"
resource
\"
:
\"
new-cert
\"
,
\"
csr
\"
:
\"
$der
\"
}"
"needbas64"
_send_signed_request
"
$API
/acme/new-cert"
"{
\"
resource
\"
:
\"
new-cert
\"
,
\"
csr
\"
:
\"
$der
\"
}"
"needbas64"
echo
-----BEGIN
CERTIFICATE-----
>
$CERT_PATH
echo
$response
|
sed
"s/ /
\n
/g"
>>
$CERT_PATH
echo
-----END
CERTIFICATE-----
>>
$CERT_PATH
_info
"Cert success."
cat
$CERT_PATH
_info
"Your cert is in
$CERT_PATH
"
Le_LinkCert
=
$(
grep
-i
'^Location'
$CURL_HEADER
|
cut
-d
" "
-f
2
)
_setopt
$DOMAIN_CONF
"Le_LinkCert"
"="
"
$Le_LinkCert
"
if
[
"
$Le_LinkCert
"
]
;
then
echo
-----BEGIN
CERTIFICATE-----
>
$CERT_PATH
echo
$response
|
sed
"s/ /
\n
/g"
>>
$CERT_PATH
echo
-----END
CERTIFICATE-----
>>
$CERT_PATH
_info
"Cert success."
cat
$CERT_PATH
_info
"Your cert is in
$CERT_PATH
"
fi
_setopt
$DOMAIN_CONF
"Le_Domain"
"="
"
$Le_Domain
"
_setopt
$DOMAIN_CONF
"Le_Domain"
"="
"
$Le_Domain
"
_setopt
$DOMAIN_CONF
"Le_Alt"
"="
"
$Le_Alt
"
_setopt
$DOMAIN_CONF
"Le_Alt"
"="
"
$Le_Alt
"
_setopt
$DOMAIN_CONF
"Le_Webroot"
"="
"
$Le_Webroot
"
_setopt
$DOMAIN_CONF
"Le_Webroot"
"="
"
$Le_Webroot
"
_setopt
$DOMAIN_CONF
"Le_Keylength"
"="
"
$Le_Keylength
"
_setopt
$DOMAIN_CONF
"Le_Keylength"
"="
"
$Le_Keylength
"
if
[
-z
"
$Le_LinkCert
"
]
;
then
_info
"Sign failed, ToDO"
return
1
fi
Le_LinkIssuer
=
$(
grep
-i
'^Link'
$CURL_HEADER
|
cut
-d
" "
-f
2|
cut
-d
';'
-f
1 |
sed
's/<//g'
|
sed
's/>//g'
)
Le_LinkIssuer
=
$(
grep
-i
'^Link'
$CURL_HEADER
|
cut
-d
" "
-f
2|
cut
-d
';'
-f
1 |
sed
's/<//g'
|
sed
's/>//g'
)
_setopt
$DOMAIN_CONF
"Le_LinkIssuer"
"="
"
$Le_LinkIssuer
"
_setopt
$DOMAIN_CONF
"Le_LinkIssuer"
"="
"
$Le_LinkIssuer
"
Le_LinkCert
=
$(
grep
-i
'^Location'
$CURL_HEADER
|
cut
-d
" "
-f
2
)
_setopt
$DOMAIN_CONF
"Le_LinkCert"
"="
"
$Le_LinkCert
"
Le_CertCreateTime
=
$(
date
-u
"+%s"
)
Le_CertCreateTime
=
$(
date
-u
"+%s"
)
_setopt
$DOMAIN_CONF
"Le_CertCreateTime"
"="
"
$Le_CertCreateTime
"
_setopt
$DOMAIN_CONF
"Le_CertCreateTime"
"="
"
$Le_CertCreateTime
"
...
...
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