Skip to content

Commit

Permalink
Merge pull request #124 from dell/cipherEnhancement
Browse files Browse the repository at this point in the history
Using only secured cipher suites
  • Loading branch information
adarsh-dell authored Jun 4, 2024
2 parents 6eaea85 + 359c1d0 commit 7266af0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ type client struct {
debug bool
}

// GetSecuredCipherSuites returns a slice of secured cipher suites.
// It iterates over the tls.CipherSuites() and appends the ID of each cipher su ite to the suites slice.
// The function returns the suites slice.
func GetSecuredCipherSuites() (suites []uint16) {
securedSuite := tls.CipherSuites()
for _, v := range securedSuite {
suites = append(suites, v.ID)
}
return suites
}

// ClientOptions are options for the API client.
type ClientOptions struct {
// Insecure is a flag that indicates whether or not to supress SSL errors.
Expand Down Expand Up @@ -160,6 +171,7 @@ func New(
TLSClientConfig: &tls.Config{
// #nosec G402
InsecureSkipVerify: true, // #nosec G402
CipherSuites: GetSecuredCipherSuites(),
},
}
}
Expand All @@ -175,6 +187,7 @@ func New(
RootCAs: pool,
// #nosec G402
InsecureSkipVerify: opts.Insecure,
CipherSuites: GetSecuredCipherSuites(),
},
}
}
Expand Down
3 changes: 3 additions & 0 deletions deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"strconv"
"strings"

"github.com/dell/goscaleio/api"
types "github.com/dell/goscaleio/types/v1"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v3"
Expand Down Expand Up @@ -71,6 +72,7 @@ func NewGateway(host string, username, password string, insecure, useCerts bool)
TLSClientConfig: &tls.Config{
// #nosec G402
InsecureSkipVerify: true,
CipherSuites: api.GetSecuredCipherSuites(),
},
}
}
Expand All @@ -86,6 +88,7 @@ func NewGateway(host string, username, password string, insecure, useCerts bool)
RootCAs: pool,
// #nosec G402
InsecureSkipVerify: insecure,
CipherSuites: api.GetSecuredCipherSuites(),
},
}
}
Expand Down

0 comments on commit 7266af0

Please sign in to comment.