diff --git a/collector/collector.go b/collector/collector.go index 9786495..4ae294b 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -108,6 +108,7 @@ func NewSVCCollector(targets []utils.Target, tokenCaches map[string]*utils.AuthT UserName: t.Userid, Password: t.Password, IpAddress: t.IpAddress, + VerifyCert: t.VerifyCert, AuthTokenCache: tokenCaches[t.IpAddress], AuthTokenMutex: tokenMutexes[t.IpAddress], ColCounter: colCounters[t.IpAddress], diff --git a/collector_s/collector.go b/collector_s/collector.go index 482fb35..2ff11fd 100644 --- a/collector_s/collector.go +++ b/collector_s/collector.go @@ -108,6 +108,7 @@ func NewSVCCollector(targets []utils.Target, tokenCaches map[string]*utils.AuthT UserName: t.Userid, Password: t.Password, IpAddress: t.IpAddress, + VerifyCert: t.VerifyCert, AuthTokenCache: tokenCaches[t.IpAddress], AuthTokenMutex: tokenMutexes[t.IpAddress], ColCounter: colCounters[t.IpAddress], diff --git a/utils/config.go b/utils/config.go index 21df1a6..276a0ce 100644 --- a/utils/config.go +++ b/utils/config.go @@ -28,9 +28,10 @@ type Config struct { } type Target struct { - IpAddress string `yaml:"ipAddress"` - Userid string `yaml:"userid"` - Password string `yaml:"password"` + IpAddress string `yaml:"ipAddress"` + Userid string `yaml:"userid"` + Password string `yaml:"password"` + VerifyCert bool `yaml:"verifyCert"` } type Label struct { diff --git a/utils/spectrumClient.go b/utils/spectrumClient.go index 85a4783..723b40a 100644 --- a/utils/spectrumClient.go +++ b/utils/spectrumClient.go @@ -165,7 +165,7 @@ func (s *SpectrumClient) retrieveAuthToken() (authToken string, err error) { IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, - TLSClientConfig: &tls.Config{InsecureSkipVerify: false, MinVersion: tls.VersionTLS12}, + TLSClientConfig: &tls.Config{InsecureSkipVerify: !s.VerifyCert, MinVersion: tls.VersionTLS12}, }, Timeout: 45 * time.Second, } @@ -205,7 +205,7 @@ func (s *SpectrumClient) CallSpectrumAPI(restCmd string, autoRenewToken bool) (b IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, - TLSClientConfig: &tls.Config{InsecureSkipVerify: false, MinVersion: tls.VersionTLS12}, + TLSClientConfig: &tls.Config{InsecureSkipVerify: !s.VerifyCert, MinVersion: tls.VersionTLS12}, }, Timeout: 45 * time.Second} // New POST request