Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(splunk): add skip tls verification #505

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion actions/splunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -22,6 +25,7 @@ type SplunkAction struct {
Url string
Token string
EventLimit int
TlsVerify bool
splunkLayout layout.LayoutProvider
}

Expand Down Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions cfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ actions:
url: http://localhost:8088 # Mandatory. Url of a Splunk server
token: <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
Expand Down
1 change: 1 addition & 0 deletions deploy/helm/postee/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ posteeConfig: |
url: http://localhost:8088 # Mandatory. Url of a Splunk server
token: <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
Expand Down
1 change: 1 addition & 0 deletions router/builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func buildSplunkAction(sourceSettings *ActionSettings) *actions.SplunkAction {
Url: sourceSettings.Url,
Token: sourceSettings.Token,
EventLimit: sourceSettings.SizeLimit,
TlsVerify: sourceSettings.TlsVerify,
}
}

Expand Down