1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-10 09:50:43 +00:00

fix tls.AllowInsecureCiphers

This commit is contained in:
Darien Raymond 2018-09-10 23:55:54 +02:00
parent f9436b3556
commit 682b28cbda
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 12 additions and 1 deletions

View File

@ -155,7 +155,7 @@ func (c *Config) GetTLSConfig(opts ...Option) *tls.Config {
opt(config)
}
if c.AllowInsecureCiphers && len(config.CipherSuites) == 0 {
if !c.AllowInsecureCiphers && len(config.CipherSuites) == 0 {
config.CipherSuites = []uint16{
tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,

View File

@ -62,3 +62,14 @@ func TestExpiredCertificate(t *testing.T) {
assert(err, IsNil)
assert(x509Cert.NotAfter.After(time.Now()), IsTrue)
}
func TestInsecureCertificates(t *testing.T) {
c := &Config{
AllowInsecureCiphers: true,
}
tlsConfig := c.GetTLSConfig()
if len(tlsConfig.CipherSuites) > 0 {
t.Fatal("Unexpected tls cipher suites list: ", tlsConfig.CipherSuites)
}
}