Skip to content

Commit 1762b3a

Browse files
authored
feat: Enable Users to Disable TLS Verification when using Custom Endpoint (#14192)
#### Summary <!-- Explain what problem this PR addresses --> <!--
1 parent c696bec commit 1762b3a

4 files changed

Lines changed: 20 additions & 6 deletions

File tree

plugins/destination/s3/client/client.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ package client
33
import (
44
"bytes"
55
"context"
6+
"crypto/tls"
67
"encoding/json"
78
"fmt"
9+
"net/http"
810
"time"
911

1012
"github.com/aws/aws-sdk-go-v2/aws"
13+
awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
1114
"github.com/aws/aws-sdk-go-v2/config"
1215
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
1316
"github.com/aws/aws-sdk-go-v2/service/s3"
@@ -62,6 +65,12 @@ func New(ctx context.Context, logger zerolog.Logger, spec []byte, opts plugin.Ne
6265

6366
cfg.Region = c.spec.Region
6467

68+
cfg.HTTPClient = awshttp.NewBuildableClient().WithTransportOptions(func(tr *http.Transport) {
69+
if tr.TLSClientConfig == nil {
70+
tr.TLSClientConfig = &tls.Config{}
71+
}
72+
tr.TLSClientConfig.InsecureSkipVerify = c.spec.EndpointSkipTLSVerify
73+
})
6574
c.s3Client = s3.NewFromConfig(cfg, func(o *s3.Options) {
6675
if len(c.spec.Endpoint) > 0 {
6776
baseEndpoint := c.spec.Endpoint

plugins/destination/s3/client/spec.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ type Spec struct {
1919
Athena bool `json:"athena,omitempty"`
2020
TestWrite *bool `json:"test_write,omitempty"`
2121

22-
Endpoint string `json:"endpoint,omitempty"`
23-
UsePathStyle bool `json:"use_path_style,omitempty"`
24-
25-
BatchSize *int64 `json:"batch_size"`
26-
BatchSizeBytes *int64 `json:"batch_size_bytes"`
27-
BatchTimeout *configtype.Duration `json:"batch_timeout"`
22+
Endpoint string `json:"endpoint,omitempty"`
23+
UsePathStyle bool `json:"use_path_style,omitempty"`
24+
EndpointSkipTLSVerify bool `json:"endpoint_skip_tls_verify,omitempty"`
25+
BatchSize *int64 `json:"batch_size"`
26+
BatchSizeBytes *int64 `json:"batch_size_bytes"`
27+
BatchTimeout *configtype.Duration `json:"batch_timeout"`
2828
}
2929

3030
func (s *Spec) SetDefaults() {

website/pages/docs/plugins/destinations/s3/_configuration.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ spec:
2424
# athena: false # <- set this to true for Athena compatibility
2525
# test_write: true # tests the ability to write to the bucket before processing the data
2626
# endpoint: "" # Endpoint to use for S3 API calls.
27+
# endpoint_skip_tls_verify # Disable TLS verification if using an untrusted certificate
2728
# use_path_style: false
2829
# batch_size: 10000 # 10K entries
2930
# batch_size_bytes: 52428800 # 50 MiB

website/pages/docs/plugins/destinations/s3/overview.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ This is the (nested) spec used by the CSV destination Plugin.
8282
Endpoint to use for S3 API calls. This is useful for S3-compatible storage services such as MinIO.
8383
Note: if you want to use path-style addressing, i.e., `https://s3.amazonaws.com/BUCKET/KEY`, `use_path_style` should be enabled, too.
8484

85+
- `endpoint_skip_tls_verify` (`boolean`) (optional) (default: `false`)
86+
87+
Disable TLS verification for requests to your S3 endpoint. This option is intended to be used when using a custom endpoint using the `endpoint` option.
88+
8589
- `use_path_style` (`boolean`) (optional) (default: `false`)
8690

8791
Allows to use path-style addressing in the `endpoint` option, i.e., `https://s3.amazonaws.com/BUCKET/KEY`.

0 commit comments

Comments
 (0)