Skip to content

Commit 547aea7

Browse files
authored
fix: Install default crypto provider (#45)
* fix: Install default crypto provider * changelog
1 parent 1992bad commit 547aea7

File tree

6 files changed

+23
-3
lines changed

6 files changed

+23
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
## [0.3.1] - 2024-08-16
8+
9+
### Fixed
10+
11+
- Install default crypto provider, this prevent servers using https from starting ([#45]).
12+
13+
[#45]: https://github.com/stackabletech/trino-lb/pull/45
14+
715
## [0.3.0] - 2024-08-15
816

917
### Added

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ reqwest = { version = "0.12", default-features = false, features = [
6363
"json",
6464
"cookies",
6565
] }
66+
rustls = "0.23" # https://github.com/rustls/rustls/issues/1938
6667
rstest = "0.22"
6768
serde = { version = "1.0", features = ["derive"] }
6869
serde_json = "1.0"

example-configs/simple-single-trino.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
trinoLb:
2-
externalAddress: https://127.0.0.1:443
2+
externalAddress: https://127.0.0.1:8443
33
# When you enable authentication trino-clients enforce https encryption
44
tls:
55
enabled: true
6-
certPemFile: /self-signed-certs/cert.pem
7-
keyPemFile: /self-signed-certs/key.pem
6+
certPemFile: ./example-configs/self-signed-certs/cert.pem
7+
keyPemFile: ./example-configs/self-signed-certs/key.pem
88
# Use in-memory persistence which will loose all queued running queries on restart
99
persistence:
1010
inMemory: {}

trino-lb/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ rand.workspace = true
3939
redis.workspace = true
4040
regex.workspace = true
4141
reqwest.workspace = true
42+
rustls.workspace = true
4243
serde_json.workspace = true
4344
serde_yaml.workspace = true
4445
serde.workspace = true

trino-lb/src/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ mod trino_client;
3333

3434
#[derive(Snafu, Debug)]
3535
pub enum Error {
36+
#[snafu(display("Failed to install rustls crypto provider"))]
37+
InstallRustlsCryptoProvider {},
38+
3639
#[snafu(display("Failed to set up tracing"))]
3740
SetUpTracing { source: tracing::Error },
3841

@@ -97,6 +100,12 @@ fn main() -> Result<(), MainError> {
97100
async fn start() -> Result<(), MainError> {
98101
let args = Args::parse();
99102

103+
// To prevent `no process-level CryptoProvider available -- call CryptoProvider::install_default() before this point`,
104+
// see https://github.com/rustls/rustls/issues/1938 for details
105+
rustls::crypto::aws_lc_rs::default_provider()
106+
.install_default()
107+
.map_err(|_| Error::InstallRustlsCryptoProvider {})?;
108+
100109
let config = Config::read_from_file(&args.config_file)
101110
.await
102111
.context(ReadConfigSnafu)?;

0 commit comments

Comments
 (0)