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
605f1942
Commit
605f1942
authored
Oct 21, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'letsencrypt' into le-simplerenew
Conflicts: config/letsencrypt/letsencrypt.go
parents
38885e43
a16beb98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
6 deletions
+45
-6
config/letsencrypt/letsencrypt.go
config/letsencrypt/letsencrypt.go
+35
-6
main.go
main.go
+10
-0
No files found.
config/letsencrypt/letsencrypt.go
View file @
605f1942
...
@@ -284,6 +284,41 @@ func redirPlaintextHost(cfg server.Config) server.Config {
...
@@ -284,6 +284,41 @@ func redirPlaintextHost(cfg server.Config) server.Config {
}
}
}
}
// Revoke revokes the certificate for host via ACME protocol.
func
Revoke
(
host
string
)
error
{
if
!
existingCertAndKey
(
host
)
{
return
errors
.
New
(
"no certificate and key for "
+
host
)
}
email
:=
getEmail
(
server
.
Config
{
Host
:
host
})
if
email
==
""
{
return
errors
.
New
(
"email is required to revoke"
)
}
client
,
err
:=
newClient
(
email
)
if
err
!=
nil
{
return
err
}
certFile
:=
storage
.
SiteCertFile
(
host
)
certBytes
,
err
:=
ioutil
.
ReadFile
(
certFile
)
if
err
!=
nil
{
return
err
}
err
=
client
.
RevokeCertificate
(
certBytes
)
if
err
!=
nil
{
return
err
}
err
=
os
.
Remove
(
certFile
)
if
err
!=
nil
{
return
errors
.
New
(
"certificate revoked, but unable to delete certificate file: "
+
err
.
Error
())
}
return
nil
}
var
(
var
(
// Let's Encrypt account email to use if none provided
// Let's Encrypt account email to use if none provided
DefaultEmail
string
DefaultEmail
string
...
@@ -321,9 +356,3 @@ const (
...
@@ -321,9 +356,3 @@ const (
// This shouldn't need to change except for in tests;
// This shouldn't need to change except for in tests;
// the size can be drastically reduced for speed.
// the size can be drastically reduced for speed.
var
rsaKeySizeToUse
=
RSA_2048
var
rsaKeySizeToUse
=
RSA_2048
// CertificateMeta is a container type used to write out a file
// with information about a certificate.
type
CertificateMeta
struct
{
Domain
,
URL
string
}
main.go
View file @
605f1942
...
@@ -23,6 +23,7 @@ var (
...
@@ -23,6 +23,7 @@ var (
conf
string
conf
string
cpu
string
cpu
string
version
bool
version
bool
revoke
string
)
)
func
init
()
{
func
init
()
{
...
@@ -36,6 +37,7 @@ func init() {
...
@@ -36,6 +37,7 @@ func init() {
flag
.
BoolVar
(
&
version
,
"version"
,
false
,
"Show version"
)
flag
.
BoolVar
(
&
version
,
"version"
,
false
,
"Show version"
)
flag
.
BoolVar
(
&
letsencrypt
.
Agreed
,
"agree"
,
false
,
"Agree to Let's Encrypt Subscriber Agreement"
)
flag
.
BoolVar
(
&
letsencrypt
.
Agreed
,
"agree"
,
false
,
"Agree to Let's Encrypt Subscriber Agreement"
)
flag
.
StringVar
(
&
letsencrypt
.
DefaultEmail
,
"email"
,
""
,
"Default email address to use for Let's Encrypt transactions"
)
flag
.
StringVar
(
&
letsencrypt
.
DefaultEmail
,
"email"
,
""
,
"Default email address to use for Let's Encrypt transactions"
)
flag
.
StringVar
(
&
revoke
,
"revoke"
,
""
,
"Hostname for which to revoke the certificate"
)
}
}
func
main
()
{
func
main
()
{
...
@@ -45,6 +47,14 @@ func main() {
...
@@ -45,6 +47,14 @@ func main() {
fmt
.
Printf
(
"%s %s
\n
"
,
app
.
Name
,
app
.
Version
)
fmt
.
Printf
(
"%s %s
\n
"
,
app
.
Name
,
app
.
Version
)
os
.
Exit
(
0
)
os
.
Exit
(
0
)
}
}
if
revoke
!=
""
{
err
:=
letsencrypt
.
Revoke
(
revoke
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
fmt
.
Printf
(
"Revoked certificate for %s
\n
"
,
revoke
)
os
.
Exit
(
0
)
}
// Set CPU cap
// Set CPU cap
err
:=
app
.
SetCPU
(
cpu
)
err
:=
app
.
SetCPU
(
cpu
)
...
...
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