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
3cc587c2
Commit
3cc587c2
authored
Dec 07, 2015
by
Lukas Schauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
also store csr with timestamp and symlink to default location
parent
1f08fda7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
letsencrypt.sh
letsencrypt.sh
+5
-3
No files found.
letsencrypt.sh
View file @
3cc587c2
...
...
@@ -111,6 +111,8 @@ sign_domain() {
altnames
=
"
${
*
}
"
echo
" + Signing domains..."
timestamp
=
"
$(
date
+%s
)
"
# If there is no existing certificate directory => make it
if
[[
!
-e
"
${
BASEDIR
}
/certs/
${
domain
}
"
]]
;
then
echo
" + make directory
${
BASEDIR
}
/certs/
${
domain
}
..."
...
...
@@ -120,7 +122,6 @@ sign_domain() {
# generate a new private key if we need or want one
if
[[
!
-f
"
${
BASEDIR
}
/certs/
${
domain
}
/privkey.pem"
]]
||
[[
"
${
PRIVATE_KEY_RENEW
}
"
=
"yes"
]]
;
then
echo
" + Generating private key..."
timestamp
=
"
$(
date
+%s
)
"
openssl genrsa
-out
"
${
BASEDIR
}
/certs/
${
domain
}
/privkey-
${
timestamp
}
.pem"
"
${
KEYSIZE
}
"
2> /dev/null
>
/dev/null
rm
-f
"
${
BASEDIR
}
/certs/
${
domain
}
/privkey.pem"
ln
-s
"privkey-
${
timestamp
}
.pem"
"
${
BASEDIR
}
/certs/
${
domain
}
/privkey.pem"
...
...
@@ -133,7 +134,9 @@ sign_domain() {
done
SAN
=
"
${
SAN
%%,
}
"
echo
" + Generating signing request..."
openssl req
-new
-sha256
-key
"
${
BASEDIR
}
/certs/
${
domain
}
/privkey.pem"
-out
"
${
BASEDIR
}
/certs/
${
domain
}
/cert.csr"
-subj
"/CN=
${
domain
}
/"
-reqexts
SAN
-config
<
(
cat
"
${
OPENSSL_CNF
}
"
<
(
printf
"[SAN]
\n
subjectAltName=%s"
"
${
SAN
}
"
))
>
/dev/null
openssl req
-new
-sha256
-key
"
${
BASEDIR
}
/certs/
${
domain
}
/privkey.pem"
-out
"
${
BASEDIR
}
/certs/
${
domain
}
/cert-
${
timestamp
}
.csr"
-subj
"/CN=
${
domain
}
/"
-reqexts
SAN
-config
<
(
cat
"
${
OPENSSL_CNF
}
"
<
(
printf
"[SAN]
\n
subjectAltName=%s"
"
${
SAN
}
"
))
>
/dev/null
rm
-f
"
${
BASEDIR
}
/certs/
${
domain
}
/cert.csr"
ln
-s
"cert-
${
timestamp
}
.csr"
"
${
BASEDIR
}
/certs/
${
domain
}
/cert.csr"
# Request and respond to challenges
for
altname
in
$altnames
;
do
...
...
@@ -188,7 +191,6 @@ sign_domain() {
# Finally request certificate from the acme-server and store it in cert-${timestamp}.pem and link from cert.pem
echo
" + Requesting certificate..."
timestamp
=
"
$(
date
+%s
)
"
csr64
=
"
$(
openssl req
-in
"
${
BASEDIR
}
/certs/
${
domain
}
/cert.csr"
-outform
DER | urlbase64
)
"
crt64
=
"
$(
signed_request
"
${
CA
}
/acme/new-cert"
'{"resource": "new-cert", "csr": "'
"
${
csr64
}
"
'"}'
| openssl
base64
-e
)
"
printf
--
'-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----\n'
"
${
crt64
}
"
>
"
${
BASEDIR
}
/certs/
${
domain
}
/cert-
${
timestamp
}
.pem"
...
...
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