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
d36685ac
Commit
d36685ac
authored
Nov 04, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
letsencrypt: Fix bug if different emails used; beta 2
parent
051d2a68
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
10 deletions
+16
-10
caddy/letsencrypt/letsencrypt.go
caddy/letsencrypt/letsencrypt.go
+14
-8
dist/README.txt
dist/README.txt
+1
-1
main.go
main.go
+1
-1
No files found.
caddy/letsencrypt/letsencrypt.go
View file @
d36685ac
...
@@ -75,16 +75,22 @@ func Activate(configs []server.Config) ([]server.Config, error) {
...
@@ -75,16 +75,22 @@ func Activate(configs []server.Config) ([]server.Config, error) {
// obtain certificates for configs that need one, and reconfigure each
// obtain certificates for configs that need one, and reconfigure each
// config to use the certificates
// config to use the certificates
for
leEmail
,
serverConfig
s
:=
range
groupedConfigs
{
for
leEmail
,
cfgIndexe
s
:=
range
groupedConfigs
{
// make client to service this email address with CA server
// make client to service this email address with CA server
client
,
err
:=
newClient
(
leEmail
)
client
,
err
:=
newClient
(
leEmail
)
if
err
!=
nil
{
if
err
!=
nil
{
return
configs
,
errors
.
New
(
"error creating client: "
+
err
.
Error
())
return
configs
,
errors
.
New
(
"error creating client: "
+
err
.
Error
())
}
}
// little bit of housekeeping; gather the hostnames into a slice
hosts
:=
make
([]
string
,
len
(
cfgIndexes
))
for
i
,
idx
:=
range
cfgIndexes
{
hosts
[
i
]
=
configs
[
idx
]
.
Host
}
// client is ready, so let's get free, trusted SSL certificates!
// client is ready, so let's get free, trusted SSL certificates!
Obtain
:
Obtain
:
certificates
,
failures
:=
obtainCertificates
(
client
,
serverConfigs
)
certificates
,
failures
:=
client
.
ObtainCertificates
(
hosts
,
true
)
if
len
(
failures
)
>
0
{
if
len
(
failures
)
>
0
{
// Build an error string to return, using all the failures in the list.
// Build an error string to return, using all the failures in the list.
var
errMsg
string
var
errMsg
string
...
@@ -122,8 +128,8 @@ func Activate(configs []server.Config) ([]server.Config, error) {
...
@@ -122,8 +128,8 @@ func Activate(configs []server.Config) ([]server.Config, error) {
}
}
// it all comes down to this: turning on TLS with all the new certs
// it all comes down to this: turning on TLS with all the new certs
for
i
:=
0
;
i
<
len
(
serverConfigs
);
i
++
{
for
_
,
idx
:=
range
cfgIndexes
{
configs
=
autoConfigure
(
configs
,
i
)
configs
=
autoConfigure
(
configs
,
i
dx
)
}
}
}
}
...
@@ -180,8 +186,8 @@ func configQualifies(allConfigs []server.Config, cfgIndex int) bool {
...
@@ -180,8 +186,8 @@ func configQualifies(allConfigs []server.Config, cfgIndex int) bool {
// If an email address is not available for an eligible config, the user will be
// If an email address is not available for an eligible config, the user will be
// prompted to provide one. The returned map contains pointers to the original
// prompted to provide one. The returned map contains pointers to the original
// server config values.
// server config values.
func
groupConfigsByEmail
(
configs
[]
server
.
Config
)
(
map
[
string
][]
*
server
.
Config
,
error
)
{
func
groupConfigsByEmail
(
configs
[]
server
.
Config
)
(
map
[
string
][]
int
,
error
)
{
initMap
:=
make
(
map
[
string
][]
*
server
.
Config
)
initMap
:=
make
(
map
[
string
][]
int
)
for
i
:=
0
;
i
<
len
(
configs
);
i
++
{
for
i
:=
0
;
i
<
len
(
configs
);
i
++
{
// filter out configs that we already have certs for and
// filter out configs that we already have certs for and
// that we won't be obtaining certs for - this way we won't
// that we won't be obtaining certs for - this way we won't
...
@@ -191,7 +197,7 @@ func groupConfigsByEmail(configs []server.Config) (map[string][]*server.Config,
...
@@ -191,7 +197,7 @@ func groupConfigsByEmail(configs []server.Config) (map[string][]*server.Config,
continue
continue
}
}
leEmail
:=
getEmail
(
configs
[
i
])
leEmail
:=
getEmail
(
configs
[
i
])
initMap
[
leEmail
]
=
append
(
initMap
[
leEmail
],
&
configs
[
i
]
)
initMap
[
leEmail
]
=
append
(
initMap
[
leEmail
],
i
)
}
}
return
initMap
,
nil
return
initMap
,
nil
}
}
...
@@ -270,7 +276,7 @@ func newClientPort(leEmail, port string) (*acme.Client, error) {
...
@@ -270,7 +276,7 @@ func newClientPort(leEmail, port string) (*acme.Client, error) {
// obtainCertificates obtains certificates from the CA server for
// obtainCertificates obtains certificates from the CA server for
// the configurations in serverConfigs using client.
// the configurations in serverConfigs using client.
func
obtainCertificates
(
client
*
acme
.
Client
,
serverConfigs
[]
*
server
.
Config
)
([]
acme
.
CertificateResource
,
map
[
string
]
error
)
{
func
obtainCertificates
(
client
*
acme
.
Client
,
serverConfigs
[]
server
.
Config
)
([]
acme
.
CertificateResource
,
map
[
string
]
error
)
{
// collect all the hostnames into one slice
// collect all the hostnames into one slice
var
hosts
[]
string
var
hosts
[]
string
for
_
,
cfg
:=
range
serverConfigs
{
for
_
,
cfg
:=
range
serverConfigs
{
...
...
dist/README.txt
View file @
d36685ac
CADDY 0.8 beta
CADDY 0.8 beta
2
Website
Website
https://caddyserver.com
https://caddyserver.com
...
...
main.go
View file @
d36685ac
...
@@ -24,7 +24,7 @@ var (
...
@@ -24,7 +24,7 @@ var (
const
(
const
(
appName
=
"Caddy"
appName
=
"Caddy"
appVersion
=
"0.8 beta"
appVersion
=
"0.8 beta
2
"
)
)
func
init
()
{
func
init
()
{
...
...
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