File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
cmd/harbor-scanner-sysdig-secure Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ func configure() error {
4343
4444 pflag .String ("secure_api_token" , "" , "Sysdig Secure API Token" )
4545 pflag .String ("secure_url" , "https://secure.sysdig.com" , "Sysdig Secure URL Endpoint" )
46+ pflag .Bool ("verify_ssl" , true , "Verify SSL when connecting to Sysdig Secure URL Endpoint" )
4647 pflag .Bool ("inline_scanning" , false , "Use Inline Scanning Adapter" )
4748 pflag .String ("namespace_name" , "" , "Namespace where inline scanning jobs are spawned" )
4849 pflag .String ("configmap_name" , "" , "Configmap which keeps the inline scanning settings" )
@@ -64,7 +65,7 @@ func configure() error {
6465}
6566
6667func getAdapter () scanner.Adapter {
67- client := secure .NewClient (viper .GetString ("secure_api_token" ), viper .GetString ("secure_url" ))
68+ client := secure .NewClient (viper .GetString ("secure_api_token" ), viper .GetString ("secure_url" ), viper . GetBool ( "verify_ssl" ) )
6869
6970 if viper .GetBool ("inline_scanning" ) {
7071 log .Info ("Using inline-scanning adapter" )
Original file line number Diff line number Diff line change 11package secure
22
33import (
4+ "crypto/tls"
45 "encoding/json"
56 "errors"
67 "fmt"
@@ -36,10 +37,17 @@ type Client interface {
3637 GetVulnerabilityDescription (vulnerabilityIDs ... string ) (map [string ]string , error )
3738}
3839
39- func NewClient (apiToken string , secureURL string ) Client {
40+ func NewClient (apiToken string , secureURL string , verifySSL bool ) Client {
4041 return & client {
4142 apiToken : apiToken ,
4243 secureURL : secureURL ,
44+ client : http.Client {
45+ Transport : & http.Transport {
46+ TLSClientConfig : & tls.Config {
47+ InsecureSkipVerify : verifySSL ,
48+ },
49+ },
50+ },
4351 }
4452}
4553
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ var _ = Describe("Sysdig Secure Client", func() {
2020 )
2121
2222 BeforeEach (func () {
23- client = secure .NewClient (os .Getenv ("SECURE_API_TOKEN" ), os .Getenv ("SECURE_URL" ))
23+ client = secure .NewClient (os .Getenv ("SECURE_API_TOKEN" ), os .Getenv ("SECURE_URL" ), true )
2424 })
2525
2626 Context ("when adding an image to scanning queue" , func () {
You can’t perform that action at this time.
0 commit comments