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
69939108
Commit
69939108
authored
May 25, 2015
by
Guilherme Rezende
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed tls cache option
parent
674f454e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
37 deletions
+3
-37
config/setup/tls.go
config/setup/tls.go
+0
-15
config/setup/tls_test.go
config/setup/tls_test.go
+3
-20
server/config.go
server/config.go
+0
-1
server/server.go
server/server.go
+0
-1
No files found.
config/setup/tls.go
View file @
69939108
...
@@ -3,7 +3,6 @@ package setup
...
@@ -3,7 +3,6 @@ package setup
import
(
import
(
"crypto/tls"
"crypto/tls"
"log"
"log"
"strconv"
"strings"
"strings"
"github.com/mholt/caddy/middleware"
"github.com/mholt/caddy/middleware"
...
@@ -54,15 +53,6 @@ func TLS(c *Controller) (middleware.Middleware, error) {
...
@@ -54,15 +53,6 @@ func TLS(c *Controller) (middleware.Middleware, error) {
}
}
c
.
TLS
.
Ciphers
=
append
(
c
.
TLS
.
Ciphers
,
value
)
c
.
TLS
.
Ciphers
=
append
(
c
.
TLS
.
Ciphers
,
value
)
}
}
case
"cache"
:
if
!
c
.
NextArg
()
{
return
nil
,
c
.
ArgErr
()
}
size
,
err
:=
strconv
.
Atoi
(
c
.
Val
())
if
err
!=
nil
{
return
nil
,
c
.
Errf
(
"Cache parameter must be a number '%s': %v"
,
c
.
Val
(),
err
)
}
c
.
TLS
.
CacheSize
=
size
default
:
default
:
return
nil
,
c
.
Errf
(
"Unknown keyword '%s'"
)
return
nil
,
c
.
Errf
(
"Unknown keyword '%s'"
)
}
}
...
@@ -85,11 +75,6 @@ func TLS(c *Controller) (middleware.Middleware, error) {
...
@@ -85,11 +75,6 @@ func TLS(c *Controller) (middleware.Middleware, error) {
c
.
TLS
.
ProtocolMaxVersion
=
tls
.
VersionTLS12
c
.
TLS
.
ProtocolMaxVersion
=
tls
.
VersionTLS12
}
}
//If no cachesize provided, set default to 64
if
c
.
TLS
.
CacheSize
<=
0
{
c
.
TLS
.
CacheSize
=
64
}
// Prefer server cipher suites
// Prefer server cipher suites
c
.
TLS
.
PreferServerCipherSuites
=
true
c
.
TLS
.
PreferServerCipherSuites
=
true
...
...
config/setup/tls_test.go
View file @
69939108
...
@@ -31,9 +31,6 @@ func TestTLSParseBasic(t *testing.T) {
...
@@ -31,9 +31,6 @@ func TestTLSParseBasic(t *testing.T) {
if
c
.
TLS
.
ProtocolMaxVersion
!=
tls
.
VersionTLS12
{
if
c
.
TLS
.
ProtocolMaxVersion
!=
tls
.
VersionTLS12
{
t
.
Errorf
(
"Expected 'tls1.2 (0x0303)' as ProtocolMaxVersion, got %v"
,
c
.
TLS
.
ProtocolMaxVersion
)
t
.
Errorf
(
"Expected 'tls1.2 (0x0303)' as ProtocolMaxVersion, got %v"
,
c
.
TLS
.
ProtocolMaxVersion
)
}
}
if
c
.
TLS
.
CacheSize
!=
64
{
t
.
Errorf
(
"Expected CacheSize 64, got %v"
,
c
.
TLS
.
CacheSize
)
}
// Cipher checks
// Cipher checks
expectedCiphers
:=
[]
uint16
{
expectedCiphers
:=
[]
uint16
{
...
@@ -88,7 +85,6 @@ func TestTLSParseWithOptionalParams(t *testing.T) {
...
@@ -88,7 +85,6 @@ func TestTLSParseWithOptionalParams(t *testing.T) {
params
:=
`tls cert.crt cert.key {
params
:=
`tls cert.crt cert.key {
protocols ssl3.0 tls1.2
protocols ssl3.0 tls1.2
ciphers RSA-3DES-EDE-CBC-SHA RSA-AES256-CBC-SHA ECDHE-RSA-AES128-GCM-SHA256
ciphers RSA-3DES-EDE-CBC-SHA RSA-AES256-CBC-SHA ECDHE-RSA-AES128-GCM-SHA256
cache 128
}`
}`
c
:=
newTestController
(
params
)
c
:=
newTestController
(
params
)
...
@@ -108,15 +104,12 @@ func TestTLSParseWithOptionalParams(t *testing.T) {
...
@@ -108,15 +104,12 @@ func TestTLSParseWithOptionalParams(t *testing.T) {
if
len
(
c
.
TLS
.
Ciphers
)
-
1
!=
3
{
if
len
(
c
.
TLS
.
Ciphers
)
-
1
!=
3
{
t
.
Errorf
(
"Expected 3 Ciphers (not including TLS_FALLBACK_SCSV), got %v"
,
len
(
c
.
TLS
.
Ciphers
))
t
.
Errorf
(
"Expected 3 Ciphers (not including TLS_FALLBACK_SCSV), got %v"
,
len
(
c
.
TLS
.
Ciphers
))
}
}
if
c
.
TLS
.
CacheSize
!=
128
{
t
.
Errorf
(
"Expected CacheSize 128, got %v"
,
c
.
TLS
.
CacheSize
)
}
}
}
func
TestTLSParseWithWrongOptionalParams
(
t
*
testing
.
T
)
{
func
TestTLSParseWithWrongOptionalParams
(
t
*
testing
.
T
)
{
// Test protocols wrong params
params
:=
`tls cert.crt cert.key {
params
:=
`tls cert.crt cert.key {
cache a
protocols ssl tls
}`
}`
c
:=
newTestController
(
params
)
c
:=
newTestController
(
params
)
_
,
err
:=
TLS
(
c
)
_
,
err
:=
TLS
(
c
)
...
@@ -124,16 +117,6 @@ func TestTLSParseWithWrongOptionalParams(t *testing.T) {
...
@@ -124,16 +117,6 @@ func TestTLSParseWithWrongOptionalParams(t *testing.T) {
t
.
Errorf
(
"Expected errors, but no error returned"
)
t
.
Errorf
(
"Expected errors, but no error returned"
)
}
}
// Test protocols wrong params
params
=
`tls cert.crt cert.key {
protocols ssl tls
}`
c
=
newTestController
(
params
)
_
,
err
=
TLS
(
c
)
if
err
==
nil
{
t
.
Errorf
(
"Expected errors, but no error returned"
)
}
// Test ciphers wrong params
// Test ciphers wrong params
params
=
`tls cert.crt cert.key {
params
=
`tls cert.crt cert.key {
ciphers not-valid-cipher
ciphers not-valid-cipher
...
...
server/config.go
View file @
69939108
...
@@ -63,6 +63,5 @@ type TLSConfig struct {
...
@@ -63,6 +63,5 @@ type TLSConfig struct {
Ciphers
[]
uint16
Ciphers
[]
uint16
ProtocolMinVersion
uint16
ProtocolMinVersion
uint16
ProtocolMaxVersion
uint16
ProtocolMaxVersion
uint16
CacheSize
int
PreferServerCipherSuites
bool
PreferServerCipherSuites
bool
}
}
server/server.go
View file @
69939108
...
@@ -132,7 +132,6 @@ func ListenAndServeTLSWithSNI(srv *http.Server, tlsConfigs []TLSConfig) error {
...
@@ -132,7 +132,6 @@ func ListenAndServeTLSWithSNI(srv *http.Server, tlsConfigs []TLSConfig) error {
config
.
BuildNameToCertificate
()
config
.
BuildNameToCertificate
()
// Customize our TLS configuration
// Customize our TLS configuration
config
.
ClientSessionCache
=
tls
.
NewLRUClientSessionCache
(
tlsConfigs
[
0
]
.
CacheSize
)
config
.
MinVersion
=
tlsConfigs
[
0
]
.
ProtocolMinVersion
config
.
MinVersion
=
tlsConfigs
[
0
]
.
ProtocolMinVersion
config
.
MaxVersion
=
tlsConfigs
[
0
]
.
ProtocolMaxVersion
config
.
MaxVersion
=
tlsConfigs
[
0
]
.
ProtocolMaxVersion
config
.
CipherSuites
=
tlsConfigs
[
0
]
.
Ciphers
config
.
CipherSuites
=
tlsConfigs
[
0
]
.
Ciphers
...
...
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