Skip to content

Commit

Permalink
Set minimum TLS version to 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Feb 26, 2023
1 parent 247bf58 commit 8177070
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Changes
- Make smeared timestamp generation non-async. #4075
- Set minimum TLS version to 1.2. #4096

### Fixes
- Do not block async task executor while decrypting the messages. #4079
Expand Down
6 changes: 4 additions & 2 deletions src/net/tls.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! TLS support.

use anyhow::Result;
use async_native_tls::{Certificate, TlsConnector, TlsStream};
use async_native_tls::{Certificate, Protocol, TlsConnector, TlsStream};
use once_cell::sync::Lazy;
use tokio::io::{AsyncRead, AsyncWrite};

Expand All @@ -15,7 +15,9 @@ static LETSENCRYPT_ROOT: Lazy<Certificate> = Lazy::new(|| {
});

pub fn build_tls(strict_tls: bool) -> TlsConnector {
let tls_builder = TlsConnector::new().add_root_certificate(LETSENCRYPT_ROOT.clone());
let tls_builder = TlsConnector::new()
.min_protocol_version(Some(Protocol::Tlsv12))
.add_root_certificate(LETSENCRYPT_ROOT.clone());

if strict_tls {
tls_builder
Expand Down

0 comments on commit 8177070

Please sign in to comment.