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
c24843c6
Commit
c24843c6
authored
Dec 08, 2015
by
et@corde.org
Committed by
Lukas Schauer
Dec 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A single HOOK to handle challenge, cleaning of challenge files and uploading of certs.
parent
15accf90
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
9 deletions
+36
-9
config.sh.example
config.sh.example
+10
-5
letsencrypt.sh
letsencrypt.sh
+26
-4
No files found.
config.sh.example
View file @
c24843c6
...
...
@@ -9,10 +9,16 @@
#OPENSSL_CNF=.... # system default (see openssl version -d)
#ROOTCERT="lets-encrypt-x1-cross-signed.pem"
# program called before responding to the challenge, arguments: path/to/token
# token; can be used to e.g. upload the challenge if this script doesn't run
# on the webserver
#HOOK_CHALLENGE=
# Program or function called in certain situations
#
# After generating the challenge-response, or after failed challenge
# Given arguments: clean_challenge|deploy_challenge token-filename token-content
#
# After successfully signing certificate
# Given arguments: deploy_cert path/to/privkey.pem path/to/cert.pem path/to/fullchain.pem
#
# BASEDIR and WELLKNOWN variables are exported and can be used in an external program
#HOOK=
# try to renew certs that are within RENEW_DAYS days of their expiration date
#RENEW_DAYS="14"
...
...
@@ -22,4 +28,3 @@
# email to use during the registration
#CONTACT_EMAIL=
letsencrypt.sh
View file @
c24843c6
...
...
@@ -7,7 +7,7 @@ set -o pipefail
# Default config values
CA
=
"https://acme-v01.api.letsencrypt.org"
LICENSE
=
"https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf"
HOOK
_CHALLENGE
=
HOOK
=
RENEW_DAYS
=
"14"
KEYSIZE
=
"4096"
WELLKNOWN
=
".acme-challenges"
...
...
@@ -29,6 +29,10 @@ BASEDIR="${BASEDIR%%/}"
umask
077
# paranoid umask, we're creating private keys
# Export some environment variables to be used in hook script
export
WELLKNOWN
export
BASEDIR
anti_newline
()
{
tr
-d
'\n\r'
}
...
...
@@ -78,6 +82,12 @@ _request() {
echo
"Details:"
>
&2
echo
"
$(
<
"
${
tempcont
}
"
)
)"
>
&2
rm
-f
"
${
tempcont
}
"
# Wait for hook script to clean the challenge if used
if
[[
-n
"
${
HOOK
}
"
]]
;
then
${
HOOK
}
"clean_challenge"
"
${
challenge_token
}
"
"
${
keyauth
}
"
fi
exit
1
fi
...
...
@@ -173,8 +183,8 @@ sign_domain() {
chmod
a+r
"
${
WELLKNOWN
}
/
${
challenge_token
}
"
# Wait for hook script to deploy the challenge if used
if
[
-n
"
${
HOOK_CHALLENGE
}
"
]
;
then
${
HOOK
_CHALLENGE
}
"
${
WELLKNOWN
}
/
${
challenge_token
}
"
"
${
keyauth
}
"
if
[
[
-n
"
${
HOOK
}
"
]
]
;
then
${
HOOK
}
"deploy_challenge"
"
${
challenge_token
}
"
"
${
keyauth
}
"
fi
# Ask the acme-server to verify our challenge and wait until it becomes valid
...
...
@@ -195,6 +205,12 @@ sign_domain() {
echo
" + Challenge is valid!"
else
echo
" + Challenge is invalid! (returned:
${
status
}
)"
# Wait for hook script to clean the challenge if used
if
[[
-n
"
${
HOOK
}
"
]]
&&
[[
-n
"
${
challenge_token
}
"
]]
;
then
${
HOOK
}
"clean_challenge"
"
${
challenge_token
}
"
"
${
keyauth
}
"
fi
exit
1
fi
...
...
@@ -231,6 +247,12 @@ sign_domain() {
rm
-f
"
${
BASEDIR
}
/certs/
${
domain
}
/cert.pem"
ln
-s
"cert-
${
timestamp
}
.pem"
"
${
BASEDIR
}
/certs/
${
domain
}
/cert.pem"
# Wait for hook script to clean the challenge and to deploy cert if used
if
[[
-n
"
${
HOOK
}
"
]]
;
then
${
HOOK
}
"deploy_cert"
"
${
BASEDIR
}
/certs/
${
domain
}
/privkey.pem"
"
${
BASEDIR
}
/certs/
${
domain
}
/cert.pem"
"
${
BASEDIR
}
/certs/
${
domain
}
/fullchain.pem"
fi
unset
challenge_token
echo
" + Done!"
}
...
...
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