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
69366580
Commit
69366580
authored
Oct 25, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
letsencrypt: Work with latest lego changes
parent
b5b31e39
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
9 deletions
+8
-9
config/letsencrypt/letsencrypt.go
config/letsencrypt/letsencrypt.go
+3
-3
config/letsencrypt/renew.go
config/letsencrypt/renew.go
+2
-2
main.go
main.go
+3
-4
No files found.
config/letsencrypt/letsencrypt.go
View file @
69366580
...
...
@@ -152,7 +152,7 @@ func newClient(leEmail string) (*acme.Client, error) {
}
// The client facilitates our communication with the CA server.
client
:=
acme
.
NewClient
(
caURL
,
&
leUser
,
rsaKeySizeToUse
,
exposePort
,
true
)
// TODO: Dev mode is enabled
client
:=
acme
.
NewClient
(
caURL
,
&
leUser
,
rsaKeySizeToUse
,
exposePort
)
// If not registered, the user must register an account with the CA
// and agree to terms
...
...
@@ -164,7 +164,7 @@ func newClient(leEmail string) (*acme.Client, error) {
leUser
.
Registration
=
reg
// TODO: we can just do the agreement once: when registering, right?
err
=
client
.
AgreeToT
os
()
err
=
client
.
AgreeToT
OS
()
if
err
!=
nil
{
saveUser
(
leUser
)
// TODO: Might as well try, right? Error check?
return
nil
,
errors
.
New
(
"error agreeing to terms: "
+
err
.
Error
())
...
...
@@ -189,7 +189,7 @@ func obtainCertificates(client *acme.Client, serverConfigs []*server.Config) ([]
hosts
=
append
(
hosts
,
cfg
.
Host
)
}
certificates
,
err
:=
client
.
ObtainCertificates
(
hosts
)
certificates
,
err
:=
client
.
ObtainCertificates
(
hosts
,
true
)
if
err
!=
nil
{
return
nil
,
errors
.
New
(
"error obtaining certs: "
+
err
.
Error
())
}
...
...
config/letsencrypt/renew.go
View file @
69366580
...
...
@@ -84,10 +84,10 @@ func processCertificateRenewal(configs []server.Config) []error {
// Renew certificate.
// TODO: revokeOld should be an option in the caddyfile
newCertMeta
,
err
:=
client
.
RenewCertificate
(
certMeta
,
true
)
newCertMeta
,
err
:=
client
.
RenewCertificate
(
certMeta
,
true
,
true
)
if
err
!=
nil
{
time
.
Sleep
(
10
*
time
.
Second
)
newCertMeta
,
err
=
client
.
RenewCertificate
(
certMeta
,
true
)
newCertMeta
,
err
=
client
.
RenewCertificate
(
certMeta
,
true
,
true
)
if
err
!=
nil
{
errs
=
append
(
errs
,
err
)
continue
...
...
main.go
View file @
69366580
...
...
@@ -89,13 +89,12 @@ func main() {
log
.
Fatal
(
"FILE LISTENER:"
,
err
)
}
var
ok
bool
ln
,
ok
=
ln
.
(
server
.
ListenerFile
)
lnf
,
ok
:=
ln
.
(
server
.
ListenerFile
)
if
!
ok
{
log
.
Fatal
(
"Listener was not a ListenerFile"
)
}
err
=
s
.
Serve
(
ln
.
(
server
.
ListenerFile
)
)
err
=
s
.
Serve
(
ln
f
)
// TODO: Better error logging... also, is it even necessary?
if
err
!=
nil
{
log
.
Println
(
err
)
...
...
@@ -204,7 +203,7 @@ func loadConfigs() (config.Group, error) {
}
}
// Command line
Arg
// Command line
args
if
flag
.
NArg
()
>
0
{
confBody
:=
":"
+
config
.
DefaultPort
+
"
\n
"
+
strings
.
Join
(
flag
.
Args
(),
"
\n
"
)
return
config
.
Load
(
"args"
,
bytes
.
NewBufferString
(
confBody
))
...
...
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