fix(transport): Correctly use minimum TLS version (fixes #323)
This commit is contained in:
@@ -25,7 +25,7 @@ impl ClientTlsParameters {
|
||||
|
||||
/// Accepted protocols by default.
|
||||
/// This removes TLS 1.0 and 1.1 compared to tls-native defaults.
|
||||
pub const DEFAULT_TLS_PROTOCOLS: &[Protocol] = &[Protocol::Tlsv12];
|
||||
pub const DEFAULT_TLS_MIN_PROTOCOL: Protocol = Protocol::Tlsv12;
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Represents the different types of underlying network streams
|
||||
|
||||
@@ -17,7 +17,7 @@ use crate::smtp::authentication::{
|
||||
Credentials, Mechanism, DEFAULT_ENCRYPTED_MECHANISMS, DEFAULT_UNENCRYPTED_MECHANISMS,
|
||||
};
|
||||
use crate::smtp::client::net::ClientTlsParameters;
|
||||
use crate::smtp::client::net::DEFAULT_TLS_PROTOCOLS;
|
||||
use crate::smtp::client::net::DEFAULT_TLS_MIN_PROTOCOL;
|
||||
use crate::smtp::client::InnerClient;
|
||||
use crate::smtp::commands::*;
|
||||
use crate::smtp::error::{Error, SmtpResult};
|
||||
@@ -136,7 +136,7 @@ impl SmtpClient {
|
||||
/// to validate TLS certificates.
|
||||
pub fn new_simple(domain: &str) -> Result<SmtpClient, Error> {
|
||||
let mut tls_builder = TlsConnector::builder();
|
||||
tls_builder.min_protocol_version(Some(DEFAULT_TLS_PROTOCOLS[0]));
|
||||
tls_builder.min_protocol_version(Some(DEFAULT_TLS_MIN_PROTOCOL));
|
||||
|
||||
let tls_parameters =
|
||||
ClientTlsParameters::new(domain.to_string(), tls_builder.build().unwrap());
|
||||
|
||||
Reference in New Issue
Block a user