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
da2eeda9
Commit
da2eeda9
authored
Feb 10, 2016
by
Lukas Schauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some zsh quirks
parent
85a25b56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
letsencrypt.sh
letsencrypt.sh
+13
-8
No files found.
letsencrypt.sh
View file @
da2eeda9
...
...
@@ -6,6 +6,7 @@
set
-e
set
-u
set
-o
pipefail
[[
-n
"
${
ZSH_VERSION
:-}
"
]]
&&
set
-o
SH_WORD_SPLIT
&&
set
+o FUNCTION_ARGZERO
umask
077
# paranoid umask, we're creating private keys
# duplicate scripts IO handles
...
...
@@ -342,7 +343,11 @@ sign_csr() {
fi
local
idx
=
0
local
-a
challenge_uris challenge_tokens keyauths deploy_args
if
[[
-n
"
${
ZSH_VERSION
:-}
"
]]
;
then
local
-A
challenge_uris challenge_tokens keyauths deploy_args
else
local
-a
challenge_uris challenge_tokens keyauths deploy_args
fi
# Request challenges
for
altname
in
${
altnames
}
;
do
# Ask the acme-server for new challenge token and extract them from the resulting json block
...
...
@@ -399,12 +404,12 @@ sign_csr() {
echo
" + Responding to challenge for
${
altname
}
..."
result
=
"
$(
signed_request
"
${
challenge_uris
[
$idx
]
}
"
'{"resource": "challenge", "keyAuthorization": "'
"
${
keyauth
}
"
'"}'
)
"
status
=
"
$(
printf
'%s\n'
"
${
result
}
"
| get_json_string_value status
)
"
req
status
=
"
$(
printf
'%s\n'
"
${
result
}
"
| get_json_string_value status
)
"
while
[[
"
${
status
}
"
=
"pending"
]]
;
do
while
[[
"
${
req
status
}
"
=
"pending"
]]
;
do
sleep
1
result
=
"
$(
http_request get
"
${
challenge_uris
[
$idx
]
}
"
)
"
status
=
"
$(
printf
'%s\n'
"
${
result
}
"
| get_json_string_value status
)
"
req
status
=
"
$(
printf
'%s\n'
"
${
result
}
"
| get_json_string_value status
)
"
done
[[
"
${
CHALLENGETYPE
}
"
=
"http-01"
]]
&&
rm
-f
"
${
WELLKNOWN
}
/
${
challenge_token
}
"
...
...
@@ -415,7 +420,7 @@ sign_csr() {
fi
idx
=
$((
idx+1
))
if
[[
"
${
status
}
"
=
"valid"
]]
;
then
if
[[
"
${
req
status
}
"
=
"valid"
]]
;
then
echo
" + Challenge is valid!"
else
break
...
...
@@ -425,7 +430,7 @@ sign_csr() {
# Wait for hook script to clean the challenges if used
[[
-n
"
${
HOOK
}
"
]]
&&
[[
"
${
HOOK_CHAIN
}
"
=
"yes"
]]
&&
${
HOOK
}
"clean_challenge"
${
deploy_args
[@]
}
if
[[
"
${
status
}
"
!=
"valid"
]]
;
then
if
[[
"
${
req
status
}
"
!=
"valid"
]]
;
then
# Clean up any remaining challenge_tokens if we stopped early
if
[[
"
${
CHALLENGETYPE
}
"
=
"http-01"
]]
;
then
while
[
$idx
-lt
${#
challenge_tokens
[@]
}
]
;
do
...
...
@@ -434,7 +439,7 @@ sign_csr() {
done
fi
_exiterr
"Challenge is invalid! (returned:
${
status
}
) (result:
${
result
}
)"
_exiterr
"Challenge is invalid! (returned:
${
req
status
}
) (result:
${
result
}
)"
fi
# Finally request certificate from the acme-server and store it in cert-${timestamp}.pem and link from cert.pem
...
...
@@ -696,7 +701,7 @@ main() {
[[
-z
"
${
@
}
"
]]
&&
eval set
--
"--help"
while
((
"
${#}
"
))
;
do
while
((
${#}
))
;
do
case
"
${
1
}
"
in
--help
|
-h
)
command_help
...
...
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