2018-02-21 05:59:18 +00:00
|
|
|
package rules
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go/ast"
|
|
|
|
|
2020-04-01 21:18:39 +01:00
|
|
|
"github.com/securego/gosec/v2"
|
2018-02-21 05:59:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// NewModernTLSCheck creates a check for Modern TLS ciphers
|
|
|
|
// DO NOT EDIT - generated by tlsconfig tool
|
2018-07-19 17:42:25 +01:00
|
|
|
func NewModernTLSCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
|
2018-02-21 05:59:18 +00:00
|
|
|
return &insecureConfigTLS{
|
2018-07-19 17:42:25 +01:00
|
|
|
MetaData: gosec.MetaData{ID: id},
|
2018-02-21 05:59:18 +00:00
|
|
|
requiredType: "crypto/tls.Config",
|
2019-09-09 14:14:41 +01:00
|
|
|
MinVersion: 0x0304,
|
|
|
|
MaxVersion: 0x0304,
|
2018-02-21 05:59:18 +00:00
|
|
|
goodCiphers: []string{
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_AES_128_GCM_SHA256",
|
|
|
|
"TLS_AES_256_GCM_SHA384",
|
|
|
|
"TLS_CHACHA20_POLY1305_SHA256",
|
2018-02-21 05:59:18 +00:00
|
|
|
},
|
|
|
|
}, []ast.Node{(*ast.CompositeLit)(nil)}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewIntermediateTLSCheck creates a check for Intermediate TLS ciphers
|
|
|
|
// DO NOT EDIT - generated by tlsconfig tool
|
2018-07-19 17:42:25 +01:00
|
|
|
func NewIntermediateTLSCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
|
2018-02-21 05:59:18 +00:00
|
|
|
return &insecureConfigTLS{
|
2018-07-19 17:42:25 +01:00
|
|
|
MetaData: gosec.MetaData{ID: id},
|
2018-02-21 05:59:18 +00:00
|
|
|
requiredType: "crypto/tls.Config",
|
2019-09-09 14:14:41 +01:00
|
|
|
MinVersion: 0x0303,
|
|
|
|
MaxVersion: 0x0304,
|
2018-02-21 05:59:18 +00:00
|
|
|
goodCiphers: []string{
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_AES_128_GCM_SHA256",
|
|
|
|
"TLS_AES_256_GCM_SHA384",
|
|
|
|
"TLS_CHACHA20_POLY1305_SHA256",
|
2018-02-21 05:59:18 +00:00
|
|
|
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
|
|
|
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
|
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
|
|
|
|
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
|
2020-09-02 09:41:26 +01:00
|
|
|
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
|
2020-09-02 09:41:26 +01:00
|
|
|
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
|
2018-02-21 05:59:18 +00:00
|
|
|
"TLS_DHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
|
|
"TLS_DHE_RSA_WITH_AES_256_GCM_SHA384",
|
|
|
|
},
|
|
|
|
}, []ast.Node{(*ast.CompositeLit)(nil)}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewOldTLSCheck creates a check for Old TLS ciphers
|
|
|
|
// DO NOT EDIT - generated by tlsconfig tool
|
2018-07-19 17:42:25 +01:00
|
|
|
func NewOldTLSCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
|
2018-02-21 05:59:18 +00:00
|
|
|
return &insecureConfigTLS{
|
2018-07-19 17:42:25 +01:00
|
|
|
MetaData: gosec.MetaData{ID: id},
|
2018-02-21 05:59:18 +00:00
|
|
|
requiredType: "crypto/tls.Config",
|
2019-09-09 14:14:41 +01:00
|
|
|
MinVersion: 0x0301,
|
|
|
|
MaxVersion: 0x0304,
|
2018-02-21 05:59:18 +00:00
|
|
|
goodCiphers: []string{
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_AES_128_GCM_SHA256",
|
|
|
|
"TLS_AES_256_GCM_SHA384",
|
|
|
|
"TLS_CHACHA20_POLY1305_SHA256",
|
2018-02-21 05:59:18 +00:00
|
|
|
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
2018-02-21 05:59:18 +00:00
|
|
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
|
|
|
|
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
|
2020-09-02 09:41:26 +01:00
|
|
|
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
|
2020-09-02 09:41:26 +01:00
|
|
|
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
|
2018-02-21 05:59:18 +00:00
|
|
|
"TLS_DHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
|
|
"TLS_DHE_RSA_WITH_AES_256_GCM_SHA384",
|
|
|
|
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
|
2018-02-21 05:59:18 +00:00
|
|
|
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
|
2018-02-21 05:59:18 +00:00
|
|
|
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384",
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",
|
2018-02-21 05:59:18 +00:00
|
|
|
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
|
2019-09-09 14:14:41 +01:00
|
|
|
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
|
2018-02-21 05:59:18 +00:00
|
|
|
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
|
|
|
|
"TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",
|
|
|
|
"TLS_RSA_WITH_AES_128_GCM_SHA256",
|
|
|
|
"TLS_RSA_WITH_AES_256_GCM_SHA384",
|
|
|
|
"TLS_RSA_WITH_AES_128_CBC_SHA256",
|
|
|
|
"TLS_RSA_WITH_AES_256_CBC_SHA256",
|
|
|
|
"TLS_RSA_WITH_AES_128_CBC_SHA",
|
|
|
|
"TLS_RSA_WITH_AES_256_CBC_SHA",
|
|
|
|
"TLS_RSA_WITH_3DES_EDE_CBC_SHA",
|
|
|
|
},
|
|
|
|
}, []ast.Node{(*ast.CompositeLit)(nil)}
|
|
|
|
}
|