Skip to content

Commit 8454a6f

Browse files
brucegdsmith3197
andauthored
chore(deps): Bump OpenSSL base version to 3.1.* (#17669)
* chore(deps): Bump OpenSSL base version to 3.0.* * update tag * temporary test fix * fix cross compile * fix cross compile, centos only * add force-engine feature * fix fmtting * add option for enabling legacy provider * small nit * feedback * add deprecation warn message --------- Co-authored-by: Doug Smith <doug.smith3197@gmail.com>
1 parent caf6103 commit 8454a6f

File tree

6 files changed

+56
-10
lines changed

6 files changed

+56
-10
lines changed

Cargo.lock

+6-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ nix = { version = "0.26.2", default-features = false, features = ["socket", "sig
345345
[build-dependencies]
346346
prost-build = { version = "0.11", default-features = false, optional = true }
347347
tonic-build = { version = "0.9", default-features = false, features = ["transport", "prost"], optional = true }
348-
openssl-src = { version = "111", default-features = false, features = ["force-engine"] }
348+
openssl-src = { version = "300", default-features = false, features = ["force-engine", "legacy"] }
349349

350350
[dev-dependencies]
351351
approx = "0.5.1"
@@ -381,6 +381,11 @@ nix = { git = "https://github.com/vectordotdev/nix.git", branch = "memfd/gnu/mus
381381
# The `heim` crates depend on `ntapi` 0.3.7 on Windows, but that version has an
382382
# unaligned access bug fixed in the following revision.
383383
ntapi = { git = "https://github.com/MSxDOS/ntapi.git", rev = "24fc1e47677fc9f6e38e5f154e6011dc9b270da6" }
384+
# The current `openssl-sys` crate will vendor the OpenSSL sources via
385+
# `openssl-src` at version 1.1.1*, but we want version 3.1.*. Bring in forked
386+
# version of that crate with the appropriate dependency patched in.
387+
openssl-sys = { git = "https://github.com/vectordotdev/rust-openssl.git", tag = "openssl-sys-v0.9.91+3.0.0" }
388+
openssl-src = { git = "https://github.com/vectordotdev/openssl-src-rs.git", tag = "release-300-force-engine+3.1.2"}
384389

385390
[features]
386391
# Default features for *-unknown-linux-gnu and *-apple-darwin

lib/vector-core/src/tls/settings.rs

+1
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ mod test {
630630

631631
#[test]
632632
fn from_options_pkcs12() {
633+
let _provider = openssl::provider::Provider::try_load(None, "legacy", true).unwrap();
633634
let options = TlsConfig {
634635
crt_file: Some(TEST_PKCS12_PATH.into()),
635636
key_pass: Some("NOPASS".into()),

scripts/cross/bootstrap-centos.sh

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ set -o errexit
33

44
yum install -y unzip centos-release-scl
55
yum install -y llvm-toolset-7
6+
7+
# needed to compile openssl
8+
yum install -y perl-IPC-Cmd
9+

src/app.rs

+35-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use futures::StreamExt;
88
#[cfg(feature = "enterprise")]
99
use futures_util::future::BoxFuture;
1010
use once_cell::race::OnceNonZeroUsize;
11+
use openssl::provider::Provider;
1112
use tokio::{
1213
runtime::{self, Runtime},
1314
sync::mpsc,
@@ -61,6 +62,7 @@ pub struct Application {
6162
pub require_healthy: Option<bool>,
6263
pub config: ApplicationConfig,
6364
pub signals: SignalPair,
65+
pub openssl_legacy_provider: Option<Provider>,
6466
}
6567

6668
impl ApplicationConfig {
@@ -186,6 +188,12 @@ impl Application {
186188
opts.root.internal_log_rate_limit,
187189
);
188190

191+
let openssl_legacy_provider = opts
192+
.root
193+
.openssl_legacy_provider
194+
.then(load_openssl_legacy_provider)
195+
.flatten();
196+
189197
let runtime = build_runtime(opts.root.threads, "vector-worker")?;
190198

191199
// Signal handler for OS and provider messages.
@@ -206,6 +214,7 @@ impl Application {
206214
require_healthy: opts.root.require_healthy,
207215
config,
208216
signals,
217+
openssl_legacy_provider,
209218
},
210219
))
211220
}
@@ -222,6 +231,7 @@ impl Application {
222231
require_healthy,
223232
config,
224233
signals,
234+
openssl_legacy_provider,
225235
} = self;
226236

227237
let topology_controller = SharedTopologyController::new(TopologyController {
@@ -239,6 +249,7 @@ impl Application {
239249
graceful_crash_receiver: config.graceful_crash_receiver,
240250
signals,
241251
topology_controller,
252+
openssl_legacy_provider,
242253
})
243254
}
244255
}
@@ -248,6 +259,7 @@ pub struct StartedApplication {
248259
pub graceful_crash_receiver: mpsc::UnboundedReceiver<()>,
249260
pub signals: SignalPair,
250261
pub topology_controller: SharedTopologyController,
262+
pub openssl_legacy_provider: Option<Provider>,
251263
}
252264

253265
impl StartedApplication {
@@ -261,6 +273,7 @@ impl StartedApplication {
261273
graceful_crash_receiver,
262274
signals,
263275
topology_controller,
276+
openssl_legacy_provider,
264277
} = self;
265278

266279
let mut graceful_crash = UnboundedReceiverStream::new(graceful_crash_receiver);
@@ -315,6 +328,7 @@ impl StartedApplication {
315328
signal,
316329
signal_rx,
317330
topology_controller,
331+
openssl_legacy_provider,
318332
}
319333
}
320334
}
@@ -323,6 +337,7 @@ pub struct FinishedApplication {
323337
pub signal: SignalTo,
324338
pub signal_rx: SignalRx,
325339
pub topology_controller: SharedTopologyController,
340+
pub openssl_legacy_provider: Option<Provider>,
326341
}
327342

328343
impl FinishedApplication {
@@ -331,6 +346,7 @@ impl FinishedApplication {
331346
signal,
332347
mut signal_rx,
333348
topology_controller,
349+
openssl_legacy_provider,
334350
} = self;
335351

336352
// At this point, we'll have the only reference to the shared topology controller and can
@@ -340,7 +356,7 @@ impl FinishedApplication {
340356
.expect("fail to unwrap topology controller")
341357
.into_inner();
342358

343-
match signal {
359+
let status = match signal {
344360
SignalTo::Shutdown => {
345361
emit!(VectorStopped);
346362
tokio::select! {
@@ -382,7 +398,9 @@ impl FinishedApplication {
382398
})
383399
}
384400
_ => unreachable!(),
385-
}
401+
};
402+
drop(openssl_legacy_provider);
403+
status
386404
}
387405
}
388406

@@ -525,3 +543,18 @@ pub fn init_logging(color: bool, format: LogFormat, log_level: &str, rate: u64)
525543
);
526544
info!(message = "Log level is enabled.", level = ?level);
527545
}
546+
547+
/// Load the legacy OpenSSL provider.
548+
///
549+
/// The returned [Provider] must stay in scope for the entire lifetime of the application, as it
550+
/// will be unloaded when it is dropped.
551+
pub fn load_openssl_legacy_provider() -> Option<Provider> {
552+
warn!(message = "DEPRECATED The openssl legacy provider provides algorithms and key sizes no longer recommended for use.");
553+
Provider::try_load(None, "legacy", true)
554+
.map(|provider| {
555+
info!(message = "Loaded openssl legacy provider.");
556+
provider
557+
})
558+
.map_err(|error| error!(message = "Failed to load openssl legacy provider.", %error))
559+
.ok()
560+
}

src/cli.rs

+4
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ pub struct RootOpts {
194194
default_value = "5000"
195195
)]
196196
pub allocation_tracing_reporting_interval_ms: u64,
197+
198+
/// Load the OpenSSL legacy provider.
199+
#[arg(long, env = "VECTOR_OPENSSL_LEGACY_PROVIDER", default_value = "true")]
200+
pub openssl_legacy_provider: bool,
197201
}
198202

199203
impl RootOpts {

0 commit comments

Comments
 (0)