Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
letsencrypt.sh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
letsencrypt.sh
Commits
3a9e97f9
Commit
3a9e97f9
authored
Jan 08, 2016
by
Lukas Schauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed _request method to http_request
parent
ab4ad412
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
letsencrypt.sh
letsencrypt.sh
+7
-7
No files found.
letsencrypt.sh
View file @
3a9e97f9
...
...
@@ -98,7 +98,7 @@ init_system() {
export
CONFIG
# Get CA URLs
CA_DIRECTORY
=
"
$(
_request get
"
${
CA
}
"
)
"
CA_DIRECTORY
=
"
$(
http
_request get
"
${
CA
}
"
)
"
CA_NEW_CERT
=
"
$(
printf
"%s"
"
${
CA_DIRECTORY
}
"
| get_json_string_value new-cert
)
"
&&
CA_NEW_AUTHZ
=
"
$(
printf
"%s"
"
${
CA_DIRECTORY
}
"
| get_json_string_value new-authz
)
"
&&
CA_NEW_REG
=
"
$(
printf
"%s"
"
${
CA_DIRECTORY
}
"
| get_json_string_value new-reg
)
"
&&
...
...
@@ -200,7 +200,7 @@ get_json_array() {
grep
-Eo
'"'
"
${
1
}
"
'":[^\[]*\[[^]]*]'
}
_request
()
{
http
_request
()
{
tempcont
=
"
$(
mktemp
)
"
if
[[
"
${
1
}
"
=
"head"
]]
;
then
...
...
@@ -256,7 +256,7 @@ signed_request() {
payload64
=
"
$(
printf
'%s'
"
${
2
}
"
| urlbase64
)
"
# Retrieve nonce from acme-server
nonce
=
"
$(
_request
head
"
${
CA
}
"
|
grep
Replay-Nonce: |
awk
-F
': '
'{print $2}'
| anti_newline
)
"
nonce
=
"
$(
http
_request
head
"
${
CA
}
"
|
grep
Replay-Nonce: |
awk
-F
': '
'{print $2}'
| anti_newline
)
"
# Build header with just our public key and algorithm information
header
=
'{"alg": "RS256", "jwk": {"e": "'
"
${
pubExponent64
}
"
'", "kty": "RSA", "n": "'
"
${
pubMod64
}
"
'"}}'
...
...
@@ -271,7 +271,7 @@ signed_request() {
# Send header + extended header + payload + signature to the acme-server
data
=
'{"header": '
"
${
header
}
"
', "protected": "'
"
${
protected64
}
"
'", "payload": "'
"
${
payload64
}
"
'", "signature": "'
"
${
signed64
}
"
'"}'
_request post
"
${
1
}
"
"
${
data
}
"
http
_request post
"
${
1
}
"
"
${
data
}
"
}
sign_domain
()
{
...
...
@@ -351,7 +351,7 @@ sign_domain() {
# get status until a result is reached => not pending anymore
while
[[
"
${
status
}
"
=
"pending"
]]
;
do
sleep
1
status
=
"
$(
_request get
"
${
challenge_uri
}
"
| get_json_string_value status
)
"
status
=
"
$(
http
_request get
"
${
challenge_uri
}
"
| get_json_string_value status
)
"
done
rm
-f
"
${
WELLKNOWN
}
/
${
challenge_token
}
"
...
...
@@ -383,7 +383,7 @@ sign_domain() {
# Create fullchain.pem
echo
" + Creating fullchain.pem..."
cat
"
${
crt_path
}
"
>
"
${
BASEDIR
}
/certs/
${
domain
}
/fullchain-
${
timestamp
}
.pem"
_request get
"
$(
openssl x509
-in
"
${
BASEDIR
}
/certs/
${
domain
}
/cert-
${
timestamp
}
.pem"
-noout
-text
|
grep
'CA Issuers - URI:'
|
cut
-d
':'
-f2-
)
"
>
"
${
BASEDIR
}
/certs/
${
domain
}
/chain-
${
timestamp
}
.pem"
http
_request get
"
$(
openssl x509
-in
"
${
BASEDIR
}
/certs/
${
domain
}
/cert-
${
timestamp
}
.pem"
-noout
-text
|
grep
'CA Issuers - URI:'
|
cut
-d
':'
-f2-
)
"
>
"
${
BASEDIR
}
/certs/
${
domain
}
/chain-
${
timestamp
}
.pem"
if
!
grep
"BEGIN CERTIFICATE"
"
${
BASEDIR
}
/certs/
${
domain
}
/chain-
${
timestamp
}
.pem"
>
/dev/null 2>&1
;
then
openssl x509
-in
"
${
BASEDIR
}
/certs/
${
domain
}
/chain-
${
timestamp
}
.pem"
-inform
DER
-out
"
${
BASEDIR
}
/certs/
${
domain
}
/chain-
${
timestamp
}
.pem"
-outform
PEM
fi
...
...
@@ -503,7 +503,7 @@ command_revoke() {
fi
cert64
=
"
$(
openssl x509
-in
"
${
cert
}
"
-inform
PEM
-outform
DER | urlbase64
)
"
response
=
"
$(
signed_request
"
${
CA_REVOKE_CERT
}
"
'{"resource": "revoke-cert", "certificate": "'
"
${
cert64
}
"
'"}'
)
"
# if there is a problem with our revoke request _request (via signed_request) will report this and "exit 1" out
# if there is a problem with our revoke request
http
_request (via signed_request) will report this and "exit 1" out
# so if we are here, it is safe to assume the request was successful
echo
" + SUCCESS"
echo
" + renaming certificate to
${
cert
}
-revoked"
...
...
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