-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TLS cipher suite options and CA path support #2963
Conversation
2c3a023
to
f0578fe
Compare
command/agent/config.go
Outdated
@@ -17,6 +17,7 @@ import ( | |||
"github.com/hashicorp/consul/types" | |||
"github.com/hashicorp/consul/watch" | |||
"github.com/mitchellh/mapstructure" | |||
"github.com/hashicorp/consul/tlsutil" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use goimports
for sorting imports correctly
command/agent/config_test.go
Outdated
@@ -13,6 +13,7 @@ import ( | |||
"time" | |||
|
|||
"github.com/hashicorp/consul/lib" | |||
"crypto/tls" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import sorting
} | ||
|
||
return suites, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gofmt this file
tlsutil/config_test.go
Outdated
@@ -9,6 +9,7 @@ import ( | |||
"testing" | |||
|
|||
"github.com/hashicorp/yamux" | |||
"reflect" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imports
tlsutil/config_test.go
Outdated
@@ -494,3 +509,26 @@ func TestConfig_IncomingTLS_TLSMinVersion(t *testing.T) { | |||
} | |||
} | |||
} | |||
|
|||
func TestConfig_ParseCiphers(t *testing.T) { | |||
testOk := "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_256_GCM_SHA384" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to join a []string{...}
to keep it readable
tlsutil/config_test.go
Outdated
if err != nil { | ||
t.Fatal(err) | ||
} | ||
if len(v) != 12 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you compare the values instead of the lengths you get a more robust test.
ciphers := []uint16{...}
if got, want := v, ciphers; !reflect.DeepEqual(got, want) {
t.Fatalf("got ciphers %#v want %#v", got, want)
}
tlsutil/config_test.go
Outdated
t.Fatal("should fail on unsupported cipherX") | ||
} | ||
|
||
testOrder := "TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test becomes redundant if you do the other test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once you remove the extra blank line.
command/agent/config_test.go
Outdated
@@ -12,8 +12,8 @@ import ( | |||
"testing" | |||
"time" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove blank line and goimports
LGTM. Please squash and merge :) |
Just realized that I could also do this myself. |
Resolves #2959