Skip to content
Open
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
17 changes: 13 additions & 4 deletions outputs/otlp_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import (
"context"
"crypto/tls"
"fmt"
"log/slog"
"os"
Expand All @@ -13,6 +14,7 @@
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc"
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
sdklog "go.opentelemetry.io/otel/sdk/log"
"google.golang.org/grpc/credentials"

"github.com/falcosecurity/falcosidekick/internal/pkg/utils"
otlpmetrics "github.com/falcosecurity/falcosidekick/outputs/otlp_metrics"
Expand Down Expand Up @@ -81,14 +83,21 @@
switch config.OTLP.Logs.Protocol {
case GRPC:
opts := []otlploggrpc.Option{}
if !config.OTLP.Traces.CheckCert {
opts = append(opts, otlploggrpc.WithInsecure())
if !config.OTLP.Logs.CheckCert {
tlsConfig := &tls.Config{
InsecureSkipVerify: true,

Check failure on line 88 in outputs/otlp_logs.go

View workflow job for this annotation

GitHub Actions / lint

G402: TLS InsecureSkipVerify set true. (gosec)
}
creds := credentials.NewTLS(tlsConfig)
opts = append(opts, otlploggrpc.WithTLSCredentials(creds))
}
exporter, err = otlploggrpc.New(ctx, opts...)
default:
opts := []otlploghttp.Option{}
if !config.OTLP.Traces.CheckCert {
opts = append(opts, otlploghttp.WithInsecure())
if !config.OTLP.Logs.CheckCert {
tlsCfg := &tls.Config{
InsecureSkipVerify: true,
}
opts = append(opts, otlploghttp.WithTLSClientConfig(tlsCfg))
}
exporter, err = otlploghttp.New(ctx, opts...)
}
Expand Down
13 changes: 11 additions & 2 deletions outputs/otlp_metrics/otlp_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import (
"context"
"crypto/tls"
"fmt"
"os"
"strings"
Expand All @@ -14,6 +15,7 @@
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
sdkresource "go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
"google.golang.org/grpc/credentials"

"github.com/falcosecurity/falcosidekick/internal/pkg/utils"
)
Expand Down Expand Up @@ -148,13 +150,20 @@
case "grpc":
opts := []otlpmetricgrpc.Option{}
if !config.CheckCert {
opts = append(opts, otlpmetricgrpc.WithInsecure())
tlsConfig := &tls.Config{
InsecureSkipVerify: true,

Check failure on line 154 in outputs/otlp_metrics/otlp_metrics.go

View workflow job for this annotation

GitHub Actions / lint

G402: TLS InsecureSkipVerify set true. (gosec)
}
creds := credentials.NewTLS(tlsConfig)
opts = append(opts, otlpmetricgrpc.WithTLSCredentials(creds))
}
exporter, err = otlpmetricgrpc.New(ctx, opts...)
default:
opts := []otlpmetrichttp.Option{}
if !config.CheckCert {
opts = append(opts, otlpmetrichttp.WithInsecure())
tlsCfg := &tls.Config{
InsecureSkipVerify: true,

Check failure on line 164 in outputs/otlp_metrics/otlp_metrics.go

View workflow job for this annotation

GitHub Actions / lint

G402: TLS InsecureSkipVerify set true. (gosec)
}
opts = append(opts, otlpmetrichttp.WithTLSClientConfig(tlsCfg))
}
exporter, err = otlpmetrichttp.New(ctx, opts...)
}
Expand Down
13 changes: 11 additions & 2 deletions outputs/otlp_traces_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package outputs

import (
"context"
"crypto/tls"
"fmt"
"os"
"strings"
Expand All @@ -14,6 +15,7 @@ import (
otelresource "go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
"google.golang.org/grpc/credentials"

"github.com/falcosecurity/falcosidekick/internal/pkg/utils"
"github.com/falcosecurity/falcosidekick/types"
Expand All @@ -39,13 +41,20 @@ func installTracesExportPipeline(config *types.Configuration, ctx context.Contex
case GRPC:
opts := []otlptracegrpc.Option{}
if !config.OTLP.Traces.CheckCert {
opts = append(opts, otlptracegrpc.WithInsecure())
tlsConfig := &tls.Config{
InsecureSkipVerify: true,
}
creds := credentials.NewTLS(tlsConfig)
opts = append(opts, otlptracegrpc.WithTLSCredentials(creds))
}
exporter, err = otlptracegrpc.New(ctx, opts...)
default:
opts := []otlptracehttp.Option{}
if !config.OTLP.Traces.CheckCert {
opts = append(opts, otlptracehttp.WithInsecure())
tlsCfg := &tls.Config{
InsecureSkipVerify: true,
}
opts = append(opts, otlptracehttp.WithTLSClientConfig(tlsCfg))
}
exporter, err = otlptracehttp.New(ctx, opts...)
}
Expand Down
Loading