From 198068cf55732a3bfe034697d9dc5c9abadb1b63 Mon Sep 17 00:00:00 2001 From: Tom de Bruijn Date: Thu, 13 Apr 2023 21:37:02 +0200 Subject: [PATCH] fix(appsignal sink): Add TLS config option (#17122) --- src/sinks/appsignal/mod.rs | 7 +- .../components/sinks/base/appsignal.cue | 85 +++++++++++++++++++ 2 files changed, 90 insertions(+), 2 deletions(-) diff --git a/src/sinks/appsignal/mod.rs b/src/sinks/appsignal/mod.rs index aff1fdb5093e3..ca2211f8505a2 100644 --- a/src/sinks/appsignal/mod.rs +++ b/src/sinks/appsignal/mod.rs @@ -32,7 +32,7 @@ use crate::{ }, BuildError, }, - tls::TlsSettings, + tls::{TlsConfig, TlsSettings}, }; #[derive(Debug, Snafu)] @@ -71,6 +71,9 @@ pub struct AppsignalSinkConfig { #[serde(default)] request: TowerRequestConfig, + #[configurable(derived)] + tls: Option, + #[configurable(derived)] #[serde( default, @@ -114,7 +117,7 @@ impl SinkConfig for AppsignalSinkConfig { let buffer = JsonArrayBuffer::new(batch_settings.size); - let tls_settings = TlsSettings::from_options(&None)?; + let tls_settings = TlsSettings::from_options(&self.tls)?; let client = HttpClient::new(tls_settings, cx.proxy())?; let sink = BatchedHttpSink::new( diff --git a/website/cue/reference/components/sinks/base/appsignal.cue b/website/cue/reference/components/sinks/base/appsignal.cue index bc46a00078e9a..13a72cf6da2f9 100644 --- a/website/cue/reference/components/sinks/base/appsignal.cue +++ b/website/cue/reference/components/sinks/base/appsignal.cue @@ -266,4 +266,89 @@ base: components: sinks: appsignal: configuration: { } } } + tls: { + description: "TLS configuration." + required: false + type: object: options: { + alpn_protocols: { + description: """ + Sets the list of supported ALPN protocols. + + Declare the supported ALPN protocols, which are used during negotiation with peer. They are prioritized in the order + that they are defined. + """ + required: false + type: array: items: type: string: examples: ["h2"] + } + ca_file: { + description: """ + Absolute path to an additional CA certificate file. + + The certificate must be in the DER or PEM (X.509) format. Additionally, the certificate can be provided as an inline string in PEM format. + """ + required: false + type: string: examples: ["/path/to/certificate_authority.crt"] + } + crt_file: { + description: """ + Absolute path to a certificate file used to identify this server. + + The certificate must be in DER, PEM (X.509), or PKCS#12 format. Additionally, the certificate can be provided as + an inline string in PEM format. + + If this is set, and is not a PKCS#12 archive, `key_file` must also be set. + """ + required: false + type: string: examples: ["/path/to/host_certificate.crt"] + } + key_file: { + description: """ + Absolute path to a private key file used to identify this server. + + The key must be in DER or PEM (PKCS#8) format. Additionally, the key can be provided as an inline string in PEM format. + """ + required: false + type: string: examples: ["/path/to/host_certificate.key"] + } + key_pass: { + description: """ + Passphrase used to unlock the encrypted key file. + + This has no effect unless `key_file` is set. + """ + required: false + type: string: examples: ["${KEY_PASS_ENV_VAR}", "PassWord1"] + } + verify_certificate: { + description: """ + Enables certificate verification. + + If enabled, certificates must not be expired and must be issued by a trusted + issuer. This verification operates in a hierarchical manner, checking that the leaf certificate (the + certificate presented by the client/server) is not only valid, but that the issuer of that certificate is also valid, and + so on until the verification process reaches a root certificate. + + Relevant for both incoming and outgoing connections. + + Do NOT set this to `false` unless you understand the risks of not verifying the validity of certificates. + """ + required: false + type: bool: {} + } + verify_hostname: { + description: """ + Enables hostname verification. + + If enabled, the hostname used to connect to the remote host must be present in the TLS certificate presented by + the remote host, either as the Common Name or as an entry in the Subject Alternative Name extension. + + Only relevant for outgoing connections. + + Do NOT set this to `false` unless you understand the risks of not verifying the remote hostname. + """ + required: false + type: bool: {} + } + } + } }