fix: resolve clippy errors for rustls 0.23 API and unnecessary_map_or lint
- Fix ServerConfig::builder() to builder_with_provider() for TLS 1.3 enforcement - Add aws_lc_rs feature to rustls in Cargo.toml - Fix clippy unnecessary_map_or -> is_some_and in packages/mod.rs
This commit is contained in:
@ -20,7 +20,7 @@ actix-tls = { version = "3", features = ["rustls-0_23"] }
|
|||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
|
||||||
# TLS/mTLS (rustls for modern TLS 1.3)
|
# TLS/mTLS (rustls for modern TLS 1.3)
|
||||||
rustls = "0.23"
|
rustls = { version = "0.23", features = ["aws_lc_rs"] }
|
||||||
rustls-pemfile = "2"
|
rustls-pemfile = "2"
|
||||||
tokio-rustls = "0.26"
|
tokio-rustls = "0.26"
|
||||||
x509-parser = "0.16"
|
x509-parser = "0.16"
|
||||||
|
|||||||
@ -14,6 +14,7 @@ use rustls::{
|
|||||||
server::{ServerConfig, WebPkiClientVerifier},
|
server::{ServerConfig, WebPkiClientVerifier},
|
||||||
version::TLS13,
|
version::TLS13,
|
||||||
RootCertStore,
|
RootCertStore,
|
||||||
|
crypto::aws_lc_rs,
|
||||||
};
|
};
|
||||||
use rustls_pemfile::{certs, private_key};
|
use rustls_pemfile::{certs, private_key};
|
||||||
use std::{fs::File, io::BufReader, sync::Arc};
|
use std::{fs::File, io::BufReader, sync::Arc};
|
||||||
@ -79,7 +80,7 @@ impl MtlsMiddleware {
|
|||||||
let server_cert = load_certs(&self.config.server_cert_path)?;
|
let server_cert = load_certs(&self.config.server_cert_path)?;
|
||||||
let server_key = load_private_key(&self.config.server_key_path)?;
|
let server_key = load_private_key(&self.config.server_key_path)?;
|
||||||
|
|
||||||
let config = ServerConfig::builder()
|
let config = ServerConfig::builder_with_provider(Arc::new(aws_lc_rs::default_provider()))
|
||||||
.with_protocol_versions(&[&TLS13])
|
.with_protocol_versions(&[&TLS13])
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
MtlsError::ServerConfigError(format!("Failed to set TLS 1.3 only: {}", e))
|
MtlsError::ServerConfigError(format!("Failed to set TLS 1.3 only: {}", e))
|
||||||
|
|||||||
@ -99,7 +99,7 @@ impl AptBackend {
|
|||||||
/// Run apt command and capture output
|
/// Run apt command and capture output
|
||||||
fn run_apt(&self, args: &[&str]) -> Result<String> {
|
fn run_apt(&self, args: &[&str]) -> Result<String> {
|
||||||
// Use sudo for operations that modify packages (install, upgrade, remove, purge)
|
// Use sudo for operations that modify packages (install, upgrade, remove, purge)
|
||||||
let needs_sudo = args.first().map_or(false, |&cmd| {
|
let needs_sudo = args.first().is_some_and(|&cmd| {
|
||||||
matches!(
|
matches!(
|
||||||
cmd,
|
cmd,
|
||||||
"install" | "upgrade" | "remove" | "purge" | "dist-upgrade" | "autoremove"
|
"install" | "upgrade" | "remove" | "purge" | "dist-upgrade" | "autoremove"
|
||||||
|
|||||||
Reference in New Issue
Block a user