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

[beatsauthextension] Add support for beats related ssl parameters to be used with otel-components #334

Merged
merged 14 commits into from
Feb 5, 2025
Prev Previous commit
Next Next commit
adds ca_trusted_fingerprint, ca_sha256
  • Loading branch information
khushijain21 committed Jan 23, 2025
commit da10de388d8ceaf5a74782b81c4c8fc0d243ff5c
7 changes: 5 additions & 2 deletions extension/beatsauthextension/authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ func newAuthenticator(cfg *Config, telemetry component.TelemetrySettings) (*auth
func (a *authenticator) Start(ctx context.Context, host component.Host) error {
if a.cfg.TLS != nil {
tlsConfig, err := tlscommon.LoadTLSConfig(&tlscommon.Config{
VerificationMode: a.cfg.TLS.VerificationMode,
VerificationMode: a.cfg.TLS.VerificationMode,
CATrustedFingerprint: a.cfg.TLS.CATrustedFingerprint,
CASha256: a.cfg.TLS.CASha256,
})
if err != nil {
return err
Expand All @@ -69,7 +71,8 @@ func (a *authenticator) RoundTripper(base http.RoundTripper) (http.RoundTripper,

func (a *authenticator) configureTransport(transport *http.Transport) error {
if a.tlsConfig != nil {
transport.TLSClientConfig = a.tlsConfig.BuildModuleClientConfig(a.tlsConfig.ServerName)
// injecting verifyConnection here, keeping all other fields on TLSConfig
transport.TLSClientConfig.VerifyConnection = a.tlsConfig.ToConfig().VerifyConnection
}
return nil
}
Expand Down
5 changes: 3 additions & 2 deletions extension/beatsauthextension/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ type Config struct {
}

type TLSConfig struct {
ServerName string `mapstructure:"server_name"`
VerificationMode tlscommon.TLSVerificationMode `mapstructure:"verification_mode"`
VerificationMode tlscommon.TLSVerificationMode `mapstructure:"verification_mode"`
CATrustedFingerprint string `mapstructure:"ca_trusted_fingerprint"`
CASha256 []string `mapstructure:"ca_sha256"`
}

func createDefaultConfig() component.Config {
Expand Down