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
b3d97132
Commit
b3d97132
authored
Jan 26, 2016
by
neil
Browse files
Merge branch 'master' of
https://github.com/Neilpang/le
parents
0fda2a1d
585f46c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
le.sh
View file @
b3d97132
...
@@ -43,6 +43,21 @@ _err() {
...
@@ -43,6 +43,21 @@ _err() {
fi
fi
}
}
_h2b
()
{
hex
=
$(
cat
)
i
=
1
j
=
2
while
[
'1'
]
;
do
h
=
$(
printf
$hex
|
cut
-c
$i
-
$j
)
if
[
-z
"
$h
"
]
;
then
break
;
fi
printf
"
\x
$h
"
let
"i+=2"
let
"j+=2"
done
}
#domain [2048]
#domain [2048]
createAccountKey
()
{
createAccountKey
()
{
if
[
-z
"
$1
"
]
;
then
if
[
-z
"
$1
"
]
;
then
...
@@ -500,11 +515,11 @@ issue() {
...
@@ -500,11 +515,11 @@ issue() {
fi
fi
_debug pub_exp
"
$pub_exp
"
_debug pub_exp
"
$pub_exp
"
e
=
$(
echo
$pub_exp
|
xxd
-r
-p
|
base64
)
e
=
$(
echo
$pub_exp
|
_h2b
|
base64
)
_debug e
"
$e
"
_debug e
"
$e
"
modulus
=
$(
openssl rsa
-in
$ACCOUNT_KEY_PATH
-modulus
-noout
|
cut
-d
'='
-f
2
)
modulus
=
$(
openssl rsa
-in
$ACCOUNT_KEY_PATH
-modulus
-noout
|
cut
-d
'='
-f
2
)
n
=
$(
echo
$modulus
|
xxd
-r
-p
|
base64
-w
0 | _b64
)
n
=
$(
echo
$modulus
|
_h2b
|
base64
-w
0 | _b64
)
jwk
=
'{"e": "'
$e
'", "kty": "RSA", "n": "'
$n
'"}'
jwk
=
'{"e": "'
$e
'", "kty": "RSA", "n": "'
$n
'"}'
...
@@ -513,7 +528,7 @@ issue() {
...
@@ -513,7 +528,7 @@ issue() {
_debug HEADER
"
$HEADER
"
_debug HEADER
"
$HEADER
"
accountkey_json
=
$(
echo
-n
"
$jwk
"
|
sed
"s/ //g"
)
accountkey_json
=
$(
echo
-n
"
$jwk
"
|
sed
"s/ //g"
)
thumbprint
=
$(
echo
-n
"
$accountkey_json
"
|
sha256sum
|
xxd
-r
-p
|
base64
-w
0 | _b64
)
thumbprint
=
$(
echo
-n
"
$accountkey_json
"
|
sha256sum
|
_h2b
|
base64
-w
0 | _b64
)
_info
"Registering account"
_info
"Registering account"
...
@@ -586,7 +601,7 @@ issue() {
...
@@ -586,7 +601,7 @@ issue() {
dnsadded
=
'0'
dnsadded
=
'0'
txtdomain
=
"_acme-challenge.
$d
"
txtdomain
=
"_acme-challenge.
$d
"
_debug txtdomain
"
$txtdomain
"
_debug txtdomain
"
$txtdomain
"
txt
=
"
$(
echo
-e
-n
$keyauthorization
|
sha256sum
|
xxd
-r
-p
|
base64
-w
0 | _b64
)
"
txt
=
"
$(
echo
-e
-n
$keyauthorization
|
sha256sum
|
_h2b
|
base64
-w
0 | _b64
)
"
_debug txt
"
$txt
"
_debug txt
"
$txt
"
#dns
#dns
#1. check use api
#1. check use api
...
@@ -940,12 +955,6 @@ install() {
...
@@ -940,12 +955,6 @@ install() {
_err
"
$INSTALL
openssl"
_err
"
$INSTALL
openssl"
return
1
return
1
fi
fi
if
!
command
-v
"xxd"
>
/dev/null
;
then
_err
"Please install xxd first."
_err
"CentOs: yum install vim-common"
return
1
fi
_info
"Installing to
$WORKING_DIR
"
_info
"Installing to
$WORKING_DIR
"
...
...
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