Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
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
caddy
Commits
8548641d
Commit
8548641d
authored
Oct 27, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
letsencrypt: Check for errors
parent
c4689859
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
caddy/letsencrypt/letsencrypt.go
caddy/letsencrypt/letsencrypt.go
+9
-4
No files found.
caddy/letsencrypt/letsencrypt.go
View file @
8548641d
...
@@ -39,7 +39,7 @@ var OnRenew func() error
...
@@ -39,7 +39,7 @@ var OnRenew func() error
func
Activate
(
configs
[]
server
.
Config
)
([]
server
.
Config
,
error
)
{
func
Activate
(
configs
[]
server
.
Config
)
([]
server
.
Config
,
error
)
{
// First identify and configure any elligible hosts for which
// First identify and configure any elligible hosts for which
// we already have certs and keys in storage from last time.
// we already have certs and keys in storage from last time.
configLen
:=
len
(
configs
)
// avoid infinite loop since this loop appends to the slice
configLen
:=
len
(
configs
)
// avoid infinite loop since this loop appends
plaintext
to the slice
for
i
:=
0
;
i
<
configLen
;
i
++
{
for
i
:=
0
;
i
<
configLen
;
i
++
{
if
existingCertAndKey
(
configs
[
i
]
.
Host
)
&&
configs
[
i
]
.
TLS
.
LetsEncryptEmail
!=
"off"
{
if
existingCertAndKey
(
configs
[
i
]
.
Host
)
&&
configs
[
i
]
.
TLS
.
LetsEncryptEmail
!=
"off"
{
configs
=
autoConfigure
(
&
configs
[
i
],
configs
)
configs
=
autoConfigure
(
&
configs
[
i
],
configs
)
...
@@ -238,9 +238,14 @@ func saveCertsAndKeys(certificates []acme.CertificateResource) error {
...
@@ -238,9 +238,14 @@ func saveCertsAndKeys(certificates []acme.CertificateResource) error {
// autoConfigure enables TLS on cfg and appends, if necessary, a new config
// autoConfigure enables TLS on cfg and appends, if necessary, a new config
// to allConfigs that redirects plaintext HTTP to its new HTTPS counterpart.
// to allConfigs that redirects plaintext HTTP to its new HTTPS counterpart.
func
autoConfigure
(
cfg
*
server
.
Config
,
allConfigs
[]
server
.
Config
)
[]
server
.
Config
{
func
autoConfigure
(
cfg
*
server
.
Config
,
allConfigs
[]
server
.
Config
)
[]
server
.
Config
{
bundleBytes
,
_
:=
ioutil
.
ReadFile
(
storage
.
SiteCertFile
(
cfg
.
Host
))
bundleBytes
,
err
:=
ioutil
.
ReadFile
(
storage
.
SiteCertFile
(
cfg
.
Host
))
ocsp
,
_
:=
acme
.
GetOCSPForCert
(
bundleBytes
)
// TODO: Handle these errors better
cfg
.
TLS
.
OCSPStaple
=
ocsp
if
err
==
nil
{
ocsp
,
err
:=
acme
.
GetOCSPForCert
(
bundleBytes
)
if
err
==
nil
{
cfg
.
TLS
.
OCSPStaple
=
ocsp
}
}
cfg
.
TLS
.
Certificate
=
storage
.
SiteCertFile
(
cfg
.
Host
)
cfg
.
TLS
.
Certificate
=
storage
.
SiteCertFile
(
cfg
.
Host
)
cfg
.
TLS
.
Key
=
storage
.
SiteKeyFile
(
cfg
.
Host
)
cfg
.
TLS
.
Key
=
storage
.
SiteKeyFile
(
cfg
.
Host
)
cfg
.
TLS
.
Enabled
=
true
cfg
.
TLS
.
Enabled
=
true
...
...
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