mirror of
https://github.com/securego/gosec.git
synced 2025-01-11 20:35:52 +00:00
Fix TLS config template (#191)
* Fix TLS config template * Update the log message for unavailable ciphers
This commit is contained in:
parent
7116c4d3a1
commit
a0367559a7
2 changed files with 3 additions and 2 deletions
|
@ -5,8 +5,9 @@ import "text/template"
|
||||||
var generatedRuleTmpl = template.Must(template.New("generated").Parse(`
|
var generatedRuleTmpl = template.Must(template.New("generated").Parse(`
|
||||||
// New{{.Name}}TLSCheck creates a check for {{.Name}} TLS ciphers
|
// New{{.Name}}TLSCheck creates a check for {{.Name}} TLS ciphers
|
||||||
// DO NOT EDIT - generated by tlsconfig tool
|
// DO NOT EDIT - generated by tlsconfig tool
|
||||||
func New{{.Name}}TLSCheck(conf gas.Config) (gas.Rule, []ast.Node) {
|
func New{{.Name}}TLSCheck(id string, conf gas.Config) (gas.Rule, []ast.Node) {
|
||||||
return &insecureConfigTLS{
|
return &insecureConfigTLS{
|
||||||
|
MetaData: gas.MetaData{ID: id},
|
||||||
requiredType: "crypto/tls.Config",
|
requiredType: "crypto/tls.Config",
|
||||||
MinVersion: {{ .MinVersion }},
|
MinVersion: {{ .MinVersion }},
|
||||||
MaxVersion: {{ .MaxVersion }},
|
MaxVersion: {{ .MaxVersion }},
|
||||||
|
|
|
@ -87,7 +87,7 @@ func getGoCipherConfig(name string, sstls ServerSideTLSJson) (goCipherConfigurat
|
||||||
for _, cipherName := range conf.Ciphersuites {
|
for _, cipherName := range conf.Ciphersuites {
|
||||||
cipherSuite, ok := constants.CipherSuites[cipherName]
|
cipherSuite, ok := constants.CipherSuites[cipherName]
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Printf("Warning: cannot map cipher '%s'\n", cipherName)
|
log.Printf("'%s' cipher is not available in crypto/tls package\n", cipherName)
|
||||||
}
|
}
|
||||||
if len(cipherSuite.IANAName) > 0 {
|
if len(cipherSuite.IANAName) > 0 {
|
||||||
cipherConf.Ciphers = append(cipherConf.Ciphers, cipherSuite.IANAName)
|
cipherConf.Ciphers = append(cipherConf.Ciphers, cipherSuite.IANAName)
|
||||||
|
|
Loading…
Reference in a new issue