Optimize mail reinjection

- Mark reinjected mails so that Husk can shortcut the processing.
- Fix Cargo.toml to correctly include the patched version of
  sequoia-cert-store and sequoia-keystore.
This commit is contained in:
Malte Meiboom
2026-07-21 12:12:42 +02:00
parent d54cc480b4
commit c37f2ef956
5 changed files with 110 additions and 138 deletions
+8 -3
View File
@@ -18,6 +18,7 @@ use indymilter::{
ContextActions,
};
use crate::types::defaults::HELO_REINJECT_ID;
use crate::types::husk_context::HuskContext;
use crate::config::{HuskConfig, HuskConfigContainer};
use crate::mail;
@@ -83,9 +84,13 @@ impl Daemon {
async fn handle_helo(_cx: &mut Context<HuskContext<'_>>, hostname: CString) -> Status {
log::debug!("HELO: hostname: {hostname:?}");
// XXX: check for reinjection
Status::Continue
if hostname.to_str() == Ok(HELO_REINJECT_ID) {
// Reinjected mail detected - this mail is unencrypted because
// all recipients lack a valid certificate. Accept mail.
Status::Accept
} else {
Status::Continue
}
}
async fn handle_mail(cx: &mut Context<HuskContext<'_>>, config_container: HuskConfigContainer, args: Vec<CString>) -> Status {
+1 -1
View File
@@ -87,7 +87,7 @@ pub async fn smtp_inject(from: String, to: &Vec<Recipient<'_>>, header: CHeader,
rcpts.push(rcpt.try_into()?);
}
let my_id = ClientId::Domain("husk.reinject".to_owned()); // TODO: add secret token?
let my_id = ClientId::Domain(defaults::HELO_REINJECT_ID.to_owned()); // TODO: add secret token?
joinset.spawn(async move {
// XXX
+3
View File
@@ -11,6 +11,9 @@ pub const PID_FILE_LOCATION: &str = "/run/husk/pid";
pub const FOOTER: &str = "---\nProcessed by Husk at {date}.\n";
pub const FOOTER_RECIPIENTS: &str = "This mail was also send to {rcpts}.\n";
/// This ID is used when reinjecting an unencrypted mail into the MTA.
pub const HELO_REINJECT_ID: &str = "husk.reinject";
/// Default logging configuration.
pub const CONSOLE_LOGGING: &str = "
[appenders.console]