Skip to content

Commit

Permalink
Upgrade tokio-postgres-rustls and rustls (#2500)
Browse files Browse the repository at this point in the history
  • Loading branch information
divergentdave authored Jan 16, 2024
1 parent 0d83a83 commit 2ac6656
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 20 deletions.
107 changes: 91 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ regex = "1"
reqwest = { version = "0.11.23", default-features = false, features = ["rustls-tls", "json"] }
ring = "0.17.7"
routefinder = "0.5.3"
rustls = "0.21.9"
rustls = "0.22.2"
rustls-pemfile = "2.0.0"
serde.workspace = true
serde_json.workspace = true
Expand All @@ -87,7 +87,7 @@ testcontainers = { workspace = true, optional = true }
thiserror.workspace = true
tokio.workspace = true
tokio-postgres = { version = "0.7.10", features = ["with-chrono-0_4", "with-serde_json-1", "with-uuid-1", "array-impls"] }
tokio-postgres-rustls = "0.10.0"
tokio-postgres-rustls = "0.11.0"
tracing = "0.1.40"
tracing-chrome = "0.7.1"
tracing-log = "0.2.0"
Expand Down
3 changes: 1 addition & 2 deletions aggregator/src/binary_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ pub async fn database_pool(db_config: &DbConfig, db_password: Option<&str>) -> R
let conn_mgr = if let Some(ref path) = db_config.tls_trust_store_path {
let root_store = load_pem_trust_store(path).context("failed to load TLS trust store")?;
let rustls_config = rustls::ClientConfig::builder()
.with_safe_defaults()
.with_root_certificates(root_store)
.with_no_client_auth();
Manager::new(database_config, MakeRustlsConnect::new(rustls_config))
Expand Down Expand Up @@ -172,7 +171,7 @@ fn load_pem_trust_store(path: impl AsRef<Path>) -> Result<RootCertStore, io::Err
let mut buf_read = BufReader::new(File::open(path)?);
let der_certs = rustls_pemfile::certs(&mut buf_read).collect::<Result<Vec<_>, _>>()?;
let mut root_cert_store = RootCertStore::empty();
let (added, ignored) = root_cert_store.add_parsable_certificates(&der_certs);
let (added, ignored) = root_cert_store.add_parsable_certificates(der_certs);
info!("loaded {added} root certificates for database connections, ignored {ignored}");
Ok(root_cert_store)
}
Expand Down

0 comments on commit 2ac6656

Please sign in to comment.