diff --git a/actions/splunk.go b/actions/splunk.go index 3cf79b20..b223dbe3 100644 --- a/actions/splunk.go +++ b/actions/splunk.go @@ -2,13 +2,16 @@ package actions import ( "bytes" + "crypto/tls" "encoding/json" "errors" "fmt" "io/ioutil" "log" + "net" "net/http" "strings" + "time" "github.com/aquasecurity/postee/v2/data" "github.com/aquasecurity/postee/v2/formatting" @@ -22,6 +25,7 @@ type SplunkAction struct { Url string Token string EventLimit int + TlsVerify bool splunkLayout layout.LayoutProvider } @@ -106,7 +110,24 @@ func (splunk *SplunkAction) Send(d map[string]string) error { req.Header.Add("Authorization", "Splunk "+splunk.Token) - resp, err := http.DefaultClient.Do(req) + client := http.Client{ + // default transport with tls config added + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).DialContext, + ForceAttemptHTTP2: true, + MaxIdleConns: 100, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + TLSClientConfig: &tls.Config{InsecureSkipVerify: splunk.TlsVerify}, + }, + } + + resp, err := client.Do(req) if err != nil { return err } diff --git a/cfg.yaml b/cfg.yaml index c2833181..b180c8e5 100644 --- a/cfg.yaml +++ b/cfg.yaml @@ -123,6 +123,7 @@ actions: url: http://localhost:8088 # Mandatory. Url of a Splunk server token: # Mandatory. a HTTP Event Collector Token size-limit: 10000 # Optional. Maximum scan length, in bytes. Default: 10000 + tls-verify: false # Enable skip TLS Verification. Default: false. - name: my-servicenow type: serviceNow diff --git a/deploy/helm/postee/values.yaml b/deploy/helm/postee/values.yaml index 52160ed9..8b4bf5db 100644 --- a/deploy/helm/postee/values.yaml +++ b/deploy/helm/postee/values.yaml @@ -132,6 +132,7 @@ posteeConfig: | url: http://localhost:8088 # Mandatory. Url of a Splunk server token: # Mandatory. a HTTP Event Collector Token size-limit: 10000 # Optional. Maximum scan length, in bytes. Default: 10000 + tls-verify: false # Enable skip TLS Verification. Default: false. - name: my-servicenow type: serviceNow diff --git a/router/builders.go b/router/builders.go index 1fdca116..3c273094 100644 --- a/router/builders.go +++ b/router/builders.go @@ -20,6 +20,7 @@ func buildSplunkAction(sourceSettings *ActionSettings) *actions.SplunkAction { Url: sourceSettings.Url, Token: sourceSettings.Token, EventLimit: sourceSettings.SizeLimit, + TlsVerify: sourceSettings.TlsVerify, } }