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
34a99598
Commit
34a99598
authored
Aug 26, 2016
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore conflicting settings if TLS disabled (fixes #1075)
parent
191ec27c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
caddytls/config.go
caddytls/config.go
+5
-1
caddytls/config_test.go
caddytls/config_test.go
+14
-0
No files found.
caddytls/config.go
View file @
34a99598
...
@@ -338,6 +338,10 @@ func MakeTLSConfig(configs []*Config) (*tls.Config, error) {
...
@@ -338,6 +338,10 @@ func MakeTLSConfig(configs []*Config) (*tls.Config, error) {
configs
[
i
-
1
]
.
Hostname
,
lastConfProto
,
cfg
.
Hostname
,
thisConfProto
)
configs
[
i
-
1
]
.
Hostname
,
lastConfProto
,
cfg
.
Hostname
,
thisConfProto
)
}
}
if
!
cfg
.
Enabled
{
continue
}
// Union cipher suites
// Union cipher suites
for
_
,
ciph
:=
range
cfg
.
Ciphers
{
for
_
,
ciph
:=
range
cfg
.
Ciphers
{
if
_
,
ok
:=
ciphersAdded
[
ciph
];
!
ok
{
if
_
,
ok
:=
ciphersAdded
[
ciph
];
!
ok
{
...
@@ -348,7 +352,7 @@ func MakeTLSConfig(configs []*Config) (*tls.Config, error) {
...
@@ -348,7 +352,7 @@ func MakeTLSConfig(configs []*Config) (*tls.Config, error) {
// Can't resolve conflicting PreferServerCipherSuites settings
// Can't resolve conflicting PreferServerCipherSuites settings
if
i
>
0
&&
cfg
.
PreferServerCipherSuites
!=
configs
[
i
-
1
]
.
PreferServerCipherSuites
{
if
i
>
0
&&
cfg
.
PreferServerCipherSuites
!=
configs
[
i
-
1
]
.
PreferServerCipherSuites
{
return
nil
,
fmt
.
Errorf
(
"cannot both
use PreferServerCipherSuites and not use it
"
)
return
nil
,
fmt
.
Errorf
(
"cannot both
PreferServerCipherSuites and not prefer them
"
)
}
}
config
.
PreferServerCipherSuites
=
cfg
.
PreferServerCipherSuites
config
.
PreferServerCipherSuites
=
cfg
.
PreferServerCipherSuites
...
...
caddytls/config_test.go
View file @
34a99598
...
@@ -39,6 +39,20 @@ func TestMakeTLSConfigPreferServerCipherSuites(t *testing.T) {
...
@@ -39,6 +39,20 @@ func TestMakeTLSConfigPreferServerCipherSuites(t *testing.T) {
if
got
,
want
:=
result
.
PreferServerCipherSuites
,
true
;
got
!=
want
{
if
got
,
want
:=
result
.
PreferServerCipherSuites
,
true
;
got
!=
want
{
t
.
Errorf
(
"Expected PreferServerCipherSuites==%v but got %v"
,
want
,
got
)
t
.
Errorf
(
"Expected PreferServerCipherSuites==%v but got %v"
,
want
,
got
)
}
}
// make sure we don't get an error if there's a conflict
// when both of the configs have TLS disabled
configs
=
[]
*
Config
{
{
Enabled
:
false
,
PreferServerCipherSuites
:
false
},
{
Enabled
:
false
,
PreferServerCipherSuites
:
true
},
}
result
,
err
=
MakeTLSConfig
(
configs
)
if
err
!=
nil
{
t
.
Fatalf
(
"Did not expect an error when TLS is disabled, but got '%v'"
,
err
)
}
if
result
!=
nil
{
t
.
Errorf
(
"Expected nil result because TLS disabled, got: %+v"
,
err
)
}
}
}
func
TestMakeTLSConfigTLSEnabledDisabled
(
t
*
testing
.
T
)
{
func
TestMakeTLSConfigTLSEnabledDisabled
(
t
*
testing
.
T
)
{
...
...
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