@@ -8,6 +8,7 @@ use futures::StreamExt;
8
8
#[ cfg( feature = "enterprise" ) ]
9
9
use futures_util:: future:: BoxFuture ;
10
10
use once_cell:: race:: OnceNonZeroUsize ;
11
+ use openssl:: provider:: Provider ;
11
12
use tokio:: {
12
13
runtime:: { self , Runtime } ,
13
14
sync:: mpsc,
@@ -61,6 +62,7 @@ pub struct Application {
61
62
pub require_healthy : Option < bool > ,
62
63
pub config : ApplicationConfig ,
63
64
pub signals : SignalPair ,
65
+ pub openssl_legacy_provider : Option < Provider > ,
64
66
}
65
67
66
68
impl ApplicationConfig {
@@ -186,6 +188,12 @@ impl Application {
186
188
opts. root . internal_log_rate_limit ,
187
189
) ;
188
190
191
+ let openssl_legacy_provider = opts
192
+ . root
193
+ . openssl_legacy_provider
194
+ . then ( load_openssl_legacy_provider)
195
+ . flatten ( ) ;
196
+
189
197
let runtime = build_runtime ( opts. root . threads , "vector-worker" ) ?;
190
198
191
199
// Signal handler for OS and provider messages.
@@ -206,6 +214,7 @@ impl Application {
206
214
require_healthy : opts. root . require_healthy ,
207
215
config,
208
216
signals,
217
+ openssl_legacy_provider,
209
218
} ,
210
219
) )
211
220
}
@@ -222,6 +231,7 @@ impl Application {
222
231
require_healthy,
223
232
config,
224
233
signals,
234
+ openssl_legacy_provider,
225
235
} = self ;
226
236
227
237
let topology_controller = SharedTopologyController :: new ( TopologyController {
@@ -239,6 +249,7 @@ impl Application {
239
249
graceful_crash_receiver : config. graceful_crash_receiver ,
240
250
signals,
241
251
topology_controller,
252
+ openssl_legacy_provider,
242
253
} )
243
254
}
244
255
}
@@ -248,6 +259,7 @@ pub struct StartedApplication {
248
259
pub graceful_crash_receiver : mpsc:: UnboundedReceiver < ( ) > ,
249
260
pub signals : SignalPair ,
250
261
pub topology_controller : SharedTopologyController ,
262
+ pub openssl_legacy_provider : Option < Provider > ,
251
263
}
252
264
253
265
impl StartedApplication {
@@ -261,6 +273,7 @@ impl StartedApplication {
261
273
graceful_crash_receiver,
262
274
signals,
263
275
topology_controller,
276
+ openssl_legacy_provider,
264
277
} = self ;
265
278
266
279
let mut graceful_crash = UnboundedReceiverStream :: new ( graceful_crash_receiver) ;
@@ -315,6 +328,7 @@ impl StartedApplication {
315
328
signal,
316
329
signal_rx,
317
330
topology_controller,
331
+ openssl_legacy_provider,
318
332
}
319
333
}
320
334
}
@@ -323,6 +337,7 @@ pub struct FinishedApplication {
323
337
pub signal : SignalTo ,
324
338
pub signal_rx : SignalRx ,
325
339
pub topology_controller : SharedTopologyController ,
340
+ pub openssl_legacy_provider : Option < Provider > ,
326
341
}
327
342
328
343
impl FinishedApplication {
@@ -331,6 +346,7 @@ impl FinishedApplication {
331
346
signal,
332
347
mut signal_rx,
333
348
topology_controller,
349
+ openssl_legacy_provider,
334
350
} = self ;
335
351
336
352
// At this point, we'll have the only reference to the shared topology controller and can
@@ -340,7 +356,7 @@ impl FinishedApplication {
340
356
. expect ( "fail to unwrap topology controller" )
341
357
. into_inner ( ) ;
342
358
343
- match signal {
359
+ let status = match signal {
344
360
SignalTo :: Shutdown => {
345
361
emit ! ( VectorStopped ) ;
346
362
tokio:: select! {
@@ -382,7 +398,9 @@ impl FinishedApplication {
382
398
} )
383
399
}
384
400
_ => unreachable ! ( ) ,
385
- }
401
+ } ;
402
+ drop ( openssl_legacy_provider) ;
403
+ status
386
404
}
387
405
}
388
406
@@ -525,3 +543,18 @@ pub fn init_logging(color: bool, format: LogFormat, log_level: &str, rate: u64)
525
543
) ;
526
544
info ! ( message = "Log level is enabled." , level = ?level) ;
527
545
}
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
+ }
0 commit comments