Skip to content

Commit

Permalink
fix(vector sink): cert verification with proxy enabled (vectordotdev#…
Browse files Browse the repository at this point in the history
…17651)

fixes vectordotdev#17629

<!--
**Your PR title must conform to the conventional commit spec!**

  <type>(<scope>)!: <description>

  * `type` = chore, enhancement, feat, fix, docs
  * `!` = OPTIONAL: signals a breaking change
* `scope` = Optional when `type` is "chore" or "docs", available scopes
https://github.com/vectordotdev/vector/blob/master/.github/semantic.yml#L20
  * `description` = short description of the change

Examples:

  * enhancement(file source): Add `sort` option to sort discovered files
  * feat(new source): Initial `statsd` source
  * fix(file source): Fix a bug discovering new files
  * chore(external docs): Clarify `batch_size` option
-->

---------

Co-authored-by: neuronull <neuronull@pm.me>
  • Loading branch information
joemiller and neuronull authored Jul 7, 2023
1 parent 9765809 commit 45e24c7
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/sinks/vector/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::{
AcknowledgementsConfig, GenerateConfig, Input, ProxyConfig, SinkConfig, SinkContext,
SinkHealthcheckOptions,
},
http::build_proxy_connector,
proto::vector as proto,
sinks::{
util::{
Expand All @@ -24,7 +25,7 @@ use crate::{
},
Healthcheck, VectorSink as VectorSinkType,
},
tls::{tls_connector_builder, MaybeTlsSettings, TlsEnableableConfig},
tls::{MaybeTlsSettings, TlsEnableableConfig},
};

/// Configuration for the `vector` sink.
Expand Down Expand Up @@ -209,23 +210,7 @@ fn new_client(
tls_settings: &MaybeTlsSettings,
proxy_config: &ProxyConfig,
) -> crate::Result<hyper::Client<ProxyConnector<HttpsConnector<HttpConnector>>, BoxBody>> {
let mut http = HttpConnector::new();
http.enforce_http(false);

let tls = tls_connector_builder(tls_settings)?;
let mut https = HttpsConnector::with_connector(http, tls)?;

let settings = tls_settings.tls().cloned();
https.set_callback(move |c, _uri| {
if let Some(settings) = &settings {
settings.apply_connect_configuration(c);
}

Ok(())
});

let mut proxy = ProxyConnector::new(https).unwrap();
proxy_config.configure(&mut proxy)?;
let proxy = build_proxy_connector(tls_settings.clone(), proxy_config)?;

Ok(hyper::Client::builder().http2_only(true).build(proxy))
}
Expand Down

0 comments on commit 45e24c7

Please sign in to comment.