mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-24 19:25:49 +03:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
43020533f7
2 changed files with 15 additions and 5 deletions
|
@ -90,7 +90,7 @@ func TLS(c *Controller) (middleware.Middleware, error) {
|
||||||
func SetDefaultTLSParams(c *server.Config) {
|
func SetDefaultTLSParams(c *server.Config) {
|
||||||
// If no ciphers provided, use all that Caddy supports for the protocol
|
// If no ciphers provided, use all that Caddy supports for the protocol
|
||||||
if len(c.TLS.Ciphers) == 0 {
|
if len(c.TLS.Ciphers) == 0 {
|
||||||
c.TLS.Ciphers = supportedCiphers
|
c.TLS.Ciphers = defaultCiphers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not a cipher suite, but still important for mitigating protocol downgrade attacks
|
// Not a cipher suite, but still important for mitigating protocol downgrade attacks
|
||||||
|
@ -159,3 +159,15 @@ var supportedCiphers = []uint16{
|
||||||
tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
|
tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
|
||||||
tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
|
tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List of all the ciphers we want to use by default
|
||||||
|
var defaultCiphers = []uint16{
|
||||||
|
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||||
|
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||||
|
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||||
|
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||||
|
tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
|
||||||
|
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
|
||||||
|
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||||
|
tls.TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||||
|
}
|
||||||
|
|
|
@ -42,15 +42,13 @@ func TestTLSParseBasic(t *testing.T) {
|
||||||
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
|
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
|
||||||
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
|
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||||
tls.TLS_RSA_WITH_AES_128_CBC_SHA,
|
tls.TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||||
tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
|
|
||||||
tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
|
|
||||||
tls.TLS_FALLBACK_SCSV,
|
tls.TLS_FALLBACK_SCSV,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure count is correct (plus one for TLS_FALLBACK_SCSV)
|
// Ensure count is correct (plus one for TLS_FALLBACK_SCSV)
|
||||||
if len(c.TLS.Ciphers) != len(supportedCiphers)+1 {
|
if len(c.TLS.Ciphers) != len(expectedCiphers) {
|
||||||
t.Errorf("Expected %v Ciphers (including TLS_FALLBACK_SCSV), got %v",
|
t.Errorf("Expected %v Ciphers (including TLS_FALLBACK_SCSV), got %v",
|
||||||
len(supportedCiphers)+1, len(c.TLS.Ciphers))
|
len(expectedCiphers), len(c.TLS.Ciphers))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure ordering is correct
|
// Ensure ordering is correct
|
||||||
|
|
Loading…
Reference in a new issue