ACME TLS implementation using TLS-ALPN-01 - closes #160
This commit is contained in:
@@ -41,7 +41,7 @@ use tokio::{
|
||||
sync::oneshot,
|
||||
};
|
||||
|
||||
use utils::listener::{limiter::InFlight, SessionManager};
|
||||
use utils::listener::{limiter::InFlight, SessionManager, TcpAcceptorResult};
|
||||
|
||||
use crate::{
|
||||
queue::{self, instant_to_timestamp, InstantFromTimestamp, QueueId, Status},
|
||||
@@ -160,8 +160,8 @@ impl SessionManager for SmtpAdminSessionManager {
|
||||
fn spawn(&self, session: utils::listener::SessionData<tokio::net::TcpStream>) {
|
||||
let core = self.inner.clone();
|
||||
tokio::spawn(async move {
|
||||
if let Some(tls_acceptor) = &session.instance.tls_acceptor {
|
||||
match tls_acceptor.accept(session.stream).await {
|
||||
match session.instance.acceptor.accept(session.stream).await {
|
||||
TcpAcceptorResult::Tls(accept) => match accept.await {
|
||||
Ok(stream) => {
|
||||
handle_request(stream, core, session.remote_ip, session.in_flight).await;
|
||||
}
|
||||
@@ -174,9 +174,11 @@ impl SessionManager for SmtpAdminSessionManager {
|
||||
err
|
||||
);
|
||||
}
|
||||
},
|
||||
TcpAcceptorResult::Plain(stream) => {
|
||||
handle_request(stream, core, session.remote_ip, session.in_flight).await;
|
||||
}
|
||||
} else {
|
||||
handle_request(session.stream, core, session.remote_ip, session.in_flight).await;
|
||||
TcpAcceptorResult::Close => (),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ use tokio_rustls::TlsConnector;
|
||||
use tracing::Span;
|
||||
use utils::{
|
||||
ipc::DeliveryEvent,
|
||||
listener::{limiter::InFlight, ServerInstance},
|
||||
listener::{limiter::InFlight, ServerInstance, TcpAcceptor},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@@ -481,7 +481,7 @@ static ref SIEVE: Arc<ServerInstance> = Arc::new(utils::listener::ServerInstance
|
||||
protocol: utils::config::ServerProtocol::Lmtp,
|
||||
hostname: "localhost".to_string(),
|
||||
data: "localhost".to_string(),
|
||||
tls_acceptor: None,
|
||||
acceptor: TcpAcceptor::Plain,
|
||||
is_tls_implicit: true,
|
||||
limiter: utils::listener::limiter::ConcurrencyLimiter::new(0),
|
||||
shutdown_rx: tokio::sync::watch::channel(false).1,
|
||||
|
||||
@@ -96,7 +96,7 @@ impl Session<TcpStream> {
|
||||
}
|
||||
|
||||
pub async fn handle_conn(mut self) {
|
||||
if self.handle_conn_().await && self.instance.tls_acceptor.is_some() {
|
||||
if self.handle_conn_().await && self.instance.acceptor.is_tls() {
|
||||
if let Ok(session) = self.into_tls().await {
|
||||
session.handle_conn().await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user