From fbcd61477b1b4434e444083d9fe5e0335ce5cb9a Mon Sep 17 00:00:00 2001 From: sbylica-splunk Date: Mon, 13 Oct 2025 13:57:39 +0200 Subject: [PATCH 1/4] SSL fix --- local-tile-build.sh | 43 ++++++++++++++++++++++++++++++++++++++++++ splunknozzle/nozzle.go | 14 ++++++++++---- 2 files changed, 53 insertions(+), 4 deletions(-) create mode 100755 local-tile-build.sh diff --git a/local-tile-build.sh b/local-tile-build.sh new file mode 100755 index 00000000..8f875459 --- /dev/null +++ b/local-tile-build.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +set -e +echo "Local tile build script" + +# Read current version from tile-history.yml +CURRENT_VERSION=$(grep '^version:' tile/tile-history.yml) + +if [ -z "$CURRENT_VERSION" ]; then + echo "Could not read version from tile/tile-history.yml" + exit 1 +fi + +echo "Building version: $CURRENT_VERSION" + +echo "Building Go binary..." +env GOOS=linux GOARCH=amd64 go build -o splunk-firehose-nozzle -ldflags "-X main.version=$CURRENT_VERSION" ./main.go + +# Make sure binary is executable +chmod +x splunk-firehose-nozzle + +# Check if tile command exists +if ! command -v tile &> /dev/null; then + echo "tile command not found. Installing tile-generator..." + pip3 install tile-generator +fi + +# Check if bosh command exists (required by tile-generator) +if ! command -v bosh &> /dev/null; then + echo "bosh command not found. Please install bosh-cli:" + echo " brew install cloudfoundry/tap/bosh-cli" + echo " # or download from: https://github.com/cloudfoundry/bosh-cli/releases" + exit 1 +fi + +# Build the tile +echo "Building tile..." +cd tile +tile build $CURRENT_VERSION +cd .. + +echo "Build completed!" +ls -la tile/product/*.pivotal \ No newline at end of file diff --git a/splunknozzle/nozzle.go b/splunknozzle/nozzle.go index 639f02bd..5bd0a234 100644 --- a/splunknozzle/nozzle.go +++ b/splunknozzle/nozzle.go @@ -3,11 +3,12 @@ package splunknozzle import ( "context" "fmt" - "github.com/cloudfoundry/go-cfclient/v3/resource" "os" "strings" "time" + "github.com/cloudfoundry/go-cfclient/v3/resource" + "code.cloudfoundry.org/lager/v3" "github.com/cloudfoundry-community/splunk-firehose-nozzle/cache" "github.com/cloudfoundry-community/splunk-firehose-nozzle/eventrouter" @@ -88,11 +89,16 @@ func (s *SplunkFirehoseNozzle) EventRouter(cache cache.Cache, eventSink eventsin // CFClient creates a client object which can talk to Cloud Foundry func (s *SplunkFirehoseNozzle) PCFClient() (*NozzleCfClient, error) { - var skipSSL config.Option + var cfConfig *config.Config + var err error + if s.config.SkipSSLCF { - skipSSL = config.SkipTLSValidation() + cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.SkipTLSValidation(), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) + } else { + cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) } - if cfConfig, err := config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), skipSSL, config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))); err != nil { + + if err != nil { return nil, err } else { if cfClient, err := client.New(cfConfig); err != nil { From a3c1860cf1180c26532625bc21e7ddad1a00269a Mon Sep 17 00:00:00 2001 From: sbylica-splunk Date: Tue, 14 Oct 2025 11:46:40 +0200 Subject: [PATCH 2/4] Test another fix --- splunknozzle/nozzle.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/splunknozzle/nozzle.go b/splunknozzle/nozzle.go index 5bd0a234..312ee1a6 100644 --- a/splunknozzle/nozzle.go +++ b/splunknozzle/nozzle.go @@ -92,11 +92,11 @@ func (s *SplunkFirehoseNozzle) PCFClient() (*NozzleCfClient, error) { var cfConfig *config.Config var err error - if s.config.SkipSSLCF { - cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.SkipTLSValidation(), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) - } else { - cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) - } + // if s.config.SkipSSLCF { + cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.SkipTLSValidation(), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) + // } else { + // cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) + // } if err != nil { return nil, err From 1263e5c2ab90bd6e03adca7c01a0b0a1f244c450 Mon Sep 17 00:00:00 2001 From: sbylica-splunk Date: Tue, 14 Oct 2025 12:22:33 +0200 Subject: [PATCH 3/4] Different fix --- splunknozzle/nozzle.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/splunknozzle/nozzle.go b/splunknozzle/nozzle.go index 312ee1a6..5bd0a234 100644 --- a/splunknozzle/nozzle.go +++ b/splunknozzle/nozzle.go @@ -92,11 +92,11 @@ func (s *SplunkFirehoseNozzle) PCFClient() (*NozzleCfClient, error) { var cfConfig *config.Config var err error - // if s.config.SkipSSLCF { - cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.SkipTLSValidation(), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) - // } else { - // cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) - // } + if s.config.SkipSSLCF { + cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.SkipTLSValidation(), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) + } else { + cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) + } if err != nil { return nil, err From 2f0da1f8f52cb2fff476d81490adc5ebe638ffd4 Mon Sep 17 00:00:00 2001 From: sbylica-splunk Date: Wed, 15 Oct 2025 12:03:27 +0200 Subject: [PATCH 4/4] Moved build local script --- local-tile-build.sh => scripts/local-tile-build.sh | 1 + 1 file changed, 1 insertion(+) rename local-tile-build.sh => scripts/local-tile-build.sh (99%) diff --git a/local-tile-build.sh b/scripts/local-tile-build.sh similarity index 99% rename from local-tile-build.sh rename to scripts/local-tile-build.sh index 8f875459..00945880 100755 --- a/local-tile-build.sh +++ b/scripts/local-tile-build.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +cd .. set -e echo "Local tile build script"